1What the server says
Minecraft 1.21.1 with both level.dat files damaged: the log's lines
[15:24:20] [ServerMain/WARN]: Failed to load world data from ./world/level.dat
[15:24:20] [ServerMain/INFO]: Attempting to use fallback
[15:24:20] [ServerMain/ERROR]: Failed to load world data from ./world/level.dat_old
[15:24:20] [ServerMain/ERROR]: Failed to load world data from ./world/level.dat and ./world/level.dat_old. World files may be corrupted. Shutting down.
A world is a folder of files, and each kind of damage shows differently. level.dat holds the world's settings, like its seed and game rules, and level.dat_old is the copy from the save before. The land is in the region folder, 32 by 32 chunks to a file, and mobs, animals and item frames are in entities, in files of the same shape.
2What each kind of damage did
On 29 Sep we built a small Minecraft 1.21.1 world with a gold block, a chest of 5 diamonds, a diamond block and a named cow in three chunks. Then we damaged a copy of it one way at a time, and started the server:
| What we damaged | What the log said | What happened |
|---|---|---|
| level.dat, with random bytes | Failed to load world data from ./world/level.dat, then Attempting to use fallback | It started from level.dat_old with everything in place, and kept the bad file as level.dat_corrupted_ and the date |
| level.dat and level.dat_old | The lines above | It didn't start |
| One chunk's data in the region file | Failed to read chunk [0, 0], then Failed to load chunk 0,0 | That chunk came back as new land, without the gold block; the others were fine |
| The region file, cut to 100,000 bytes | has an invalid sector at index, 233 times: once for each chunk past the cut | Those chunks came back as new land |
| The region file, cut inside its first 8 KB | has truncated header: 4000 | Every chunk in the file came back as new land |
| The region file, filled with zeros | Nothing | Every chunk in the file came back as new land |
| One chunk in the entities file | Failed to load entity chunk [0, 0] | The cow was gone; the blocks were fine |
For each damaged chunk, the server wrote a Chunk IO Error Report in its debug folder, with the chunk's Position and whether it was land or entities. Paper 1.21.1 printed the same lines about level.dat. For the damaged chunk it logged chunk data will be lost, and made new land too.
3Once it saves, the old chunk is gone
The server doesn't wait for you. It makes new land for what it can't read and saves it over the damaged chunk: when we started the damaged world a second time, there was no error at all, just grass where the gold block had been. A region file of zeros gives no error even the first time. So when you see these lines, or builds are missing, stop the server and copy the world folder before anything else.
4What a full disk did
A full disk often gets the blame, so we filled one: the world on a 12 MB disk with 40 KB free, while the server made new land.
The lines that matter, from our full disk
[15:29:13] [IO-Worker-7/ERROR]: Failed to store chunk [126, 126]
java.io.IOException: No space left on device
[15:29:13] [IO-Worker-7/ERROR]: Failed to save chunk 126,126
[15:29:18] [Server thread/ERROR]: Failed to save level /tmp/corruptrun/small/world
[15:29:18] [Server thread/INFO]: Saved the game
It logged Failed to save chunk 1,081 times, yet said Saved the game. Stopping logged Exception stopping the server, and the process ran for 45 seconds or more after that before it quit. Nothing was damaged, though: once we deleted a file to make room, it started without a warning and with every build, even those made after the disk filled. The new land it couldn't store, it simply made again.
5How to get it back
- Stop the server and copy the world folder first. The next save makes a damaged chunk's loss permanent.
- Only level.dat damaged: nothing to do. Minecraft used level.dat_old by itself, with every build in place.
- Both level.dat files: restore a backup, or let the server make a new one. We deleted both, and the server said
No existing world data, creating new world. Every build, the chest and the cow were still there, but the seed was new, so new land wouldn't match the old, and game rules and the time started over. With the old seed inlevel-seedin server.properties first, ours came back as -7710755848644571073. A crash report's World Seed line, or the output of/seedin an old log, gives yours. - Damaged chunks: restore the backup, or just its region file. With the server stopped, copying
region/r.0.0.mcaback from our copy of the world brought the gold block back. Everything else in that 512 by 512 block area goes back to the backup's time too. - No backup: start it, and rebuild what's missing. The server keeps every chunk it can read, and makes new land for the rest.
- Keep free space on the disk. A full disk didn't damage our world, but saves failed until there was room again.
# In the server's folder, with the server stopped cp -r world world-copy rm world/level.dat world/level.dat_old # Then set level-seed= in server.properties to the old seed, and start
# In the server's folder, with the server stopped cp -r world world-copy cp backup/world/region/r.0.0.mca world/region/r.0.0.mca # from your backup
6On a Playkeeper server
- When both level.dat files are damaged, the Overview says The world's level.dat file is damaged, and offers to restore the latest backup, if there is one.
- A damaged chunk doesn't stop the server. The Console shows the Failed to read chunk lines. If the server stops later with them in its log, the Overview says Part of the world may be damaged, and offers to start it again or restore a backup.
- When it stops with the disk full, the Overview says The disk is full, with how much is free.
- Schedules in Settings back up each server, and the World tab restores a backup. It saves the current world as a rollback archive first, and puts it back by itself if the restored world doesn't start: how to recover a world.
Questions
Can a corrupted Minecraft world be fixed?
Often. A damaged level.dat is replaced by level.dat_old by itself, and a damaged chunk costs only that chunk. A backup brings back everything.
What is level.dat_old?
The level.dat from the save before. Minecraft uses it when level.dat can't be read, and keeps the damaged file as level.dat_corrupted with the date.
Why is part of my world new land?
The server couldn't read those chunks, so it made them again. Once it saves, the old ones are gone from the file; only a backup has them.
Does a full disk corrupt a Minecraft world?
Not in our test. Saves failed with No space left on device, and once there was room, the world started with everything in it.