See our article “Surviving global risks through the preservation of humanity’s data on the Moon”, where we explore exactly this question and found that preserving data on cold craters on Moon is possible for hundred millions of years. There also other ways to preserve the data, like using deep caves in cratons on Earth. There is a problem that the data will should be easily find by the next civilization, but it could be solved by creation some bites, like drawing of the surface of the Moon.
See our article “Surviving global risks through the preservation of humanity’s data on the Moon”, where we explore exactly this question and found that preserving data on cold craters on Moon is possible for hundred millions of years. There also other ways to preserve the data, like using deep caves in cratons on Earth. There is a problem that the data will should be easily find by the next civilization, but it could be solved by creation some bites, like drawing of the surface of the Moon.
https://www.sciencedirect.com/science/article/pii/S009457651830119X
https://philpapers.org/rec/TURSGR