I'm sure there are other scripts on bigadmin, here's one I mucked up back in 2003 - using mtx for the library handler -
if you have vxfs filesystems, you'll have to muck with it some more. Its nothing special, but it's a place to start - jeff
#!/bin/ksh
#
# Variables
#
LOG=/var/tmp/prbkup.log
PATH=/usr/sbin:/usr/bin:$PATH
todays_date=`/scripts/getday`
export PATH LOG todays_date
/usr/local/mtx/sbin/mtx -f /dev/rmt/1n load ${todays_date} |tee -a $LOG
sleep 10
# Rewind the tape to BOT
mt -f /dev/rmt/1n rewind
date > $LOG 2>&1
#Backup 9 filesystems
# build the list dynamically
echo "about to backup the system:" >> $LOG
df -k -F ufs >> $LOG
echo >> $LOG
for filesystem in `df -k -F ufs|egrep -v "Mounted"|awk '{print $6}'`
do
/usr/sbin/ufsdump 0uf /dev/rmt/1n ${filesystem}>> $LOG 2>&1
done
echo >> $LOG
# Rewind Tape
mt -f /dev/rmt/1n rewind
sleep 5
# Mail the output
mailx -s "Full System Backup on `uname -n`" root < $LOG
/usr/local/mtx/sbin/mtx -f /dev/rmt/1n unload ${todays_date} |tee -a $LOG
Dear Jeff,
If I want to manually backup my Solaris server, and the output of the command df -k -F ufs command on my system is like this:
Filesystemkbytesusedavail capacity Mounted on
/dev/md/dsk/d1010187212 6049073 403626760%/
/dev/md/dsk/d3042344610 31916521 1000464377% /f
/dev/md/dsk/d6070572153 13468964 5639746820%/extra
/dev/md/dsk/d40141134915 19767923 119955643 15%/database
/dev/md/dsk/d50141134915 7828962 1318946046%/index
Are these the only file systems I need to backup?
When I create the backup of the root file system, for example, is this command correct?
#ufsdump 0uf /dev/rmt/0 /dev/md/dsk/d10
Thank you!
Cinderella
If you use device '0', then the tape will rewind after the dump finishes. You'd either have to use a separate tape for each filesystem, forward the tape manually, or you'll end up overwriting the tape with each dump (only the last one would be present at the end).
You may instead want to use the '0n' (or the 0un) device. The 'n' says that the tape should remain in position when the dump is complete.
--
Darren