Skip to main content

Sponsors

Incremental Backup using Tar

Posted in
# Backup a .tgz
$ tar zcvf backup.tgz backup/
backup/
backup/main.c
backup/main.f90

# Update files.
$ touch backup/main.c

# Incremental backup.
# 2 options:
# Option 1: Backup only files newer than the specified date and time.
$ tar --newer-mtime "20060210 10:22:00" -zcvf backup-inc1.tgz backup
tar: Treating date `20060210 10:22:00' as 2006-02-10 10:22:00 + 0 nanoseconds
backup/
backup/main.c
tar: backup/main.f90: file is unchanged; not dumped

# Option 2: Backup only files newer than backup.tgz.
$ tar --newer-mtime ./backup.tgz -zcvf backup-inc1.tgz backup
backup/
backup/main.c
tar: backup/main.f90: file is unchanged; not dumped

# Restore backups.
$ tar zxvf backup.tgz
backup/
backup/main.c
backup/main.f90

$ tar zxvf backup-inc1.tgz
backup/
backup/main.c

However, these do not handle folders that have been removed.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.