Date: Tue, 23 Aug 2005 11:35:35 -0700 (PDT) From: Philip Hallstrom <freebsd@philip.pjkh.com> To: Danny Howard <dannyman@toldme.com> Cc: Ilari Laitinen <ilari.laitinen@iki.fi>, questions@freebsd.org Subject: Re: dump(8), incremental backups, Tower of Hanoi sequence, don't get it Message-ID: <20050823112716.U26292@wolf.pjkh.com> In-Reply-To: <20050823182133.GF51748@ratchet.nebcorp.com> References: <20050819141535.GA62513@lohi.local> <20050823182133.GF51748@ratchet.nebcorp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> 2) If all you have to deal with are static files and a > not-super-giant-filesystem, use rsync. rsync -avz --delete once a night > will "mirror" your data between drives or between machines without any > trouble. The only disadvantage is there is no file retention if you > want to restore a corrupt / deleted file after the fact. Actually there is... sort of... The trick is to use the --backup and --backup-dir options: -b, --backup With this option, preexisting destination files are renamed as each file is transferred or deleted. You can control where the backup file goes and what (if any) suffix gets appended using the --backup-dir and --suffix options. --backup-dir=DIR In combination with the --backup option, this tells rsync to store all backups in the specified directory. This is very use- ful for incremental backups. You can additionally specify a backup suffix using the --suffix option (otherwise the files backed up in the specified directory will keep their original filenames). I use this to maintain a one day full archive and a two week archive of "dailys". --------------------------------------------------------------------------- # # manage daily directory cleanup # rm -rf $dailysDir-old if [ -d $dailysDir ]; then mv $dailysDir $dailysDir-old fi # # rsync command # rsync="rsync" rsync="$rsync --archive" # archive mode, equivalent to -rlptgoD rsync="$rsync --delete" # delete files that don't exist on sender rsync="$rsync --delete-after" # delete after transferring, not before rsync="$rsync --delete-excluded" # also delete excluded files on receiver rsync="$rsync --devices" # preserve devices (root only) rsync="$rsync --group" # preserve group rsync="$rsync --links" # copy symlinks as symlinks rsync="$rsync --owner" # preserve owner (root only) rsync="$rsync --perms" # preserve permissions rsync="$rsync --recursive" # recurse into directories rsync="$rsync --relative" # use relative path names rsync="$rsync --safe-links" # ignore links outside the destination tree rsync="$rsync --sparse" # handle sparse files efficiently rsync="$rsync --stats" # give some file transfer stats rsync="$rsync --times" # preserve times rsync="$rsync --whole-file" # copy whole files, no incremental checks $rsync \ --compress \ --files-from=files/bravo.files \ --exclude-from=files/bravo.exclude \ --backup --backup-dir $dailysDir/bravo \ bravo.mydomain.com:/ $backupDir/bravo $rsync \ --compress \ --files-from=files/foxtrot.files \ --exclude-from=files/foxtrot.exclude \ --backup --backup-dir $dailysDir/foxtrot \ foxtrot.mydomain.com:/ $backupDir/foxtrot --------------------------------------------------------------------------- files/bravo.files looks like this: /etc /local/home /root /usr/local/etc /var/cron /fs and files/bravo.exclude looks like this: /fs/tmp/ /fs/software/ This gives me a backup directory that looks like this: root@charlie:/backups % ll data drwxr-xr-x 8 root wheel 512 Mar 19 2004 bravo/ drwxr-xr-x 7 root wheel 512 Oct 12 2004 foxtrot/ root@charlie:/backups % ll dailys/ drwx------ 7 root wheel 512 Aug 19 03:37 Fri/ drwx------ 7 root wheel 512 Aug 12 03:43 Fri-old/ drwx------ 7 root wheel 512 Aug 22 03:37 Mon/ drwx------ 6 root wheel 512 Aug 15 03:37 Mon-old/ drwx------ 7 root wheel 512 Aug 20 03:36 Sat/ drwx------ 7 root wheel 512 Aug 13 03:42 Sat-old/ drwx------ 6 root wheel 512 Aug 21 03:36 Sun/ drwx------ 6 root wheel 512 Aug 14 03:36 Sun-old/ drwx------ 7 root wheel 512 Aug 18 03:36 Thu/ drwx------ 7 root wheel 512 Aug 11 03:39 Thu-old/ drwx------ 8 root wheel 512 Aug 23 03:36 Tue/ drwx------ 7 root wheel 512 Aug 16 03:36 Tue-old/ drwx------ 7 root wheel 512 Aug 17 03:37 Wed/ drwx------ 7 root wheel 512 Aug 10 03:39 Wed-old/ root@charlie:/backups % ll dailys/Fri drwx------ 3 root wheel 512 Aug 19 03:30 bravo/ drwx------ 3 root wheel 512 Aug 19 03:30 foxtrot/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050823112716.U26292>