Can I bakup like this...??
John Mills
johnmills at speakeasy.net
Wed Nov 19 06:17:27 PST 2003
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 at alum.mit.edu
More information about the freebsd-questions
mailing list