XFS WAS [Re: RH 8.0 X server reconfig problem...]
Andrew Mathews
andrew_mathews
Mon May 17 11:39:09 PDT 2004
Net Llama! wrote:
<snip>
>
> Andrew, do you know of any good documentation on xfsdump? I've been
> unable to find much that sanely walks a person through using it for
> backup & recovery.
>
The best I can lay my hands on is the O'Reilly Unix Backup & Recovery by
W. Curtis Preston. ISBN # 1-56592-642-0. Essentially, what I use is
based on the syntax of: /sbin/xfsdump -f /dev/st0 -o -l 0 -F -L
/mountpoint. In reverse, to restore I use /sbin/xfsrestore -if /dev/st0
/mountpoint. The interactive restore allows you to select or skip a
dump, and when selecting, for example a restore of /usr, if you only
want to restore /usr/local then select 2)Restore this dump, at which
point you can do an "ls" to view the files in the dump, do an "add *" to
select everything, or "add /local" for the /usr/local directory, or "add
/usr/local/foo" for the individual file name. Each selection is
indicated with an asterisk. When done selecting, simply do an "extract"
and it's done. Remember that xfsdump backs up by the mountpoints, and
uses the non-rewinding device. The script that I use, modified a tad for
each individual machine is below. (Watch out for the linewrap)
#!/bin/bash
#
# Backup script for xfsdump
# Written by Andy Mathews
DATE=`date '-I'`
LEVEL=0
TAPELABEL=$HOSTNAME_${LEVEL}_${DATE}
TAPE=/dev/nst0
TAPEDOMAIN=$HOSTNAME
PARTITION1=/
PARTITION2=/boot
PARTITION3=/home
PARTITION4=/iso
PARTITION5=/tmp
PARTITION6=/usr
PARTITION7=/var
PARTITION8=/var/spool
LOG=/var/log/backups/${TAPELABEL}.log
LOG1=/var/log/backups/${TAPELABEL}.stat
TAPE_ARGS=${TAPE}
XFSDUMP="/sbin/xfsdump -f ${TAPE_ARGS} -o -l ${LEVEL} -F -p 30 -L
${DATE}$TAPELABEL -M ${DATE}${TAPELABEL} "
# Rewind the tape
mt -f /dev/st0 rewind
#
if [ $? -ne 0 ]; then
echo 'No tape loaded or something is wrong!'> $LOG
/bin/mail -s "Tape not loaded - full backup of $TAPEDOMAIN
FAILED `date`" root
exit 1
fi
echo '' > $LOG1
echo '' > $LOG
echo "Backup starting on `date`" >> $LOG
echo "Backup starting on `date`" >> $LOG1
#
$XFSDUMP $PARTITION1 | cut -c16-80 >>$LOG
if [ $? -eq 0 ]; then
echo "Dump of $PARTITION1 was successful" >> $LOG1
else
echo "Dump of $PARTITION1 FAILED!" >> $LOG1
fi
mt -f $TAPE eod
$XFSDUMP $PARTITION2 | cut -c16-80 >>$LOG
if [ $? -eq 0 ]; then
echo "Dump of $PARTITION2 was successful" >> $LOG1
else
echo "Dump of $PARTITION2 FAILED!" >> $LOG1
fi
mt -f $TAPE eod
$XFSDUMP $PARTITION3 | cut -c16-80 >>$LOG
if [ $? -eq 0 ]; then
echo "Dump of $PARTITION3 was successful" >> $LOG1
else
echo $PARTITION3 Dump FAILED! >> $LOG1
fi
mt -f $TAPE eod
#$XFSDUMP $PARTITION4 | cut -c16-80 >>$LOG
#if [ $? -eq 0 ]; then
# echo "Dump of $PARTITION4 was successful" >> $LOG1
#else
# echo $PARTITION4 Dump FAILED! >> $LOG1
#fi
#mt -f $TAPE eod
$XFSDUMP $PARTITION5 | cut -c16-80 >>$LOG
if [ $? -eq 0 ]; then
echo "Dump of $PARTITION5 was successful" >> $LOG1
else
echo $PARTITION5 Dump FAILED! >> $LOG1
fi
mt -f $TAPE eod
$XFSDUMP $PARTITION6 | cut -c16-80 >>$LOG
if [ $? -eq 0 ]; then
echo "Dump of $PARTITION6 was successful" >> $LOG1
else
echo $PARTITION6 Dump FAILED! >> $LOG1
fi
mt -f $TAPE eod
$XFSDUMP $PARTITION7 | cut -c16-80 >>$LOG
if [ $? -eq 0 ]; then
echo "Dump of $PARTITION7 was successful" >> $LOG1
else
echo $PARTITION7 Dump FAILED! >> $LOG1
fi
mt -f $TAPE eod
$XFSDUMP $PARTITION8 | cut -c16-80 >>$LOG
if [ $? -eq 0 ]; then
echo "Dump of $PARTITION8 was successful" >> $LOG1
else
echo $PARTITION8 Dump FAILED! >> $LOG1
fi
echo "Backup completed on `date`" >> $LOG
echo "Backup completed on `date`" >> $LOG1
cat $LOG1 | mail -s "Level $LEVEL backup of $TAPEDOMAIN complete." root
rm -f $LOG
rm -f $LOG1
mt -f $TAPE rewoffl
This is what I use for DAT & DLT tape drives, you must add "-q" to the
XFSDUMP line for QIC or Travan drives.
HTH,
--
Andrew Mathews
---------------------------------------------------------------
7:00pm up 26 days, 1:11, 8 users, load average: 1.09, 1.13, 1.10
---------------------------------------------------------------
Remember, God could only create the world in 6 days because he didn't
have an established user base.
More information about the Linux-users
mailing list