To save you some playing...

If you want to backup everything, apart from some small bits...

tar -cvf /dev/nst0 -X /etc/backup.exclude  /  > /tmp/backup.log
(my tape is /dev/nst0, YMMV)

In a file called backup.exclude in /etc/ put a list of dir names you want to
exclude, one per line.
For eg. start with:
/proc
/tmp
/dev

Obviously you don't really want to run a backup like this, as you'll get 1Gb
of cruft on a current distro workstation machine, binaries etc..

To bring a box back from the dead, assuming it's not too customised, /home,
/etc and maybe some data from /var is usually enough.  On most of my
machines I have a /data on a seperate partition as well (or NFS mouted to
the server).  Slap the distro and apps back on, and bring back your /home
and /data...  Only use the backed up /etc to find any obscure settings you
made...  _Don't_ restore it over your newly rebuild server, often some pain
results when all the symlinks in your init.d/rc*.d dirs get broken..

The other thing about this is you'll want to split it up into CDR sized
chunks unless you've got a tape drive  For the global good (or otherwise...)
here's my script for creating 650Mb chunks...

The main script:
<--------cut here----------->
#!/bin/bash
rm /data/Backup/*.tar
tar -cvf /data/Backup/back.tar -F /root/moveback -M -L 650000 -X /etc/skips
/ > /tmp/backup.log
/root/moveback

<--------cut here----------->

moveback, called from the main script...
<--------cut here----------->
#!/bin/bash
echo RUNNING MOVEBACK
for ((xx=0;xx<1000;xx++)); do
  echo $((xx))
  if [ ! -f /data/Backup/$((xx)).tar ]; then
    mv /data/Backup/back.tar /data/Backup/$((xx)).tar
    exit 0
  fi
done
<--------cut here----------->

That creates a bunch of tar files, called 0.tar, 1.tar, 2.tar etc in the
directory /data/Backup.  /etc/skips is the exclude list, and a backup log
winds up in /tmp/backup.log

I've used this for a few people who want to backup to cdr/cdrw  it uses no
compression (tar can't use compression with multi-part archives) so if
you've got lots of data it's probably a bad idea, but for a few Gb it's not
an issue.  One other down side is you need at least as much space as you
have data free, to create the tar files....

For next weeks trick, I'll tell you how to restore from a multi-part tar
file :-).

Cheers, Chris H.



----- Original Message -----
From: "Yuri de Groot"

> I was going to ask "how do you skip /proc when tarring?" but I'll read the
man
> page when I get home.


Reply via email to