---
title: "A Minecraft Server Backup Script You Can Actually… | ZCS"
description: "A tested backup script for Minecraft servers: safe saves, compression, retention and restore checks you can set up today on Linux."
url: "https://www.zcraftstudios.com/blog/minecraft-server-backup-script-guide"
updated: "2026-10-20T07:16:50.972429+00:00"
source: "ZCraft Studios"
---

> Site index for AI agents: https://www.zcraftstudios.com/llms.txt (full reference: https://www.zcraftstudios.com/llms-full.txt). Every page is available as Markdown by adding `.md` to its URL or sending `Accept: text/markdown`.

1. [Home](https://www.zcraftstudios.com/)
2. [Blog](https://www.zcraftstudios.com/blog)
3. A Minecraft Server Backup Script You Can Actually Set Up Today

[ All posts](https://www.zcraftstudios.com/blog)

# A Minecraft Server Backup Script You Can Actually Set Up Today

ZCraft StudiosOct 3, 2026Updated Oct 20, 2026

A tested backup script for Minecraft servers: safe saves, compression, retention and restore checks you can set up today on Linux.

## In this guide

- [What Actually Needs Backing Up](#what-actually-needs-backing-up)
- [A Basic Backup Script](#a-basic-backup-script)
- [Running It on a Schedule](#running-it-on-a-schedule)
- [Pausing Saves During the Copy (Optional, Safer)](#pausing-saves-during-the-copy-optional-safer)
- [Getting a Copy Offsite](#getting-a-copy-offsite)
- [Test the Restore, Not Just the Backup](#test-the-restore-not-just-the-backup)
- [What to check in a backup script](#what-to-check-in-a-backup-script)
- [Script review and recovery exercise](#script-review-and-recovery-exercise)
- [Official documentation and links](#official-documentation-and-links)
- [Add failure detection to the backup job](#add-failure-detection-to-the-backup-job)

## A Minecraft Server Backup Script You Can Actually Set Up Today

_Not the argument for why backups matter. Just the actual script and cron entry._

## What Actually Needs Backing Up

A backup that only grabs the world folder misses most of what it takes to actually recover a server:

- World folders (`world`, `world_nether`, `world_the_end`)
- `plugins/`: every plugin's config lives here, not just the jars
- `playerdata/` and any economy/permissions database files
- `server.properties` and any proxy config if running Velocity

## A Basic Backup Script

```
#!/bin/bash
SERVER_DIR="/home/mc/myserver"
BACKUP_DIR="/home/mc/backups"
DATE=$(date +%Y-%m-%d_%H-%M)

mkdir -p "$BACKUP_DIR"

tar -czf "$BACKUP_DIR/backup_$DATE.tar.gz" \
  -C "$SERVER_DIR" world world_nether world_the_end plugins server.properties

find "$BACKUP_DIR" -name "backup_*.tar.gz" -mtime +7 -delete
```

The last line deletes backups older than 7 days so the backup folder doesn't grow forever. Adjust the retention window to whatever's actually needed.

## Running It on a Schedule

Add it to cron to run automatically:

```
crontab -e
```

Then add a line for a daily 4 AM backup:

```
0 4 * * * /home/mc/backup.sh >> /home/mc/backup.log 2>&1
```

Running the backup during low-player hours avoids freezing the world mid-save for active players. `tar`\-ing a live world without pausing saves first can occasionally grab a file mid-write, which is why running it when the server is quiet matters more than almost anything else in this setup.

## Pausing Saves During the Copy (Optional, Safer)

For a cleaner backup, send `save-off` and `save-all` to the server console before copying, then `save-on` after:

```
screen -S mc -p 0 -X stuff "save-off$(printf \\\\r)"
screen -S mc -p 0 -X stuff "save-all$(printf \\\\r)"
sleep 10
# ... run the tar command here ...
screen -S mc -p 0 -X stuff "save-on$(printf \\\\r)"
```

This assumes the server is running inside a `screen` session named `mc`.

## Getting a Copy Offsite

A backup stored on the same machine as the server doesn't help if that machine fails entirely. `rclone` can sync the backup folder to cloud storage (Google Drive, S3, Backblaze, and others) with one more cron line:

```
rclone sync /home/mc/backups remote:minecraft-backups
```

## Test the Restore, Not Just the Backup

A backup that's never been restored is unverified. Periodically extract one into a throwaway folder and confirm the world actually loads. The first time a restore gets tested shouldn't be during an actual emergency.

## What to check in a backup script

A script that creates an archive is not enough: verify whether the server is writing to the world during the copy, whether archives have unique filenames, and whether failed uploads produce an error. Use your host's snapshot facility or an application-aware backup process where possible. Keep a copy off the server and perform a restore test in a separate directory. **Never delete the only known-good backup as part of automatic rotation.**

## Script review and recovery exercise

Before scheduling any automatic backup, verify which directories it copies, how filenames are generated, what happens when storage fills, and how errors are reported. A script must not silently continue as though a partial archive is valid.

### Test checklist

1. Create a known test change on a staging server.
2. Run the backup process and inspect the output archive.
3. Restore it into a separate directory.
4. Start the restored copy with compatible software.
5. Confirm the test change and essential plugin data are present.
6. Simulate a failed destination write and check that the script reports failure.

### Operational rules

Keep backup credentials outside publicly readable scripts, rotate logs separately, and maintain an off-site copy. Retention should preserve multiple known-good versions. A backup method that stops the server temporarily may be preferable to copying inconsistent files while the world is being written, depending on your hosting setup.

## Official documentation and links

- [Paper update and backup guidance](https://docs.papermc.io/paper/updating/)
- [A Minecraft Server Backup Strategy](https://www.zcraftstudios.com/blog/minecraft-server-backup-strategy)

## Add failure detection to the backup job

A scheduled task being triggered does not prove a recoverable archive was produced. Capture process exit codes, monitor the archive destination for fresh files, and check that storage usage remains within capacity. Periodically restore a copy in a separate test environment and verify player data.

Retain more than the newest backup: accidental deletion or corrupted data may remain unnoticed for several cycles. Store at least one copy outside the machine hosting the world.

## Continue reading

- [Minecraft Server Backup Strategy: What to Back Up](https://www.zcraftstudios.com/blog/minecraft-server-backup-strategy)
- [How Often Should You Update a Minecraft Server?](https://www.zcraftstudios.com/blog/minecraft-server-updates)
- [Can You Change a Minecraft Server Seed Without Losing Builds?](https://www.zcraftstudios.com/blog/minecraft-seed-existing-server-change)
- [Minecraft Can't Keep Up Warning: Causes and Fixes](https://www.zcraftstudios.com/blog/minecraft-server-cant-keep-up-warning-fix)

[ Previous guide Velocity Proxy Setup: Connect Multiple Minecraft Servers](https://www.zcraftstudios.com/blog/velocity-proxy-network-setup)[ Next guide WorldGuard and WorldEdit: The Basics That Protect a Server](https://www.zcraftstudios.com/blog/worldguard-worldedit-basics-setup)
