[EMAIL PROTECTED] wrote:
> 
> Does anyone know of a way to make a backup image of the root drive for recovery
> on tape.

I don't know if you can use dd to write an image to tape.  I'm using tar
for backups.

At the end of this message is my program for backup to dat.  The mybck
variable can be set to whatever you want it to be (I use the backup
date; 02012000).  The "-n" part is just a numbering scheme.  It writes
the log file to /root as whatever mybck is set to .log. 02012000-1.log 

You will want to exclude things that are correct for your system (I'm
excluding /c and /d since they are win partitions).  Any system created
directory (such as /proc -- you don't have to recreate anything under
/proc, but you might have to for other dirs) that is excluded must be
recreated after a restore and before you reboot, if you are restoring to
a freshly formatted partition.  I backup all the "junk" in /var that you
normally wouldn't want because X writes things it needs out there.  It's
easier to just back it all up since I have the room on the dat.

There are probably better ways.  There are backup programs for Linux. 
None of them quite did what I wanted.  You can use dump and restore
which will give you incremental backups etc.  It's also better to do a
complete backup under single user mode so things don't get changed, but
I don't bother since I know to stay off when I'm doing backups.

If you restore to a freshly formatted partition (booting with boot disk
and modified rescue) with this backup, you need to recreate /proc
directory and lilo.  Do a chroot to where your new partition is mounted,
such as chroot /mnt/hda2. This changes you to have that device as "/". 
Do the restore, then enter lilo at the prompt to write that out.  If you
need to make a swap file partition also, check out the man page for
mkswap and write down what you need.

Restore would look something like:
(xxxxxx is the label name of the backup. It's the "b${mybck}" between
the "-V" and "--same-owner" on the first line of tar in the backup
sample below. I have multiple partitions and this restore would format
and restore them all, except swap. I'm typing this from memory, so there
may be mistakes here.)

> mke2fs -c /dev/hda2
> mkdir /mnt/hda2
> mount -t ext2 /dev/hda2 /mnt/hda2
> chroot /mnt/hda2
> cd /
> mke2fs -c /dev/sda5
> mke2fs -c /dev/sda6
> mkdir /mnt/sda5
> mkdir /usr
> mount -t ext2 /dev/sda5 /mnt/sda5
> mount -t ext2 /dev/sda6 /usr
> mt -f /dev/st0 rewind
> mt -f /dev/st0 compression 1
> mt -f /dev/st0 setblk 0
> tar --totals -R -V xxxxxx --same-owner -b 64 -xvpf /dev/st0 /
> mt -f /dev/st0 rewind
> mt -f /dev/st0 offline
> mkdir /proc
> mkdir /c
> mkdir /d
> lilo

reboot



backup program:
----cut here-----
#!/bin/bash
if [ $mybck = "" ]; then
echo "no mybck set... remember to set it with";
echo "  declare -x mybck=whatever-n in quotes... ";
exit;
else 
echo "mybck is ${mybck}"
fi
# Do the backup.
mt -f /dev/st0 rewind
mt -f /dev/st0 compression 1
mt -f /dev/st0 setblk 0
echo "backup started..." > /root/b${mybck}.log
echo `date` >> /root/b${mybck}.log
tar --totals -R -V b${mybck} --same-owner -b 64 -cvpf /dev/st0 / \
  --exclude "/proc/*" --exclude "*lost+found/*" \
  --exclude "/root/b${mybck}.log" --exclude "/c/*" \
  --exclude "/d/*" >> /root/b${mybck}.log
mt -f /dev/st0 rewind
mt -f /dev/st0 offline
echo "backup ended..." >> /root/b${mybck}.log
echo `date` >> /root/b${mybck}.log
exit
----cut here----

Reply via email to