Incremental backups save changed data between backup runs, reducing the work needed for each new copy. This guide explains three Linux approaches: rsync snapshots, GNU tar incremental archives and scheduled rsnapshot backups.
Before you start
Choose one method and test recovery before using it for important data. Keep backups outside the source tree and retain a separate copy on another storage system. File copying alone does not provide a consistent backup of a running database.
The examples use /home/example/site/ as the source and /backup/ as a private backup location. Replace these paths, check permissions and free space, and use new destination names for each backup. ACLs, extended attributes and application-specific data may require additional options or separate backup procedures.
Method 1: rsync snapshots
A normal rsync copy is not automatically a history of backups. With --link-dest, a new snapshot can share unchanged files with an earlier snapshot using hard links. Both snapshot directories must be on the same filesystem for those links to work.
Create the first snapshot in a new, empty destination:
mkdir /backup/snapshot-001
rsync -a /home/example/site/ /backup/snapshot-001/For the next run, use another new destination and refer to the completed first snapshot:
mkdir /backup/snapshot-002
rsync -a --link-dest=/backup/snapshot-001 /home/example/site/ /backup/snapshot-002/Check each command’s result before considering the snapshot complete. For subsequent runs, use a new directory and link to the most recent successful snapshot.
Do not edit files inside a snapshot. Unchanged files may be hard-linked across snapshots, so editing one can alter another. Copy files out to a separate restore directory first.
To recover files from a selected snapshot, create an empty recovery directory and copy into it:
mkdir /home/example/recovery-test
rsync -a /backup/snapshot-002/ /home/example/recovery-test/Each successful snapshot presents a complete file tree. You do not apply earlier snapshots in sequence to restore it.
Method 2: GNU tar incremental archives
GNU tar uses a snapshot state file to decide what to include in the next archive. Start a new backup chain with a state filename that does not already exist:
tar --create --file=/backup/site-full.tar --listed-incremental=/backup/site.snar -C /home/example siteFor the next backup, preserve the existing state file first, then use it to create a new archive:
cp /backup/site.snar /backup/site-before-incremental-001.snar
tar --create --file=/backup/site-incremental-001.tar --listed-incremental=/backup/site.snar -C /home/example siteRetain the full archive and every required incremental archive in order. Use unique archive and state-copy names for later runs. If a run fails, investigate and recover the previous state before continuing the chain; do not assume the updated state represents a successful backup.
Restore the tar chain
Create an empty recovery directory and apply the full archive followed by each incremental archive in creation order:
mkdir /home/example/tar-recovery-test
tar --extract --listed-incremental=/dev/null --file=/backup/site-full.tar -C /home/example/tar-recovery-test
tar --extract --listed-incremental=/dev/null --file=/backup/site-incremental-001.tar -C /home/example/tar-recovery-testThe original .snar state file is needed to continue creating the chain, not to extract it. GNU tar reads the restoration metadata from the archives.
Incremental extraction can delete files to reproduce the backed-up directory’s state. Restore into a separate empty directory first, not directly over a live website.
Method 3: rsnapshot
rsnapshot manages a sequence of rsync snapshots and their retention. On a Debian or Ubuntu server where you have administrator access, install the distribution’s package:
sudo apt update
sudo apt install rsnapshotOn another distribution, use its supported package installation method.
Edit /etc/rsnapshot.conf, retaining the package’s required executable settings. The following example keeps seven daily snapshots; separate the configuration fields with actual tab characters:
snapshot_root /backup/rsnapshot/
retain daily 7
backup /home/example/site/ localhost/Check the configuration and review a dry run before taking the first snapshot:
sudo rsnapshot configtest
sudo rsnapshot -t daily
sudo rsnapshot dailyInspect the resulting snapshot and test copying a file into a separate recovery directory.
Schedule rsnapshot
After a successful manual test, confirm the installed executable’s path and edit the administrator’s crontab:
command -v rsnapshot
sudo crontab -eIf the path is /usr/bin/rsnapshot, this example runs the daily tier at 02:00 in cron’s configured timezone:
0 2 * * * /usr/bin/rsnapshot daily >> /var/log/rsnapshot-daily.log 2>&1Do not add a second schedule if the package already supplies one. Check the logs, storage usage and recovery tests regularly. Avoid overlapping runs and agree a retention policy before deleting old backups.