Incremental backups copy only files changed since the last backup, saving time and storage space. This guide covers three reliable methods using standard Linux tools: rsync, tar, and rsnapshot, plus automation with cron and restoration steps.
What Are Incremental Backups?
- Incremental: Copies only files changed since the last backup (fastest, most space-efficient).
- Full: Copies all files every time (complete protection, but slow and storage-heavy).
- Differential: Copies files changed since the last full backup (moderate storage, balanced speed).
Method 1: Using rsync (Recommended for Most Users)
rsync uses hard links to avoid duplicating unchanged files, making it ideal for space-efficient backups.
Example Command:
```bash rsync -av --delete --link-dest=/backup/previous /home/user/ /backup/current/
Explanation
-a: Archive mode (preserves permissions, symlinks, timestamps).
-v: Verbose output.
–delete: Removes files in the destination that no longer exist in the source.
–link-dest: Hard-links unchanged files from a previous backup directory.
Automation Script (Optional)
To rotate backups automatically, create a script:
#!/bin/bash BACKUP_ROOT=“/backup” CURRENT=“$BACKUP_ROOT/current” PREVIOUS=“$BACKUP_ROOT/previous” DAY1=“$BACKUP_ROOT/day1” # Rotate: day1 ? day2 ? day3 ? ... (keep last 7) mv “$DAY1” “$BACKUP_ROOT/day2” 2>/dev/null mv “$BACKUP_ROOT/day2” “$BACKUP_ROOT/day3” 2>/dev/null # ... add more as needed # Move current to previous mv “$CURRENT” “$PREVIOUS” 2>/dev/null # Run backup rsync -av --delete --link-dest=“$PREVIOUS” /home/user/ “$CURRENT” Save as /usr/local/bin/backup-rsync.sh, make executable: chmod +x /usr/local/bin/backup-rsync.sh
Method 2: Using tar (For Simple Full + Incremental Archives)
tar can do incremental backups using a snapshot file to track changes.
First (Full) Backup
tar --create --file=backup-full.tar --listed-incremental=snapshot.file /home/user/
Next (Incremental) Backup
tar --create --file=backup-incremental.tar --listed-incremental=snapshot.file /home/user/
The snapshot.file records which files have changed since the last run.
Important Notes:
Do not lose the snapshot.file, it’s required to restore incrementals.
tar does not use hard links; each incremental archive contains full copies of changed files.
Restore requires applying all incrementals in order (full > incremental1 > incremental2…).
Method 3: Using rsnapshot (Automated, Easy Setup)
rsnapshot is a wrapper around rsync that automates rotation, hard-linking, and scheduling.
Install
sudo apt install rsnapshot –y
Configure
Edit /etc/rsnapshot.conf: snapshot_root /backup/ interval daily 7 interval weekly 4 backup /home/ localhost/
Adjust paths and intervals as needed. Use tabs (not spaces) for indentation.
Run Backup
sudo rsnapshot daily
Creates directories like /backup/daily.0/, /backup/daily.1/, etc., with hard-linked unchanged files.
Automating Backups with cron
Schedule backups to run automatically.
Example: Daily rsync Backup at 2:00 AM
0 2 * * * /usr/local/bin/backup-rsync.sh >> /var/log/backup.log 2>&1
Edit Cron Jobs
crontab –e
Add the line above, save, and exit.
Restoring Data
From rsync Backups
Restore the full backup first
tar --extract --file=backup-full.tar -C /home/user/
Then apply each incrementally in order
tar --extract --file=backup-incremental.tar -C /home/user/
Must restore in sequence: full > incremental1 > incremental2…
Best Practices:
- Test restores regularly; backups are useless if you can’t recover.
- Store backups offsite or on separate drives to protect against hardware failure.
- Use borg or restic for modern, encrypted, deduplicated backups (optional advanced tools).
- Log backups; add >> /var/log/backup.log 2>&1 to cron jobs.
- Monitor disk space, especially with rsync/rsnapshot; hard links can be misleading.
Incremental backups are efficient, fast, and essential for Linux systems. Whether you choose rsync for control, tar for simplicity, or rsnapshot for automation, you will save storage and time while keeping your data safe.
Pro Tip: Combine rsnapshot with cron for zero-maintenance, space-efficient backups.
Want to store your backups securely? Learn How can I set up FTP storage in Plesk