[CS-FSLUG] backup strategies

Frank Bax fbax at sympatico.ca
Wed Jul 21 08:05:28 CDT 2004


At 12:47 AM 7/21/04, Stephen McCracken wrote:

>Frank Bax wrote:
>>I'm looking for comments on Linux system I'm planning to put together - 
>>actually two systems in two cities.  The only purpose of these systems is 
>>to replace NT40 systems that only provided file shares.
>>Disk 1:
>>     - two Linux partitions - one for current install - one for upgrades
>>     - swap partition
>>     - data partition to hold all shares (samba).
>>Disk 2:
>>     - backup/copy of Disk1
>>Disk 3:
>>     - archive backup of Disk2 - I've written a script that keeps 
>> versions of files as they change.  This disk would have most recent 9 
>> (for example) versions of any file on Disk2.
>>Disk 4:
>>     - offsite backup - copy of remote Disk3 (using rsync).
>>Two sites would be setup.  Disk4 of each system would have copy of Disk3 
>>for the other system.  I already do Disk2&3 on a Linux system for backup 
>>of NT4 system.
>
>One quick question would be why Disk 2 is backup/copy rather than software 
>RAID.

Simply because I've never used RAID and don't understand it.  I was 
wondering if/how it might apply to this situation when I posted my query.

>Another thing would be that you probably should try to get disks from 
>different batches so they won't all have the same failure characteristics 
>(e.g. several failing at the same time).  Another question would be why 
>you have ruled out tape or at least semi-frequent CD/DVD backups.

We have tapes on the current NT40 systems.  Too much human intervention 
with tapes.  My experience is that tapes do not get replaced in the drive 
and are not always taken off-site.  Semi-frequent CD/DVD backups sounds 
like a good idea - the current archive system does not allow for deletion 
of obsolete files (but can be done manually).

>btw, Would you mind sharing your version archive script?  Thanks


At the moment, the archive script is run separately for each shared folder.
I called the script bkpCycle and invoke it like:
         bkpCycle 9 /inp/directory /out/directory


#!/usr/bin/perl -w
use strict;

my $cyc  = shift;
my $IDIR = shift;
my $ODIR = shift;
my $NULL = "/dev/null";

if( open( FILE, "find $IDIR -type f -name '*' | sort | ") ) {
   while( <FILE> ) {
     chop;
     my $ifile = "$_";   $ifile = &fixfn( $ifile );
     my $ofile = "$_";   $ofile = &fixfn( $ofile );
     $ofile =~ s/^$IDIR\///g;    # Remove IDIR from beginning of filename
     $ofile =~ s/\//_/g;         # Make path part of filename
     my $ONE="$ODIR/$ofile.0";
     if( -f $ONE ) {
       if( system "diff -q $ifile $ONE > $NULL" ) {
         print "$ifile\n";
         for( my $n=$cyc; $n>0; --$n ) {
           my $p = $n - 1;
           my $OLD = "$ODIR\/$ofile.$p";
           my $NEW = "$ODIR\/$ofile.$n";
           if( -f $OLD ) {
             system "cp -p $OLD $NEW";
           }
         }
       }
     }
     system "cp -p $ifile $ONE";
   }
   close( FILE );
}

sub fixfn {
   (my $fn) = @_;
     $fn =~ s/ /\\ /g;
     $fn =~ s/'/\\'/g;
     $fn =~ s/\-/\\-/g;
     $fn =~ s/\!/\\!/g;
     $fn =~ s/\&/\\&/g;
     $fn =~ s/\(/\\(/g;  $fn =~ s/\)/\\)/g;
     $fn =~ s/\$/\\\$/g;
   return $fn;
}





More information about the Christiansource mailing list