Game worlds are irreplaceable. Losing a player's progress is unacceptable, so regular backups are essential. This guide covers manual backups, automated backup scripts, and step-by-step restoration.
Understanding Game Server Backups
Most game servers store worlds and player data in files or directories on disk. Before backing up, stop the server to avoid corrupted files mid-write. After restoration, you're back to that point in time.
Common backup locations:
- Minecraft: world/, world_nether/, world_the_end/
- RUST: server/cfg/, server/saves/
- Valheim: ~/.config/unity3d/IronGate/Valheim/
- ARK: ShooterGame/Saved/SavedArks/
Check your specific game's documentation for the exact paths.
Step 1: Perform a Manual Backup
Stop your game server:
sudo systemctl stop gameserver
Create a backup directory:
sudo mkdir -p /backups/gameserver
Compress and archive the world directory. For Minecraft on an Ubuntu server:
sudo tar -czf /backups/gameserver/minecraft-world-$(date +%Y-%m-%d_%H-%M-%S).tar.gz /opt/gameserver/world/
This creates a timestamped backup file like minecraft-world-2026-07-02_14-30-45.tar.gz.
If you're backing up multiple directories (e.g., Minecraft's three worlds):
sudo tar -czf /backups/gameserver/minecraft-full-$(date +%Y-%m-%d_%H-%M-%S).tar.gz \
/opt/gameserver/world/ \
/opt/gameserver/world_nether/ \
/opt/gameserver/world_the_end/
Check the backup was created:
ls -lh /backups/gameserver/
Start the server again:
sudo systemctl start gameserver
Step 2: Automate Backups with a Cron Job
Create a backup script to run daily (or as often as you need). Edit your crontab:
sudo nano /usr/local/bin/backup-gameserver.sh
Paste this script (modify paths for your game):
#!/bin/bash
# Configuration
GAME_DIR="/opt/gameserver"
BACKUP_DIR="/backups/gameserver"
KEEP_BACKUPS=7 # Keep the last 7 days of backups
SYSTEMD_SERVICE="gameserver"
# Create backup directory if it doesn't exist
mkdir -p "$BACKUP_DIR"
# Stop the server
systemctl stop "$SYSTEMD_SERVICE"
# Wait a moment for the server to fully shut down
sleep 5
# Create the backup
BACKUP_FILE="$BACKUP_DIR/backup-$(date +%Y-%m-%d_%H-%M-%S).tar.gz"
tar -czf "$BACKUP_FILE" -C "$GAME_DIR" . 2>/dev/null
# Check if backup succeeded
if [ $? -eq 0 ]; then
echo "Backup succeeded: $BACKUP_FILE" >> /var/log/gameserver-backup.log
else
echo "Backup failed at $(date)" >> /var/log/gameserver-backup.log
fi
# Start the server
systemctl start "$SYSTEMD_SERVICE"
# Delete backups older than KEEP_BACKUPS days
find "$BACKUP_DIR" -name "backup-*.tar.gz" -mtime +$KEEP_BACKUPS -delete
Make the script executable:
sudo chmod +x /usr/local/bin/backup-gameserver.sh
Schedule it to run daily at 3 AM (Sydney time). Edit the system crontab:
sudo nano /etc/cron.d/gameserver-backup
Paste:
0 3 * * * root /usr/local/bin/backup-gameserver.sh
Verify the cron job is saved:
sudo cat /etc/cron.d/gameserver-backup
The script will now automatically back up your server every day at 3 AM and keep the last 7 days of backups, deleting older ones.
Step 3: Store Backups Offsite (Recommended)
Keep a copy on a remote server or cloud storage. Using rsync to sync backups to another machine:
sudo rsync -avz /backups/gameserver/ youruser@backup-server:/backups/gameserver/
Or upload to cloud storage. For example, with aws s3 sync (if you have an AWS S3 bucket):
aws s3 sync /backups/gameserver/ s3://your-bucket-name/gameserver-backups/
Step 4: Restore from a Backup
If the world is corrupted or you need to roll back, restore from a backup.
List available backups:
ls -lh /backups/gameserver/
Stop the server:
sudo systemctl stop gameserver
Backup the current (corrupted) world as a safeguard:
sudo tar -czf /backups/gameserver/corrupted-backup-$(date +%Y-%m-%d_%H-%M-%S).tar.gz /opt/gameserver/world/
Remove the corrupted world:
sudo rm -rf /opt/gameserver/world/
Extract the backup. For example, to restore from backup-2026-07-01_03-00-00.tar.gz:
sudo tar -xzf /backups/gameserver/backup-2026-07-01_03-00-00.tar.gz -C /opt/gameserver/
Verify the world files are in place:
ls -la /opt/gameserver/world/
Start the server:
sudo systemctl start gameserver
Check that the server came up cleanly:
sudo systemctl status gameserver
sudo journalctl -u gameserver -n 20
Verify Backup Integrity
Periodically test that your backups can actually be extracted. Pick a backup and test it without restoring:
sudo tar -tzf /backups/gameserver/backup-2026-07-01_03-00-00.tar.gz | head -20
If the command succeeds and lists files, your backup is intact. If it fails, the backup is corrupt and should be re-done.
Troubleshooting
Backup fails or hangs? Check that the server stopped cleanly before backing up. Increase the sleep 5 value in the script if needed.
Not enough disk space? Reduce KEEP_BACKUPS in the cron script, or move old backups to external storage manually:
sudo mv /backups/gameserver/backup-*.tar.gz /mnt/external-drive/
Can't remember which backup to restore from? Use the file timestamps:
ls -lh --full-time /backups/gameserver/ | grep "2026-07-01"
This shows all backups from July 1st, so you can pick the one closest to when the world was last in good condition.