From owner-freebsd-questions@FreeBSD.ORG Sat Jan 15 01:22:32 2005 Return-Path: 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 0BDC116A4CE for ; Sat, 15 Jan 2005 01:22:32 +0000 (GMT) Received: from smarthost2.sentex.ca (smarthost2.sentex.ca [205.211.164.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8B8D943D1D for ; Sat, 15 Jan 2005 01:22:31 +0000 (GMT) (envelope-from mike@sentex.net) Received: from BLUELAPIS.sentex.ca (cage.simianscience.com [64.7.134.1]) by smarthost2.sentex.ca (8.13.1/8.13.1) with SMTP id j0F1MUIm078178; Fri, 14 Jan 2005 20:22:30 -0500 (EST) (envelope-from mike@sentex.net) From: Mike Tancsa To: Jeff MacDonald Date: Fri, 14 Jan 2005 20:22:36 -0500 Message-ID: <18qgu05rea94qe86qea4dsgj4f5fsq8785@4ax.com> References: In-Reply-To: X-Mailer: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: ClamAV 0.80/625/Fri Dec 10 12:41:57 2004 clamav-milter version 0.80j on clamscanner1 X-Virus-Status: Clean cc: freebsd-questions@freebsd.org Subject: Re: Backups / Dump etc X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jan 2005 01:22:32 -0000 On Fri, 14 Jan 2005 13:00:26 -0400, in sentex.lists.freebsd.questions you wrote: > >I know that dump is the bees-knees for backing up, so I'm looking for >any pre-made scripts for doing scheduled incremental backups with >dump.. or articles about dump etc.. Yes, dump and restore are what you should look at. It probably will meet your needs. > >I've also been told that dump lacks network support and tho you can >use -f and ssh, it's very slow. Dump and pipe it through ssh via ssh key'd authentication or dump to an NFS mount. This is off the top of my head, so test first=20 e.g. you want to back up webserver1.example.org to backupserver1.example.org On the backup server,=20 pw useradd webserver1 -m su webserver1 cd ssh-keygen -d passwd webserver1 set the passwd to whatever you want On the webserver, su root ssh-keygen -d scp ~root/.ssh/id_dsa.pub webserver1@example.org:~webserver1/.ssh/authorized_keys2 ssh webserver1@backupserver1.example.org You should be able to get in without a password now and you can * out the passwd for webserver1 On the webserver, create the script below in /root/dump.sh #!/bin/sh - #this example script will dump the / partition to the backup server if [ -z $1 ] ; then echo "" echo "Usage: $0 " echo " See 'man dump' for more information." echo "" exit 255 fi DUMP_LEVEL=3D$1 /sbin/dump -${DUMP_LEVEL}anuf - / | /usr/bin/gzip -9c | /usr/bin/ssh -2 -c 3des webserver1@backupserver1.example.org dd of=3D~webserver1/dump-root-${DUMP_LEVEL}.gz /sbin/dump -${DUMP_LEVEL}anuf - /usr | /usr/bin/gzip -9c | /usr/bin/ssh -2 -c 3des webserver1@backupserver1.example.org dd of=3D~webserver1/dump-usr-${DUMP_LEVEL}.gz /sbin/dump -${DUMP_LEVEL}anuf - //sbin/dump -${DUMP_LEVEL}anuf - /usr | /usr/bin/gzip -9c | /usr/bin/ssh -2 -c 3des webserver1@backupserver1.example.org dd of=3D~webserver1/dump-usr-${DUMP_LEVEL}.gz | /usr/bin/gzip -9c | /usr/bin/ssh -2 -c 3des webserver1@backupserver1.example.org dd of=3D~webserver1/dump-var-${DUMP_LEVEL}.gz on the web server, something like the following crontab 4 4 * * 0 /root/dump.sh 0 4 4 * * 1 /root/dump.sh 1 4 4 * * 3 /root/dump.sh 2 4 4 * * 4 /root/dump.sh 3 4 4 * * 5 /root/dump.sh 4 4 4 * * 6 /root/dump.sh 5 4 4 * * 7 /root/dump.sh 6 WIll do a differential dump each day across the network with a level 0 dump (a full dump) once per week on Sunday morning. To do a full restore (assuming those are all your partitions) on the backup server, pop the new drive in. Firewire attached drives work quite well under FreeBSD Assuming these directories do not exists, mkdir /tmp/root mkdir /tmp/usr mkdir /tmp/var /stand/sysinstall fdisk the new drive and make sure you make it bootable. exit out (I think this is to work around a bug that I occasionally run into) /stand/sysinstall and run disklable and create the slices to match your new drive Create the mount points on something like /tmp/root, /tmp/usr and /tmp/var And newfs it.... cd /tmp/root zcat ~webuser1/dump-root-0.gz | restore -rf -=20 zcat ~webuser1/dump-root-1.gz | restore -rf -=20 ... zcat ~webuser1/dump-root-6.gz | restore -rf -=20 and so on... ---Mike