Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The safest Linux backup is an unattended script that tells Minecraft to flush its data, archives every world to storage outside the live server, keeps several generations, and records failures. Schedule that script with either cron or a systemd timer. For online backups, use RCON when possible: it can acknowledge that save commands finished. Even with save coordination, player-event saves can create a timing mismatch, so a short maintenance window and a tested restore remain the strongest protection.

What the backup must do

A Minecraft world is more than the main world directory. A typical Java server may also have world_nether and world_the_end, plus player data inside those worlds. A useful backup job therefore needs to:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • run as the dedicated Minecraft account rather than root;
  • coordinate with the server console before copying files;
  • create a timestamped, integrity-preserving archive;
  • prevent overlapping runs;
  • delete old generations according to a stated retention policy;
  • write an exit status and useful diagnostics to a log; and
  • produce files that you have actually extracted and inspected.

The nicolaschan/minecraft-backup project is a practical reference for vanilla servers without plugins. Its documented inputs include world folders, tar or restic output, RCON, screen, tmux, Docker, cron scheduling, retention controls and restore by extraction. Its documentation states: “Recommendation: Use RCON if possible for the safest backups.”

Online backup sequence and its limits

Copying a live world without coordinating saves can capture files while they are being changed. An online job should execute these commands in order:

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
  1. save-off pauses automatic world saves.
  2. save-all flushes world and player data requested by the server.
  3. On Minecraft 1.16 and newer, save-all flush forces writes to disk. The reference script documents this command as harmless on older versions.
  4. Wait for completion. RCON can provide an acknowledgement; screen and tmux require a delay tuned to the server and world size.
  5. Archive each world directory.
  6. Run save-on in a cleanup trap so autosaving resumes even if archiving fails.

This procedure reduces risk but does not make an online copy perfectly transaction-consistent. The project documentation warns that player-event saves can continue after save-off, leaving player data and world data at slightly different points in time. For a high-value or heavily populated server, announce a short maintenance window, stop the server cleanly, copy the stopped world, and still test the resulting archive.

A Bash backup script

Place the following as /usr/local/sbin/minecraft-backup. Adjust the paths, world names, RCON endpoint and retention count for your installation. The example expects an mcrcon-compatible client and an environment variable named MCRCON_PASSWORD; do not put the password directly in a world-readable script.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#!/usr/bin/env bash
set -Eeuo pipefail

SERVER_ROOT='/srv/minecraft'
BACKUP_DIR='/mnt/minecraft-backups'
KEEP=24
RCON_HOST='127.0.0.1'
RCON_PORT='25575'
RCON_BIN='/usr/bin/mcrcon'
WORLDS=(world world_nether world_the_end)
STAMP=$(date -u '+%Y-%m-%dT%H-%M-%SZ')
ARCHIVE="$BACKUP_DIR/minecraft-$STAMP.tar.gz"
TEMP="$ARCHIVE.tmp"

exec 9>/run/lock/minecraft-backup.lock
flock -n 9 || { echo 'another backup is already running' >&2; exit 1; }

mkdir -p "$BACKUP_DIR"

mc() {
  "$RCON_BIN" -H "$RCON_HOST" -P "$RCON_PORT" -p "$MCRCON_PASSWORD" "$1"
}

cleanup() {
  status=$?
  set +e
  mc 'save-on' >/dev/null 2>&1
  rm -f -- "$TEMP"
  exit "$status"
}
trap cleanup EXIT

: "${MCRCON_PASSWORD:?set MCRCON_PASSWORD for the Minecraft account}"
mc 'save-off'
mc 'save-all'
if ! mc 'save-all flush'; then
  echo 'save-all flush was not accepted; continuing after save-all' >&2
fi

# RCON returns after the command response.  If your wrapper does not
# acknowledge completion, replace this with a measured sleep.
sleep 2

tar -C "$SERVER_ROOT" -czf "$TEMP" "${WORLDS[@]}"
mv -f -- "$TEMP" "$ARCHIVE"

if (( KEEP > 0 )); then
  mapfile -t old < <(find "$BACKUP_DIR" -maxdepth 1 -type f -name 'minecraft-*.tar.gz' -printf '%T@ %pn' | sort -nr | tail -n +$((KEEP + 1)) | cut -d' ' -f2-)
  ((${#old[@]})) && rm -f -- "${old[@]}"
fi

echo "created $ARCHIVE"

Make it executable and keep its configuration private:

sudo chown root:root /usr/local/sbin/minecraft-backup
sudo chmod 750 /usr/local/sbin/minecraft-backup
sudo install -d -o minecraft -g minecraft -m 750 /mnt/minecraft-backups

Run it manually as the same account that will run the scheduler:

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
sudo -u minecraft env MCRCON_PASSWORD='your-secret' /usr/local/sbin/minecraft-backup

For production, load the password from a root-readable environment file or a secret mechanism and make the service account able to write only the backup destination and its own lock and log locations. The temporary file is written first and renamed only after tar succeeds, so a failed archive does not look like a completed backup.

Scheduling with cron

Cron is simple and available on nearly every Linux distribution. The following entry runs at minute 17 of every hour:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
17 * * * * MCRCON_PASSWORD='your-secret' /usr/local/sbin/minecraft-backup >> /var/log/minecraft-backup.log 2>&1

Prefer a protected file for the secret instead of placing it in the crontab. Use absolute paths because cron has a minimal environment. Create the log with ownership and permissions that prevent unrelated users from reading command output or credentials. Check both the scheduler and the script’s exit code; a line in cron proves only that cron attempted to start the job.

Scheduling with a systemd timer

A systemd timer gives you dependency ordering, journal logging, a visible unit status and the Persistent=true behavior that runs a missed calendar event after the machine returns. Create /etc/systemd/system/minecraft-backup.service:

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
[Unit]
Description=Minecraft world backup
After=network-online.target

[Service]
Type=oneshot
User=minecraft
Group=minecraft
EnvironmentFile=/etc/minecraft-backup.env
ExecStart=/usr/local/sbin/minecraft-backup

Store MCRCON_PASSWORD=your-secret in /etc/minecraft-backup.env, owned by root and readable only by the service as appropriate for your distribution. Then create /etc/systemd/system/minecraft-backup.timer:

[Unit]
Description=Hourly Minecraft backup timer

[Timer]
OnCalendar=hourly
Persistent=true

[Install]
WantedBy=timers.target

Enable and test it:

sudo systemctl daemon-reload
sudo systemctl enable --now minecraft-backup.timer
systemctl list-timers minecraft-backup.timer
sudo systemctl start minecraft-backup.service
sudo journalctl -u minecraft-backup.service -n 100 --no-pager

MCscripts supplies Java and Bedrock backup services and timers, and ArchWiki references a minecraftd-backup.timer. Those examples illustrate the Linux-native pattern; use one scheduler for a given server rather than accidentally running cron and systemd copies at the same time.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Cron or systemd timer?

Decision point Cron systemd timer
Scheduling visibility Read the crontab and inspect the job's own log. systemctl list-timers shows the next and last run.
Dependency ordering Must be implemented inside the script or wrapper. Unit directives can order the backup after mounts, networking or the server service.
Logging Redirect output to a file or a mail facility. Standard output and errors are in the journal.
Missed-run behavior A missed time normally stays missed. Persistent=true can run a missed event after reboot.
Per-server templating Separate lines are easy for a few servers. Template units and instance-specific environment files scale better.

Choose cron for a small, familiar setup. Choose a systemd timer when you need mount dependencies, centralized logs, missed-run handling or many server instances.

RCON versus screen or tmux

Method Save-completion acknowledgement Setup complexity Consistency risk
RCON Can return the server's command response, allowing the script to wait for completion. Requires enabling RCON, protecting its password and installing a client. Lowest of these choices, but player-event saves can still occur.
screen No inherent completion signal; use a conservative, measured delay. Works when the server already runs in a named screen session. Higher if the delay is shorter than the save operation.
tmux No inherent completion signal; use a conservative, measured delay. Similar to screen, with a tmux session and target pane to maintain. Higher for large or busy worlds unless the delay is tuned.

If RCON is unavailable, send the commands through the existing screen or tmux session and choose a delay based on observed save times. Treat that delay as an operational assumption: recheck it after world growth, hardware changes or a Minecraft upgrade.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Retention that does not fill the disk

Keeping one file forever is not a backup policy; it is an eventual disk-full incident. The reference project supports thin, sequential and none deletion modes together with a maximum-backup setting. A practical policy keeps frequent short-term copies and fewer long-term copies, for example hourly generations for several days plus manually promoted weekly or monthly archives. The exact counts depend on world size and available capacity.

Do not delete solely by filename unless your naming convention is guaranteed to sort chronologically. Record how many generations are retained, alert when the destination reaches a capacity threshold, and verify that a failed run does not trigger deletion of the newest good archive. The example script deletes only files beyond KEEP after a new archive has been moved into place.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Where to store the archives

Write backups somewhere other than the live world disk. A separate partition on the same physical host protects against accidental file deletion but not disk failure, theft or a host-wide outage. An external USB HDD or SSD mounted at a stable path such as /mnt/minecraft-backups creates a separate device failure domain. MCscripts documents linking an external drive as its backup_dir.

Destination Failure-domain separation Restore bandwidth Privacy and ongoing cost
Same host, different directory Very low Fast Lowest cost, no isolation from host failure
External USB HDD or SSD Better protection from a host-disk failure Usually fast when attached locally One-time hardware cost; protect and encrypt the device if needed
Off-host storage Best protection from a local disaster Depends on upload and download bandwidth May incur recurring charges and requires credential and privacy controls

For important worlds, use at least two failure domains: a local copy for quick recovery and an off-host or physically separate copy for disasters. Mount the external destination before the timer runs and make the script fail loudly if the expected mount is absent; otherwise an archive could silently land on the host disk.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

How to prove a backup restores

A successful tar exit code proves that an archive was created, not that it represents a usable Minecraft world. Test each generation on a schedule:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Create a new restore directory that is not the production server directory.
  2. Extract the archive and inspect its top-level paths and timestamps.
  3. Start a disposable server instance with the restored files, or otherwise inspect the world with the same Minecraft version and required configuration.
  4. Check that the expected dimensions, player data and recent builds are present.
  5. Only after inspection should you replace production data.

For a tar archive, the extraction pattern is:

sudo install -d -o minecraft -g minecraft /srv/minecraft/restore-test
sudo tar -xzf /mnt/minecraft-backups/minecraft-YYYY-MM-DDTHH-MM-SSZ.tar.gz -C /srv/minecraft/restore-test
sudo find /srv/minecraft/restore-test -maxdepth 2 -type f | head

Do not extract over a running production world. For an actual rollback, stop the server cleanly, preserve the current directories under a dated name, extract the tested archive into a staging directory, set ownership back to the Minecraft account, and move the restored directories into place. Keep the pre-rollback copy until players confirm that the desired state is back.

Troubleshooting common failures

The archive contains only some worlds

Check the WORLDS array and confirm that each directory exists beneath SERVER_ROOT. A typo can cause tar to fail; do not suppress that error.

Autosaving stayed disabled

Verify that the cleanup trap is installed before save-off and that the script process was not forcibly killed. Connect to the console and issue save-on manually, then inspect the log for the original failure.

The job overlaps or consumes all CPU

Keep the flock guard, investigate archive duration and increase the interval if a large world cannot finish within one period. Never run concurrent archivers against the same live directories.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

RCON commands fail

Confirm that RCON is enabled on the configured port, that the password is available to the service account and that a local firewall is not blocking it. Run the command manually as minecraft; a root-only test can hide a permissions or environment problem.

The timer runs but no archive appears

Read journalctl -u minecraft-backup.service, verify the destination mount, and check free space and ownership. A systemd timer starts a service; it does not guarantee that the service completed successfully.

Operational checklist

  • Use one scheduler, not both cron and a timer.
  • Run as the dedicated Minecraft user with absolute paths.
  • Coordinate save-off, save-all, optional save-all flush, archive creation and trap-based save-on.
  • Prefer RCON when completion acknowledgement matters.
  • Keep several generations and monitor destination capacity.
  • Store at least one generation outside the live host disk.
  • Log every run and alert on non-zero exits.
  • Extract and inspect backups before trusting them for recovery.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.