How to recover server files after a power loss

Here I am putting a thread on how to handle fixing a server that has been forced stoped after a power loss. This unfortunate event happend to me and I want anyone else who had this issue to find an easy solution.

World will not load

If you get an error / crash simular to this one :

---- Minecraft Crash Report ----
// Quite honestly, I wouldn't worry myself about that.

Time: 7/6/15 12:13 AM
Description: Exception in server tick loop

java.io.EOFException
    at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:268)
    at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:258)
    at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:164)
    at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:79)
    at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:91)
    at net.minecraft.nbt.CompressedStreamTools.func_74796_a(CompressedStreamTools.java:27)
    at net.minecraft.world.storage.SaveHandler.loadSpongeDatData(SaveHandler.java:94)
    at net.minecraft.world.storage.SaveHandler.onLoadWorldInfoBeforeReturn1(SaveHandler.java:90)
    at net.minecraft.world.storage.SaveHandler.func_75757_d(SaveHandler.java:143)
    at net.minecraft.server.MinecraftServer.func_71247_a(MinecraftServer.java:328)
    at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:259)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438)
    at java.lang.Thread.run(Thread.java:745)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
    Minecraft Version: 1.8
    Operating System: Linux (amd64) version 4.0.7-2-ARCH
    Java Version: 1.8.0_45, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 1346298096 bytes (1283 MB) / 1711800320 bytes (1632 MB) up to 3817865216 bytes (3641 MB)
    JVM Flags: 2 total; -Xms1G -Xmx4G
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1446 4 mods loaded, 4 mods active
    mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initia$
    FML{8.0.99.99} [Forge Mod Loader] (forge-1.8-11.14.3.1446.jar) Unloaded->Constructed->Pre-initi$
    Forge{11.14.3.1446} [Minecraft Forge] (forge-1.8-11.14.3.1446.jar) Unloaded->Constructed->Pre-i$
    Sponge{1.8-1446-2.1DEV-514} [SpongePowered Sponge] (minecraft.jar) Unloaded->Constructed->Pre-i$
    Loaded coremods (and transformers):
    
SpongeCoremod (unknown)

    Profiler Position: N/A (disabled)
    Player Count: 0 / 20; []
    Is Modded: Definitely; Server brand changed to 'fml,forge'
    Type: Dedicated Server (map_server.txt)

Then this means that the level_sponge.dat & level_sponge.dat_old files have been corupted and to fix, as a last resourt you must remove these files from “world/”, “world/DIM1”, and “world/DIM-1”. Alternatively, you could just remove the files from their proper directory. After that the World should load. This event shouldn’t occur if you keep proper server backups like you should <3.

#Other Issues
If you have a different solution or a different problem, put your comment down below and I will add it here so it can be seen as a reference

Different and refference :wink:

This will come in handy for people that don’t (want to) understand error codes (most non developer people)

Actually it’s reference :wink:

1 Like

Hahah I fixed the gramatical / spelling errors you guys brought up. Thank you. :blush:

Great idea to collect such problems! :smile:

1 Like

I think I remember a program out there that helped restore worlds to a previous state, though I don’t really remember the name of it. Regardless, the best way to combat this problem is to preemptively back up your worlds consistently to make sure you have a recent clean copy when this happens.

This is true. And a program of that sort would be super simple. for example in bash:

#!/bin/bash
cd world
rm level_sponge.dat && rm level_sponge.dat_old
rm DIM1/level_sponge.dat && rm DIM1/level_sponge.dat_old
rm DIM-1/level_sponge.dat && rm DIM-1/level_sponge.dat_old
echo "Now lets get back to Minecraft!"

Bear in mind these files actually contain data that is important and should only be deleted in exceptional circumstances where there’s no other option. It contains information about the world like the name, UUID, populators, whether it’s enabled, and more.

Absoulutly, this is a “Last Resort” type of situation, because if that is a spawn you spent $400 or just months of time on, it’t worth the loss of data vs the loss of the world. Technically the data was lost anyways since you could not load it.

oops I know, made a typo myself :angel:

1 Like

Indeed, and that’s why you always make backups :stuck_out_tongue:

That smiley face looks insane :scream: :dolphin:

I actually think this could be handled better by the minecraft server itself.

The server could save 2 copies of the world/region/chunk and swap between them. If a powerloss occurs your world may be out of sync causing entity duplication or removal, or being in an inconsistent state, but at the very least it wouldn’t be corrupted.

1 Like

… then you should’ve made a backup :wink:

2 Likes

I agree. :stuck_out_tongue_closed_eyes: