> I use the following script to do backups of several
> directories onto a DDS2 tape device on RedHat 7.0:
> #!/bin/bash
> FILES="/etc /home /root /var"
> for X in $FILES;
> do
> /sbin/dump -0 -f /dev/st0 $X >/dev/null
> done
> However, on the tape only the last directory "var" is
> remain. Could any expert explain why and how to make
> sure all directories are dumped in the given order?
Not sure if this is your problem but I think it's the use of
/dev/st0 that's causing the behaviour you're seeing. Your
script becomes
/sbin/dump -0 -f /dev/st0 /etc >/dev/null
/sbin/dump -0 -f /dev/st0 /home >/dev/null
/sbin/dump -0 -f /dev/st0 /root >/dev/null
/sbin/dump -0 -f /dev/st0 /var >/dev/null
That is, you're calling dump once for each directory using
the _automatically rewinding_ /dev/st0. Try using
/dev/nst0. It won't rewind the tape after each call to
dump.
I'm guessing the automatic rewinding is causing the second
invocation of dump to overwrite the data from the first, and
so on. Using /dev/nst0 won't rewind the tape, so the second
time dump gets called the tape will already be at the _end_
of the data from the first dump. You might want to add
mt -f /dev/nst0 rewind
to the end of your script (after 'done') to get the tape
rewound after the final dump.
Alternatively, you could dump all the directories with one
call to 'dump'. (I'm not a 'dump' user myself, so I can't
help you there.)
But your use of multiple calls to dump with the rewinding
tape device is almost certainly causing the tape to be
overwritten.
HTH,
J-P Stewart