Backup--quick, cheap, good/fast, pick all 3

David Kramer david at thekramers.net
Fri Sep 5 20:07:05 EDT 2003


On Friday 05 September 2003 04:36 pm, dsr at tao.merseine.nu wrote:
> Two things:
>
> - always have a bootable medium about with a) emergency tools and b)
>   install programs for your OS. If that means 2 CDs, or a CD and a
>   floppy, or whatever, just do it. Make multiple copies, and never loan
>   out your only copy. Pop one in your music collection, just to make
>   sure.

I'll add that you probably want either one of the single-floppy linux 
distros, like http://www.toms.net/rb, or a "live CD" that can run on the CD 
only.  These are essential when your hard drive goes all Humpty-Dumpty, and 
handy when you need to do little things like reinstalling the boot manager 
(lilo or grub).

> - if you have /home, /etc, and a list of all the packages you installed,
>   you're only a credit card and a trip to the hardware place away from
>   being operational.

I back up /home, but use a slightly different technique for /etc.

My backup script is also a Perl script.  I have it go through all the files 
on the system, and in addition to certain whitelisted directories and file 
extensions, it also backs up any text file under a certain size.  That way 
you get ALL important config files, even if they're in a weird place like 
/var/mailman/lists and /usr/libexec/webmin/burner/config.

That code segment looks like this:
    elsif(-f $Source)
    {
	print(FILES "$Line\n");

	if($Source =~ /(\/($IncludeDirs)\/)/ || $Source =~ /($IncludeFiles)/)
	{
	    Debug("$Source\t\tSpecial file ($1), size=$Size, OK");
	    DoBackup();
	}
	elsif($Source !~ /(\/($ExcludeDirs)\/)/ && $Source !~ /($ExcludeFiles)/)
	{
 	    if(-T $Source && $Size < $MaxTextSize)
	    {
		Debug("$Source\t\tNormal text, size=$Size, OK");
		DoBackup();
	    }
 	    elsif(-B $Source && $Size < $MaxBinarySize)
	    {
		Debug("$Source\t\tNormal binary, size=$Size, OK");
		DoBackup();
	    }
	    else
	    {
		Debug("$Source\t\tNOT backing up, binary or large, size=$Size");
	    }
	}
	else
	{
	    Debug("$Source\t\tNOT backing up, excluded ($1), size=$Size");
	}
    }

At the end of the backup of normal files, I also do "rpm -qa" and "rpm -qia" 
to two separate files.  Not much point in having the actual RPM's on the 
CD, sice 95% will be on your install CD, and the rest will take 15 minutes 
to download.  Or install then run up2date.

That same script also has several backup modes:
- copy backup files to another drive
- Create symlinks to all files somewhere so you can mkisofs without actually 
taking up twice the space
- Do the above then burn a CD
and maybe one or two more.

I can post the whole script for anyone who is interested.

-- 
DDDD   David Kramer         david at thekramers.net       http://thekramers.net
DK KD  
DKK D  "...Just remember what the MPAA says: horrific, deplorable violence
DK KD  is OK, as long as people don't say any naughty words."
DDDD                                                           Cartman's Mom



More information about the Discuss mailing list