Tudásbázis

Backing up your server with rsync Nyomtatás

  • rsync, backup, storage-box, ssh
  • 0

Overview

rsync copies files efficiently by transferring only the differences since the last run, which makes it ideal for recurring server backups. This article shows how to back up a CPU Pod to an ALYPOD Storage Box over SSH, including a first run and incremental updates.

Before you begin

  • A CPU Pod running any Linux distribution (root or sudo access).
  • An ALYPOD Storage Box with its hostname, username and password.
  • rsync installed on the Pod.

Steps

  1. Install rsync:

```bash

Debian / Ubuntu

sudo apt update && sudo apt install -y rsync

RHEL / AlmaLinux / Rocky

sudo dnf install -y rsync ```

  1. Run a first full backup into a dated folder. The -a preserves permissions and timestamps, -z compresses, and --delete mirrors deletions:

bash rsync -avz --delete \ -e "ssh -p 22" \ /var/www /etc /home \ [email protected]:/backup/server1/

  1. For speed and repeatability, use rsync over SSH with a key instead of a password:

bash ssh-keygen -t ed25519 -N "" -f ~/.ssh/alypod_backup ssh-copy-id -i ~/.ssh/alypod_backup.pub [email protected]

Note: Storage Box SSH keys are registered from its settings page in the Console if ssh-copy-id is not available.

  1. Exclude volatile paths you do not need (caches, sockets, temporary data):

bash rsync -avz --delete \ --exclude '*/cache/*' --exclude '*.sock' --exclude '/proc' --exclude '/sys' \ / [email protected]:/backup/server1/

  1. For versioned backups, use --link-dest to hard-link against yesterday's copy so only changed files consume space:

bash rsync -avz --delete --link-dest=../2026-10-06 \ /var/www /backup/2026-10-07/

  1. Verify the result and check free space:

bash ssh [email protected] "du -sh /backup/server1"

Troubleshooting

  • Problem: rsync: command not found on the remote. Solution: Use --rsync-path=rsync or rely on SFTP mode with -e ssh; Storage Boxes expose rsync directly.
  • Problem: Slow first transfer. Solution: Run with --compress and consider an initial copy locally, then sync deltas.
  • Problem: Backup overwrote live files accidentally. Solution: Always double-check source/target order — the source comes first, destination last. Use -n (--dry-run) before the first real run.

Related articles

  • [Scheduling automatic backups with cron]
  • [Restoring data from a backup]
  • [Connecting to a Storage Box over SFTP and SSHFS]

Hasznosnak találta ezt a választ?

« Vissza