From Tim's website
Jump to: navigation, search

Backup to archive partition

Making a copy of the filesystem every night is useful when users accidentally delete a file, or want to go back to yesterday's version. Mirroring the disk partition to another partition of the same size is a convenient method, and allows the archive partition to be mounted read-only during the day. The archive partition can also be read off to an external backup without needing to read the live file system. The disadvantage is that the archive partition requires the same disk space as the partition being mirrored. This script can be run as a cron job to sync the active partition (/) with the archive partition (/archive).


echo Daily Disk Mirror starting at `date`

cd /
mount -o remount,rw /archive
rsync --stats -a --delete -H -x / /archive
mount -o remount,ro /archive

echo Daily Disk Mirror FINISH at `date`

# Dump the mirrored image to tape and eject tape if successful
amdump archive && mt -f /dev/st0 rewoffl