Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Apr 2008 14:25:09 -0400
From:      John Almberg <jalmberg@identry.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Remote backups using ssh and dump
Message-ID:  <A7CC3420-D01E-4A3C-A8DC-57D31EB40486@identry.com>
In-Reply-To: <4E73E577666CE823A7212C54@utd65257.utdallas.edu>
References:  <4E73E577666CE823A7212C54@utd65257.utdallas.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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\'');





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A7CC3420-D01E-4A3C-A8DC-57D31EB40486>