hi,
This is the original question. Thanx.
>
>hi,
>
> ANyone got a script for backup multiple partition in one 4mm tape?
>
Thanx to the following peeople
1) Tim Evans
2) Srinivasa Moorthy
3) James Ranks
4) Russell Weeks
5) Bert Shure
6) Frank Pardo
7) James H. McG. Sibley
8) craigw@dg.ce.com.au
9) Martin Huber
10) and also any more help coming in
--------------------------------------------------------------------------------
You don't need a special script. Just use the no-rewind device name, such
as /dev/rmt/0n (Solaris 2.x) or /dev/nrst8 (SunOS 4.1.x). Note the "n"
in each.
-- Tim Evans | E.I. du Pont de Nemours & Co. tkevans@eplrx7.es.dupont.com | Experimental Station (302) 695-9353/8638 (FAX) | P.O. Box 80357 EVANSTK AT A1 AT ESVAX | Wilmington, Delaware 19880-0357-------------------------------------------------------------------------------
You could do so by using the no-rewind option of the tape-drive.
1. /bin/mt -f /dev/rst8 rewind - start by rewinding. 2. /usr/etc/dump 0udsbf 216000 8000 126 /dev/nrst8 <filesystem1> - The first filesystem will be backed up. 3. /usr/etc/dump 0udsbf 216000 8000 126 /dev/nrst8 <filesystem2> - The second filesystem will be backed up. ..... and so on.
The key to this, is the no-rewind option - by choosing /dev/nrst8 - where after completing one filesystem ,the tape will not be wound back. And the next filesystem is backed up, continuing from there on.
To Restore,
1.Position the tape appropriately to the required filesystem. /bin/mt -f /dev/rst8 fsf 2 This will forward to the 2nd fileposition, which will be our second filesystem backup. 2.Then use restore command. restore xvf /dev/nrst8 Be sure to use the no-rewind option - nrst8 - which will start restoring from the current tape position.
With this I hope, you would be able to build the script.
Thanks Srinivasa Moorthy (rsm@idc.tandem.com)
-------------------------------------------------------------------------------
Hope this helps.
The key is the "n" in /dev/rmt/0n
The "n" means no rewind.
James Ranks AVN Network Administrator
#!/usr/bin/sh su - oracle -c UTIL/shutdown_ora 2>&1 mt rewind 2>&1 echo ===================================================== echo Sequence 01 - / ufsdump 0cfu /dev/rmt/0n /dev/rdsk/c0t3d0s0 2>&1 echo ===================================================== echo Sequence 02 - /var ufsdump 0cfu /dev/rmt/0n /dev/rdsk/c0t1d0s3 2>&1 echo ===================================================== echo Sequence 03 - /opt ufsdump 0cfu /dev/rmt/0n /dev/rdsk/c0t1d0s1 2>&1 echo ===================================================== echo Sequence 04 - /usr ufsdump 0cfu /dev/rmt/0n /dev/rdsk/c0t3d0s3 2>&1 echo ===================================================== echo Sequence 05 - /export/home ufsdump 0cfu /dev/rmt/0n /dev/rdsk/c0t3d0s4 2>&1 echo ===================================================== echo Sequence 06 - /oracle ufsdump 0cfu /dev/rmt/0n /dev/rdsk/c0t1d0s4 2>&1 echo ===================================================== echo Sequence 07 - /u01 ufsdump 0cfu /dev/rmt/0n /dev/rdsk/c0t3d0s5 2>&1 echo ===================================================== echo Sequence 08 - /u02 ufsdump 0cfu /dev/rmt/0n /dev/rdsk/c0t1d0s5 2>&1 su - oracle -c UTIL/start_ora 2>&1 chgrp -R staff /var/backuplogs chmod -R 774 /var/backuplogs mt rewoffl 2>&1
-------------------------------------------------------------------------------
SC:
The following is a more general script that we use here. You would need to modify the host names, file systems and dump schedule for your site.
-- ************************************************************************** * Russell Weeks rweeks@.math.usu.edu * * System Manager TEL: (801)797-4061 * * Department of Mathematics & Statistics FAX: (801)797-1822 * * Utah State University WWW: http://www.math.usu.edu * **************************************************************************
----------cut here------------- #!/bin/sh #------------------------------------------------------------------------------- # Script to assist in performing filesystem dumps. # NOTES: # # The "dumpsched" variable is a list of default dump levels Sunday # through Saturday. # # The file systems will be dumped in the order of the variable "disks" # # general usage: dumpfs # # Non-interactive usage: dumpfs <level> # # for an unrecorded dump: dumpfs special # #------------------------------------------------------------------------------- # get dumphost info host=`/usr/ucb/hostname` case $host in host1) disks="/u1 /u2 / /usr /opt" dumphost="host1" device="4mm" dumpsched="na 0 na na na na na";; host2) disks="/u /u1 /u2 /u3 /u4 /u5 / /var /usr /opt /export" dumphost="host2" device="8mm" dumpsched="na 0 na 5 na 3 na";; *) echo `basename $0`: no dump parameters defined for $host exit;; esac echon() { /usr/ucb/echo -n "$*" } getlevel() { # get default dump level based on dump_schedule: day=`date +%w` while ( test $day -gt 0 ) do shift day=`echo $day-1 |bc` done default=$1 # query to make sure of level: case $default in [0-9]) echon "Dump Level? ($default): ";; *) echon "Dump Level?: ";; esac read ans case x$ans in x[0-9]) level=$ans;; x) level=$default;; *) echo $ans is an invalid value for dump_level.; exit;; esac } # make sure user has root access: user=`/usr/ucb/whoami` if (test $user != "root" ) then echo `basename $0`: Sorry. You must be root to dump filesystems.; exit fi # get date: echo Today is `date "+%B %d, %Y (%A)"` update=u # get and verify dump level: case x$1 in x[0-9]) level=$1;; xspecial) unset update; getlevel $dumpsched;; x) getlevel $dumpsched;; *) echo $1 is an invalid value for dump_level.; exit;; esac # set dump parameters based on physical dump device: case $device in 4mm) dumpparams="${update}cbsdf 126 5000 61000" dumpdevice="/dev/rmt/0";; 8mm) dumpparams="${update}f" dumpdevice="/dev/rmt/0m";; esac # dump the filesystems: echo "--------------------------------------------------------------------" echo "Preparing for level $level dump to $device tape drive on $dumphost" echo "--------------------------------------------------------------------" starttime=`date "+%I:%M %p on %A, %B %d, %Y"` if (test $host != $dumphost) then access=`rsh $dumphost whoami` echo access is $access if (test $access != root) then echo no root access to remote host $dumphost. ;exit else echo root access to $dumphost verified fi echon making sure tape is rewound... rsh $dumphost mt -f $dumpdevice rew echo done for disk in $disks do echo DUMPING ${disk}... ufsdump ${level}${dumpparams} ${dumphost}:${dumpdevice}n ${disk} done echon rewinding tape... rsh $dumphost mt -f $dumpdevice rewoffl echo done echo ejecting tape...done else echon making sure tape is rewound... mt -f $dumpdevice rew echo done for disk in $disks do echo DUMPING ${disk}... ufsdump ${level}${dumpparams} ${dumpdevice}n ${disk} done echon rewinding tape... mt -f $dumpdevice rewoffl echo done echo ejecting tape...done fi stoptime=`date "+%I:%M %p on %A, %B %d, %Y"` echo "dump started: $starttime" echo "dump ended: $stoptime" -------------------------------------------------------------------------------
here's my script for doing it on an 8mm tape.
--bert--
#!/bin/csh set verbose set day = `date +%y%m%d` #echo "start by making a tarfile from the sparcbook" #mount rodenta:/export/home /mnt #tar cvf /export/home/bert/tarfile_from_rodenta /mnt/users/demo #compress /export/home/bert/tarfile_from_rodenta #umount /mnt #echo "now for a tarfile from samee" #mount samee:/c /mnt #tar cvf /disk/tarfile_from_samee /mnt #umount /mnt #compress /disk/tarfile_from_samee echo "now for the real backups" mt -f /dev/rmt/0n rew ufsdump 0uf /dev/rmt/0bn / ufsdump 0uf /dev/rmt/0bn /usr ufsdump 0uf /dev/rmt/0bn /var ufsdump 0uf /dev/rmt/0bn /export/home ufsdump 0uf /dev/rmt/0bn /opt #ufsdump 0uf /dev/rmt/0bn /disk echo "now test the backups." mt -f /dev/rmt/0n rew;ufsrestore tfs /dev/rmt/0n 1 > /export/home/bert/dumpfile1.${day} mt -f /dev/rmt/0n rew;ufsrestore tfs /dev/rmt/0n 2 > /export/home/bert/dumpfile2.${day} mt -f /dev/rmt/0n rew;ufsrestore tfs /dev/rmt/0n 3 > /export/home/bert/dumpfile3.${day} mt -f /dev/rmt/0n rew;ufsrestore tfs /dev/rmt/0n 4 > /export/home/bert/dumpfile4.${day} mt -f /dev/rmt/0n rew;ufsrestore tfs /dev/rmt/0n 5 > /export/home/bert/dumpfile5.${day} #mt -f /dev/rmt/0n rew;ufsrestore tfs /dev/rmt/0n 6 > /export/home/bert/dumpfile6.${day} mt -f /dev/rmt/0n rew
Bert Shure <Bert_Shure%SOLSOURCE@notes.worldcom.com> -------------------------------------------------------------------------------
This script is for 8mm tape, but that's not important; just change the TAPE definition. Also change 'fpardo' to your user id and change 'garcia' to the hostname of your computer.
good luck
#!/sbin/sh #.......................................................................
# level zero backup of garcia onto 8mm tape
if [ "$1" = '-d' ] then DRY_SW=0 else DRY_SW=1 fi
DRYRUN () { return $DRY_SW ; } ## 0 = dry run TimeStamp () { date '+%a %d %b %H:%M' ; } Message () { echo "`TimeStamp` $1" ; } Execute () { command="$1"; echo "`TimeStamp` $command"; DRYRUN || $command ; }
LOGOWNER=fpardo LOGDIR=/home/$LOGOWNER/bkuplog PATH=/usr/local/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/bin:/sbin TAPE=/dev/rmt/0n
Message 'starting level 0 backup of garcia.' awk '$4 == "ufs" {print $1, $2, $3}' < /etc/vfstab \ | while read D_BLK D_RAW D_MPT do abbr=`echo "$D_MPT" | tr -d '/'` IDENT="${abbr:-root}" Message "starting to back up $D_BLK ($D_MPT)" Execute "ufsdump 0cufa $TAPE /tmp/$IDENT $D_RAW" Execute "cp /tmp/$IDENT $LOGDIR" Message "finished backing up $D_BLK ($D_MPT)" done Execute "mt offline" Execute "chown $LOGOWNER $LOGDIR/*" Message "finished level 0 backup of garcia."
#.......................................................................
-- Frank Pardo <fpardo@tisny.com> | The scholar's ink outlasts | Transaction Information Systems | the martyr's blood. | New York City | -- Irish proverb | -------------------------------------------------------------------------------
Here's the script I use to backup our disks onto one 4mm tape. You can call it with one argument "fulldump," "weekdump," or "daydump" which determines what kind of dump gets performed (level 0, 5, or 8 respectively). What I do is a "fulldump" once a month, then each week one "weekdump" followed by four "daydump"s (which I put all on one tape).
Happy Trails...
------------------------------------------------------------------------------
#!/bin/sh
case $1 in fulldump) level=0 ;; weekdump) level=5 ;; daydump) level=8 ;; *) echo "I don't know what to think when you call me \"$1\"."; exit 1;; esac
dump=ufsdump blocking=96 tape=/dev/rmt/0hn mt=mt
if [ $level -eq 8 ] ; then $mt -f $tape eom else $mt -f $tape erase $mt -f $tape rewind fi
# Find out which filesystems to dump. There are two things # going here: first, we want to dump the root filesystem last, # so as to save a copy of /etc/dumpdates that has the latest # times for every other filesystem. Second, we may want to verify # those filesystems that we can. This doesn't include the root # partition or /usr, which under Solaris must both be mounted # for the system to run any kind of functional shell.
set `grep '^/dev\/dsk/' /etc/vfstab | grep -v 't1d0s1' | sort -r +2 -3 | \ awk '$3 ~ /^\/$/ || $3 ~ /^\/usr$/ {print $1; next} $3 ~ /^\// {print $1}'`
while [ $# -gt 0 ] do verify="" $dump ${level}${verify}ubf $blocking $tape $1 shift done
# The TAPEHOST does its dump before any others. Thus, leave the # tape unrewound, and resident in the drive so that other machines # can dump to the same tape. This doesn't apply to fulldumps, since # its unlikely that these will fit on a single tape.
if [ $level -eq 0 ] ; then $mt -f /dev/rmt/0hn rewind fi
$mt -f /dev/rmt/0hn offline
exit 0
-- James H. McG. Sibley Nous Sommes Du Soleil Sys. Admin./Tech. Director/Webmaster We Are of the Sun USPAN, Inc. We Can See ilios@uspan.com -YES-
-------------------------------------------------------------------------------
I just use something simple like:
#ufs backup of home directories
sleep 35000
ufsdump 0ubdsf 126 54000 6000 /dev/rmt/0n /home ufsdump 0ubdsf 126 54000 6000 /dev/rmt/0n /home1 ufsdump 0ubdsf 126 54000 6000 /dev/rmt/0n /home2 mt -f /dev/rmt/0 rewoff
To access the info I generally use the interactive mode to specify the secion of the tape I wish to access
-----------------------------------------------------------------------------
df |cat - /opt/local/sys/dump_all | dd of=/dev/rmt/0cn bs=126b ufsdump 0ubdsf 126 100000 100000 /dev/rmt/0cn /dev/rdsk/c0t0d0s0 ufsdump 0ubdsf 126 100000 100000 /dev/rmt/0cn /dev/rdsk/c0t0d0s6 ufsdump 0ubdsf 126 100000 100000 /dev/rmt/0cn /dev/rdsk/c0t0d0s5 ufsdump 0ubdsf 126 100000 100000 /dev/rmt/0cn /dev/rdsk/c0t0d0s7
The first line is to have a 'directory' on the tape. You can read it with
dd if=/dev/rmt/0cn bs=126b
and restore a individual partition with mt -t /dev/rmt/0cn fsf nunber_of_files_to_skip ufsrestore ibf 126 /dev/rmt/0cn
hu@garfield.uucp (Martin Huber) ------------------------------------------------------------------------------- +-----------------------------------------------------------------------+ | Khoo Swee Chuan - TMnet system administrator | | http://www.asiapac.net/~sckhoo/ sckhoo@asiapac.net | | tel:603-7337757 fax:603-7345577 #include <std.disclaimer> | | ****** To join MYISOC mailing list, try majordomo@tm.net.my ******** | +-----------------------------------------------------------------------+ "if you eliminate the impossible, whatever remains - however improbable - must be the truth."
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:11 CDT