Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Nov 2003 14:18:10 +0000 (UTC)
From:      John Mills <johnmills@speakeasy.net>
To:        FreeBSD-questions <freebsd-questions@freebsd.org>
Cc:        Keith Spencer <bsd2000au@yahoo.com.au>
Subject:   Re: Can I bakup like this...??
Message-ID:  <Pine.LNX.4.44.0311191353590.7448-100000@localhost.localdomain>
In-Reply-To: <20031119053350.67878.qmail@web12002.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Freebies -

In case this helps:

On Wed, 19 Nov 2003, Keith Spencer wrote:

> I need a quick n safe backup strategy.
> One that I can get the machine backup super quick if
> have to.
> What say you about this...(and "how do I" tips please)
> a) Throw another drive in the box

If you can mount a shared drive in another machine, that's even better.

> b) Createthe same or at least minimum size partitions
> as the active drive

 You don't need as much space if you compress the record.

> c) Cron job to "dump" or tar or ??? the partitions

'man cron' is doubtless your friend here. Write a script that runs your 
script and invoke it in the daily 'cron' run.

Here's the script to cull a number of large but uninteresting directories
out of my $HOME and create a compressed backup file. A separate script
would "roll" two successive copies of the compressed 'cpio' archive in the
backup storage space. I copied the archive out to a Windows 'share' in my
employer's backup path the first time I did this. At home, I just manually
copy it to a CD.

*************************************************************************

#!/bin/sh
echo "CPIO backup of /home to /tmp/myhomebackup.bz2"
echo "List contents with: bunzip2 -kc /tmp/myhomebackup.bz2 | cpio 
--list"
echo "Restore with: cd / ; bunzip2 -kc /tmp/myhomebackup.bz2 | cpio -i -d 
[-v]"
if [ -f /tmp/backuplist ]
then
  rm /tmp/backuplist
fi
find /home ! -type d -print | grep \/temp\/ -v | grep \/image\/ -v | grep 
\/incoming\/ -v | grep \/cache\/ -v > /tmp/backuplist
cpio -o -H crc < /tmp/backuplist | bzip2 -c - > /tmp/myhomebackup.bz2
echo "Backup created"

*************************************************************************

The key is making the file '/tmp/backuplist' with the right fully 
qualified paths to those _files_ (not just the directories) you want to 
backup. This approach can traverse partitions as needed (depending on 
where you start your 'find'). 'cpio' also preserves file dates and 
permissions a bit more gently than 'tar' (or so I understand).

If you need "really quick" recovery, you may consider using one of those
"hot-swap" IDE disk-drive mounts and have a spare of your _primary_ disk
ready to use (and boot, etc.). That saves you the time and trouble of
rebuilding the partitions on a new disk, and you only need to backup (and
to recover), those directories that are volatile.

Now you only need a secondary disk large enough to take the compressed
contents of your "live" backup fileset, it need not be bootable, and you
save time making and recovering the archive. If you can dump the archive
to something like a CD-R/RW, so much the better

HTH.

 - John Mills
   john.m.mills@alum.mit.edu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.44.0311191353590.7448-100000>