VPS Snaps

How to back up a Minecraft server

To back up a running Minecraft Java server, send save-off and save-all flush over RCON or the console, copy the server folder, then send save-on. The copy must include the world folder named by level-name in server.properties, plus server.properties, ops.json, the whitelist and ban lists, and your plugins or mods with their configs. Bedrock Dedicated Server uses save hold, save query and save resume instead, and either edition restores by stopping the server and putting the world folder back.

10 min readUpdated Checked against official documentation

What to back up on a Java server

A Minecraft: Java Edition server, whether Mojang's server.jar or a fork such as Paper, keeps everything in its working directory. This guide uses /opt/minecraft and runs commands as root. The world is the folder named by level-name in server.properties, world by default. Where the Nether and the End live depends on the server and its version:

ServerOverworldNetherEnd
Vanilla, Paper, Fabric or Forge, 26.1 and laterworld/dimensions/minecraft/overworldworld/dimensions/minecraft/the_netherworld/dimensions/minecraft/the_end
Vanilla, Fabric or Forge before 26.1worldworld/DIM-1world/DIM1
Paper before 26.1; Spigot, CraftBukkitworldworld_nether/DIM-1world_the_end/DIM1

Version 26.1, released in March 2026, is the first under Mojang's year-based version numbers. It moved every dimension under dimensions/ and player data under players/, and Paper adopted the same layout in its 26.1 builds. Paper's release notes warn that a world upgraded to 26.1 cannot be downgraded, so back up before every upgrade. Besides the world:

PathBack up?What it is
server.propertiesYesServer settings, including level-name and the RCON password
ops.json, whitelist.jsonYesOperators and the whitelist
banned-players.json, banned-ips.jsonYesBans
plugins/ or mods/YesPlugin or mod jars, with each plugin's config and data folder
config/, bukkit.yml, spigot.ymlYesPaper's paper-global.yml and paper-world-defaults.yml, Bukkit and Spigot settings, mod configs
server.jar and your start scriptYesRestoring onto the same version avoids surprises
logs/, cache/, libraries/, versions/NoLogs, Paper's cache, and the libraries and versioned jar that the server jar unpacks again at start

The simplest complete backup is the whole server folder minus logs, cache, libraries and versions. Then nothing a plugin or mod added gets left out.

Why a plain copy of a running world breaks

The server keeps chunks in memory and writes them to region files as it autosaves: r.<x>.<z>.mca files in region/, entities/ and poi/, each holding 32 by 32 chunks. A cp or tar that runs during a write captures half a file, and the restored world shows missing or regenerated chunks, or will not load. Three console commands prevent that:

  • save-off stops the server writing to the world files so they hold still while you copy. Changes queue in memory. Player, advancement and statistics files are still written. The setting resets when the server restarts.
  • save-all flush writes every player and chunk to disk at once, freezing the server for a moment, and it works while saving is off. Plain save-all only marks chunks to be saved over time, even with saving off, so they could be written in the middle of your copy.
  • save-on turns writing back on.

Never leave saving off. If a backup dies between save-off and save-on, the server keeps running without writing the world until it restarts, and a crash then loses everything since. The script below turns saving back on however it ends.

Send the commands over RCON

RCON lets a script run console commands over TCP. Make a password, set these keys in server.properties, and restart the server:

Terminal
openssl rand -hex 24
server.properties
enable-rcon=true
rcon.port=25575
rcon.password=<password>
broadcast-rcon-to-ops=false
  • With RCON enabled and rcon.password blank, RCON does not start at all. A hex password needs no escaping in this file, and the script below reads it from here.
  • rcon.port defaults to 25575. RCON is not encrypted, password included, so keep the port closed in your firewall and connect from the server itself.
  • broadcast-rcon-to-ops=false stops every backup from posting its command output to operators in game.

Any RCON client works. This guide uses mcrcon, a small open-source C client: build it from source as its README shows, which installs it in /usr/local/bin, or use your distribution's package if there is one. It reads the password from MCRCON_PASS. Test it:

Terminal
MCRCON_PASS='<password>' mcrcon -H 127.0.0.1 -P 25575 -c "save-all flush"

-c turns off colors. The reply ends with Saved the game. If the server runs in a tmux session rather than with RCON, a script can type into its console with tmux send-keys -t minecraft 'save-all flush' Enter, but send-keys does not return the reply, so you would have to watch logs/latest.log for Saved the game. RCON is easier to script.

A backup script with retention

This script turns saving off, flushes, copies the server folder to /var/backups/minecraft/latest with rsync, turns saving back on, and only then compresses the copy. Saving is off only while rsync runs, and dated archives are kept for 14 days:

/usr/local/bin/minecraft-backup.sh
#!/usr/bin/env bash
set -euo pipefail
umask 077
PATH=/usr/local/bin:/usr/bin:/bin

SERVER_DIR="/opt/minecraft"
BACKUP_DIR="/var/backups/minecraft"
LATEST="$BACKUP_DIR/latest"
KEEP_DAYS=14

export MCRCON_HOST=127.0.0.1 MCRCON_PORT=25575
MCRCON_PASS="$(sed -n 's/^rcon\.password=//p' "$SERVER_DIR/server.properties")"
export MCRCON_PASS

OUT="$BACKUP_DIR/minecraft-$(date +%Y-%m-%d_%H%M).tar.gz"
mkdir -p "$LATEST"
trap 'mcrcon -c save-on >/dev/null 2>&1 || true; rm -f "$OUT.partial"' EXIT

mcrcon -c save-off
reply="$(mcrcon -c "save-all flush")"
if [[ "$reply" != *"Saved the game"* ]]; then
  echo "save-all flush failed: $reply" >&2
  exit 1
fi

rc=0
rsync -a --delete --exclude='/logs/' --exclude='/cache/' \
  --exclude='/libraries/' --exclude='/versions/' \
  "$SERVER_DIR/" "$LATEST/" || rc=$?
if [ "$rc" -ne 0 ] && [ "$rc" -ne 24 ]; then
  exit "$rc"
fi
mcrcon -c save-on

tar -czf "$OUT.partial" -C "$LATEST" .
mv "$OUT.partial" "$OUT"
find "$BACKUP_DIR" -maxdepth 1 -name 'minecraft-*.tar.gz' -type f -mtime +"$KEEP_DAYS" -delete
Terminal
chmod 700 /usr/local/bin/minecraft-backup.sh
/etc/cron.d/minecraft-backup
30 4 * * * root /usr/local/bin/minecraft-backup.sh >> /var/log/minecraft-backup.log 2>&1
  • PATH adds /usr/local/bin, where mcrcon installs; cron's own PATH leaves it out.
  • The password comes from server.properties and travels in MCRCON_PASS, so it never shows in the process list.
  • The script stops unless the flush reply contains Saved the game. The trap sends save-on however the script ends; after a successful run that second save-on only answers Saving is already turned on.
  • rsync copies only files that changed since the last run, which keeps saving off for as short a time as possible. Its exit code 24 means a file vanished mid-copy, which plugins' temporary files do; any other error stops the script.
  • The patterns start with /, so only the top-level logs, cache, libraries and versions folders are skipped.

Check an archive by listing a file that must be in it; tar exits with an error if it is missing. On a pre-26.1 Bukkit-style server, check world_nether as well:

Terminal
tar -tzf /var/backups/minecraft/minecraft-2026-10-04_0430.tar.gz ./world/level.dat

Plugins that keep their own SQLite or MySQL database keep writing while saving is off. Copy those with SQLite's backup API or mysqldump. And copy the archives off the machine, for example with rclone: a backup on the same disk dies with it.

Docker: the itzg/minecraft-server image

The widely used itzg/minecraft-server image turns RCON on by default with a random password, and bundles rcon-cli, so the commands work through docker exec (here the container is named mc):

Terminal
docker exec mc rcon-cli save-all flush

The same project publishes itzg/mc-backup, a separate sidecar container. It mounts the server's /data read-only, pauses and flushes saving over RCON around each run, and writes .tgz archives to its /backups volume: every 24 hours by default (BACKUP_INTERVAL), deleting archives older than 7 days (PRUNE_BACKUPS_DAYS). Its README mounts a host folder at /backups so the archives can be copied off the machine. It does not support Bedrock.

Bedrock Dedicated Server

Mojang's Bedrock Dedicated Server keeps each world in worlds/<level-name>/ (Bedrock level by default): a LevelDB database in db/, plus level.dat and levelname.txt. Back up worlds/ with server.properties, allowlist.json and permissions.json. BDS has no RCON; commands go to its console, for example in tmux. The simplest consistent copy is a short stop: send stop, copy, start the server again. To copy while it runs, use the save command:

  1. save hold asks the server to prepare a backup. It returns at once.
  2. save query, repeated until it answers Data saved. Files are now ready to be copied. Until then it says A previous save has not been completed. The ready reply lists every file to copy as path:length, with paths relative to worlds/.
  3. Copy exactly those files, then cut each copy to its listed length. The server keeps writing during the copy; the length marks where the consistent snapshot ends.
  4. save resume lets the server remove old files again.
Terminal
truncate -s 2097152 "/var/backups/bedrock/Bedrock level/db/000005.ldb"

The guide that ships with the server, bedrock_server_how_to.html, says the backup is valid as long as you copy only the listed files and truncate each copy to the listed length. A plain copy of db/ while the server runs has no such assurance.

Restore a world

Restore onto the same server version or a newer one, and stop the server first: a running server writes its in-memory chunks over whatever you put back. With the server stopped (stop in the console, or systemctl stop on your unit), move the damaged world aside and unpack the backup's copy:

Terminal
mv /opt/minecraft/world /opt/minecraft/world.broken
Terminal
tar -xzf /var/backups/minecraft/minecraft-2026-10-04_0430.tar.gz -C /opt/minecraft ./world

Run as root, tar restores the original owners. On Bukkit-style layouts restore ./world_nether and ./world_the_end the same way. Check that level-name in server.properties matches the folder's name: if it names a folder that does not exist, the server generates a new world there. Then start the server.

To repair one damaged area instead, restore just its region file. A chunk is 16 by 16 blocks and a region 32 by 32 chunks, so for block X=1000, Z=-300: divide by 16 and round down for the chunk (62, -19), then divide by 32 and round down for the region (1, -1). The file is r.1.-1.mca. With the server stopped:

Terminal
tar -xzf /var/backups/minecraft/minecraft-2026-10-04_0430.tar.gz -C /opt/minecraft ./world/dimensions/minecraft/overworld/region/r.1.-1.mca

Restore the files of the same name in entities/ and poi/ too, when the backup has them. Everything built in that region since the backup is lost; the rest of the world is untouched.

To test a backup without touching the live server, unpack it into another folder or onto another machine, set a free server-port in its server.properties and turn enable-rcon off, start the jar with --nogui, join and look around. Testing restores covers turning that into a routine.

Common problems

ProblemFix
Chunks missing, rolled back or regenerated after a restoreThe world was copied while the server was writing it. Restore an archive made with save-off and save-all flush, or replace just the damaged region files.
A log line starting Failed to save chunkThe server could not write a chunk to its region file. Check free disk space, and that the server's user owns the world folder; files restored by hand can end up owned by root.
Unable to save the game (is there enough disk space?)save-all failed. The disk is full or the world folder is not writable.
Saving is already turned offAn earlier backup never sent save-on, so the world has not been written since. Send save-on now.
Connection failed. from mcrconRCON is off, on another port, or the server has not restarted since you changed server.properties. A blank rcon.password also keeps RCON from starting.
Authentication failed! from mcrconThe password does not match rcon.password.
A new, empty world after restoringlevel-name does not match the restored folder's name.
Nether and End look reset after switching between vanilla and PaperBefore 26.1 the two store them in different folders. Nothing is lost: move DIM-1 and DIM1 as Paper's migration guide describes.

Frequently asked questions

Can I back up a Minecraft server while it is running?
Yes. Send save-off and save-all flush, copy the files, then send save-on. Without those commands a copy can catch region files halfway through a write.
Where is the world saved on a Minecraft server?
In the server's folder, in the directory named by level-name in server.properties, world by default. Since 26.1 the Nether and End sit inside it under dimensions/minecraft; older Paper, Spigot and CraftBukkit servers keep them in world_nether and world_the_end.
What is the difference between save-all and save-all flush?
save-all saves players at once and marks chunks to be saved over time. save-all flush writes everything to disk immediately, which is what a backup needs.
How do I back up a Bedrock server?
Stop it and copy the worlds folder with server.properties, allowlist.json and permissions.json. Or, while it runs, use save hold, save query and save resume, copying only the listed files and truncating each copy to its listed length.
How do I restore a Minecraft world from a backup?
Stop the server, move the current world folder aside, put the backup's world folder in its place under the name level-name gives, and start the server again.

How this was checked

Commands, limits and prices were checked against these official pages, on October 4, 2026: