From owner-freebsd-questions@FreeBSD.ORG Fri Apr 4 18:25:12 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E57341065671 for ; Fri, 4 Apr 2008 18:25:12 +0000 (UTC) (envelope-from jalmberg@identry.com) Received: from mx1.identry.com (on.identry.com [66.111.0.194]) by mx1.freebsd.org (Postfix) with ESMTP id 8745D8FC2F for ; Fri, 4 Apr 2008 18:25:12 +0000 (UTC) (envelope-from jalmberg@identry.com) Received: (qmail 28399 invoked by uid 89); 4 Apr 2008 18:25:10 -0000 Received: from unknown (HELO ?192.168.1.110?) (jalmberg@75.127.142.66) by mx1.identry.com with ESMTPA; 4 Apr 2008 18:25:10 -0000 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <4E73E577666CE823A7212C54@utd65257.utdallas.edu> References: <4E73E577666CE823A7212C54@utd65257.utdallas.edu> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: John Almberg Date: Fri, 4 Apr 2008 14:25:09 -0400 To: freebsd-questions@freebsd.org X-Mailer: Apple Mail (2.752.3) Subject: Re: Remote backups using ssh and dump 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: Fri, 04 Apr 2008 18:25:13 -0000 On Apr 4, 2008, at 1:59 PM, Paul Schmehl wrote: > Has anyone done this? > > I'm presently using rsync over ssh, but I think dump would be > better if it will work. I've been reading the man page, but I'm > wondering if anyone is doing this successfully and would like to > share their cmdline. > I do, but I'm not sure I'm doing it the optimal way. I'd love some feedback that might improve my simple script. Basically, I back up each partition separately. I don't think it is possible to just dump from the root, although if it is possible, I'd like to know how. This script assumes root can log into the backup server without a password. It 'rotates' the backups by including the day of the week in the file name, this gives me 7 days of complete backups. I also take a snapshot of the home directory, in case I need to fetch one file from backup. These dumps are really intended for catastrophic failure (which, knock on wood, I've never actually needed.) BTW, the primary and secondary servers both have dual nic cards. The backup server is directly connected to the primary server, using a crossover cable, so the nightly gigabyte transfer doesn't clog the office lan switch. -- John #!/usr/bin/perl my $day_of_week = (localtime)[6]; my $file_prefix = '/backup/ON-'.$day_of_week.'-'; system('dump -0Laun -f - /tmp | gzip -2 | ssh root@my.backupserver.com \'dd of='.$file_prefix.'tmp.gz\''); system('dump -0Laun -f - / | gzip -2 | ssh root@my.backupserver.com \'dd of='.$file_prefix.'root.gz\''); system('dump -0Laun -f - /usr | gzip -2 | ssh root@my.backupserver.com \'dd of='.$file_prefix.'usr.gz\''); system('dump -0Laun -f - /usr/local | gzip -2 | ssh root@my.backupserver.com \'dd of='.$file_prefix.'usr-local.gz\''); system('dump -0Laun -f - /var | gzip -2 | ssh root@my.backupserver.com \'dd of='.$file_prefix.'var.gz\''); system('dump -0Laun -f - /home | gzip -2 | ssh root@my.backupserver.com \'dd of='.$file_prefix.'home.gz\'');