Operations 6 min read

Master Incremental Backups on Linux with rsync, tar, and Cron

This guide explains why incremental backups are crucial for data safety and walks through step‑by‑step Linux commands using rsync, tar + find, cron scheduling, and popular tools like Duplicity and BorgBackup, plus monitoring and logging techniques.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Incremental Backups on Linux with rsync, tar, and Cron

Using rsync for Incremental Backup

rsync is a powerful file‑synchronization utility that can also perform incremental backups by copying only changed files.

1. Full backup

rsync -av /source-directory /backup-directory
/source-directory

is the directory to back up, and /backup-directory is the destination where a complete copy is stored.

2. Incremental backup

rsync -av --delete --link-dest=/backup-directory /source-directory /new-backup-directory

The --link-dest option points to the previous backup ( /backup-directory) so that only new or modified files are copied to /new-backup-directory. The --delete flag removes files that were deleted from the source.

Using tar and find for Incremental Backup

1. Full backup

tar -czvf /backup-directory/full_backup_$(date +%Y%m%d).tar.gz /source-directory

This creates a compressed archive named with the current date.

2. Incremental backup

find /source-directory -type f -newer /backup-directory/last_backup_date_marker -exec tar -czvf /backup-directory/incremental_backup_$(date +%Y%m%d).tar.gz {} \;

The file /backup-directory/last_backup_date_marker records the timestamp of the previous backup; only files newer than this marker are archived.

Automating Backup Tasks

Schedule regular backups with cron. The example below runs the rsync incremental backup every night at 02:00.

0 2 * * * /usr/bin/rsync -av --delete --link-dest=/backup-directory /source-directory /new-backup-directory

Backup Tools

1. Duplicity

Duplicity supports encrypted incremental backups to local or remote storage.

duplicity /source-directory file:///backup-directory

2. BorgBackup

BorgBackup provides compression, encryption, and repository management for automated incremental backups.

borg create /backup-directory::'$(date +%Y%m%d-%H%M%S)' /source-directory

Monitoring and Logging

Capture backup output to a log file for later inspection.

rsync -av --delete --link-dest=/backup-directory /source-directory /new-backup-directory >> /var/log/backup.log 2>&1

Conclusion

Incremental backup is a key practice for ensuring data integrity and quick recovery. By leveraging tools such as rsync, tar, Duplicity, and BorgBackup, and by automating tasks with cron and logging output, administrators can build reliable, automated backup pipelines on Linux.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxcronrsyncincrementaltar
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.