Save corruption is the failure that kills communities. Hardware failure is loud and recoverable; a corrupted world file is silent until players log in and find their bases gone. This article covers how game-server saves actually corrupt, why the usual backup plan fails to catch it, and the write pattern that keeps a rollback within seconds rather than hours.
The four corruption pathways
- Torn writes. The process writes a save file directly and the host loses power mid-write. Part of the file is new, part is old, and the checksum fails. Direct overwrite is the root cause; atomic writes fix it.
- Power-loss during fsync. Even a journaling filesystem can lose the last fsync’d block if the drive’s write cache lies about flushing. A UPS and a write-cache setting that respects FLUSH remove this class.
- Buggy game saves. Some titles write inconsistent state under high entity counts. The file is structurally valid but logically wrong, so no checksum catches it until players report missing structures.
- Backup overwriting the source. A backup script that rsyncs into the live directory, or snapshots after corruption has already occurred, propagates the damage across every retention tier.
Write atomically, always
The single highest-value change is to stop writing saves in place. Write to a temporary file on the same filesystem, fsync it, then rename over the original. Rename is atomic on POSIX filesystems, so a crash leaves either the complete old save or the complete new one — never a torn mix. Many game servers support a save-directory swap natively; for those that do not, wrap the save in a script that copies the produced files into a staging directory and swaps world to world.new atomically.
A 3-tier retention plan that survives corruption
| Tier | Frequency | Retention | Purpose |
|---|---|---|---|
| Hot snapshot | Every 15 min | Last 8 | Undo a bad save within the hour |
| Daily archive | Daily, off-box | 14 days | Recover from late-detected corruption |
| Weekly cold | Weekly | 8 weeks | Disaster and legal/rollback needs |
The critical detail is retention depth. Corruption caused by a game bug may not surface for days, by which time every hourly snapshot is already poisoned. Daily archives going back two weeks are what actually saves you. Keep at least one tier on a different physical host or object store so a single disk or host failure cannot take every copy.
Hardware choices that make corruption less likely
Software discipline covers most of the risk, but two hardware decisions shrink the blast radius. First, put the OS and the world on separate devices. If a failing drive takes the OS with it, recovery is a reinstall plus a restore; if only the world device is isolated, recovery is a single file copy. Second, use a filesystem and storage tier with real power-loss protection. Consumer SSDs without power-loss protection can lose buffered writes on an unclean shutdown even when the application called fsync correctly, which is a documented cause of apparently inexplicable save corruption on game hosts.
An uninterruptible power supply is not optional for a server that writes a persistent world. A 1,500 VA UPS gives a dedicated game server several minutes of runtime, enough to complete an in-flight save and shut down cleanly. Combined with a systemd shutdown hook that issues a final save before power loss, this closes the torn-write window almost entirely. The cost of a UPS is a fraction of the value of a community’s world, and it is the cheapest reliability upgrade available to a self-managed operator.
A short pre-flight checklist
- Atomic writes enabled or scripted (temp file + rename).
- Nightly restart at a fixed hour plus a save immediately before it.
- Three backup tiers, at least one off-box, deepest tier two weeks.
- UPS with a graceful shutdown hook that saves before powering off; pair it with dedicated hosting that gives you root access to configure the hook.
- Monthly restore drill onto a scratch instance.
- Checksums verified on every backup write and restore.
Verify, do not assume
- Checksum every backup on write and again on restore. Compare hashes, not file sizes.
- Run a monthly restore drill onto a scratch instance and confirm the world loads and players can join.
- Alert on backup jobs that finish suspiciously fast — an empty archive is a silent failure.
- After any corruption event, identify which tier was clean before rebuilding, and preserve the corrupt file for the game’s bug report.
Recovery order when the worst happens
Stop the server immediately to prevent further writes. Snapshot the current (corrupt) state for forensics. Walk backwards through your retention tiers testing each restore on a scratch instance until one loads cleanly. Announce a concrete rollback window to players rather than making them guess. Then patch the root cause — usually atomic writes or a restart cadence that avoids the game bug that produced the bad state. Reliable recovery depends on storage you control and can snapshot quickly, which is one practical reason operators keep game worlds on dedicated hardware rather than shared storage; see game server hosting with dedicated storage for snapshot-capable options.



Leave a Reply
You must be logged in to post a comment.