Trang

14 thg 10, 2009

Incremental Backup using Tar


# 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.

Không có nhận xét nào:

Đăng nhận xét