From owner-freebsd-questions@FreeBSD.ORG Tue Aug 23 18:35:42 2005 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5023616A420 for ; Tue, 23 Aug 2005 18:35:42 +0000 (GMT) (envelope-from freebsd@philip.pjkh.com) Received: from zhonka1.zhonka.net (zhonka1.zhonka.net [66.228.195.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id DB76143D53 for ; Tue, 23 Aug 2005 18:35:41 +0000 (GMT) (envelope-from freebsd@philip.pjkh.com) Received: from wolf.pjkh.com ([66.228.196.74]) by zhonka1.zhonka.net (Post.Office MTA v3.5.3 release 223 ID# 0-58414U4500L450S0V35) with ESMTP id net; Tue, 23 Aug 2005 11:35:40 -0700 Received: from localhost (localhost [127.0.0.1]) by wolf.pjkh.com (Postfix) with ESMTP id 82F68584D; Tue, 23 Aug 2005 11:35:35 -0700 (PDT) Received: from wolf.pjkh.com ([127.0.0.1]) by localhost (wolf.pjkh.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 26213-01; Tue, 23 Aug 2005 11:35:35 -0700 (PDT) Received: by wolf.pjkh.com (Postfix, from userid 1000) id 2CC05584B; Tue, 23 Aug 2005 11:35:35 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by wolf.pjkh.com (Postfix) with ESMTP id 266405773; Tue, 23 Aug 2005 11:35:35 -0700 (PDT) Date: Tue, 23 Aug 2005 11:35:35 -0700 (PDT) From: Philip Hallstrom To: Danny Howard In-Reply-To: <20050823182133.GF51748@ratchet.nebcorp.com> Message-ID: <20050823112716.U26292@wolf.pjkh.com> References: <20050819141535.GA62513@lohi.local> <20050823182133.GF51748@ratchet.nebcorp.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at pjkh.com Cc: Ilari Laitinen , questions@freebsd.org Subject: Re: dump(8), incremental backups, Tower of Hanoi sequence, don't get it X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2005 18:35:42 -0000 > 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/