spake to us, saying:
>Hello:
>I want to back up several dir s located on different slices on a tape. I
>read Solaris doc, but I don't find a right solution. Examples are how-to
>backup A dir from A slice on a tape, and I would like to know...
>How-to backup from /var & /etc from a slice and /export from another one
>on the same tape...
>How-to read tape after back-up to know if it's the right one (before to
>recover).
>How-to restore A selective dir from multiple dump tape.
>Thanks on advance
Juan,
Your welcome to use this:
-------------------------------------------------------------------------------
!/bin/ksh
#
# Multi volume backup to single tape (such as 8MM Sun X6212A) using ufsdump.
#
if [ $# -ne 3 ]
then
exit 0
else
level=$1
tapepos=$2 # Suggest you should always start with 1
logfile=$3
df -F ufs | grep dsk | awk '{print $1}' | while read fsparms
do
mountpoint=`echo $fsparms | cut -d" " -f1`
device=`echo $fsparms | cut -d" " -f2`
echo "Backing up $mountpoint ($device)" >> $logfile
/usr/sbin/ufsdump "$level"unbdsf 126 54000 13000 /dev/rmt/0hn $device 2>> $logfile
if [ "$?" -gt 0 ]
then
echo "Level $level dump of $mountpoint on $device was NOT successful at tape position $tapepos" >> $logfile
else
echo "Level $level dump of $mountpoint on $device was successful at tape position $tapepos" >> $logfile
tapepos=`expr $tapepos + 1`
echo $tapepos > /etc/last_tape_position
fi
done
fi
-------------------------------------------------------------------------------
The above script will backup all "ufs" file systems. Run it like:
do_backup 0 1 backup.log
If you had partitions /, /usr, /var, and /home. / would be position 1, /usr
position 2, and so on. To restore from the /home sequences (4) use the command:
ufsrestore ivfs /dev/rmt/0 4
If you only wanted to do a selected list, it can be done from the command line
or place them in a file and execute it, like:
/usr/sbin/ufsdump 0unbdsf 126 54000 13000 /dev/rmt/0hn / ; \
/usr/sbin/ufsdump 0unbdsf 126 54000 13000 /dev/rmt/0hn /usr ; \
/usr/sbin/ufsdump 0unbdsf 126 54000 13000 /dev/rmt/0h /var ; \
to restore from /usr you would:
ufsrestore ivfs /dev/rmt/0 2
See:
man ufsdump
man ufsrestore
man mt
for further detail.
--
________________________________________________
| \*/\*/*\ http://home.swbell.net/astac /*\/*\*\ |
|================================================| ---
I---, |-=| Daniel James |=- Linux/Unix/Freedom Bigot -=| ----
-----U ==| |================================================| ---
----'----U | |________________________________________________| ---
|)___() 'U |______====____ \________________________________| -----
[_/,-,\"--"----- // ,-, ,-,\\\ |/ //,-, ,-, ,-,\\ __# ---
( 0 )====#####// ( 0 )( 0 )''- o '( 0 )( 0 )( 0 )''
---'-'--------------'-'--'-'-------------------'-'--'-'--'-'--------------