Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Viewing contents of a tape

Status
Not open for further replies.

stilley

Programmer
Jan 16, 2003
52
CA
Hi, I am new at this and was wondering if there is an easy way to view the contents of the data that got backed up onto my tape from my sco unix server. I need to check and make sure the data got backed up ok.

Thanks in advance!
 
Hi. Can you tell us which backup software was used to save the data (eg cpio, tar etc)? Cheers.
 
Here is a copy of our nightly backup script. When it says SOURCE=/, does that mean that the whole system gets backed up every night?


----------------------------------------------------------


# This Section is used to inhibit users, until backup completes
# The file 'signoff.msg' is a simple message telling users that
# the system will be starting a backup in 5 minutes, asking
# them to sigh off gracefully. The 'passwd.min' is a copy of the
# active passwd file, with the sers remove.Only system user ( lp, bin , etc.. )
# should be in it along with root. The passwd.all is of course a passwd
# file will alusers in it. The passwd is copied to the passwd.all each time
# the script is run ( usually from cron ) in case new users are added.
# *****************************************************************************
wall < /usr/bin/signoff.msg
sleep 300
who -u > /usr/bin/wlist
awk '{ print &quot;kill -9&quot;,$7 }' /usr/bin/wlist > /usr/bin/tempkill
chmod 777 /usr/bin/tempkill
/usr/bin/tempkill
cp /etc/passwd /etc/passwd.all
cp /etc/passwd.min /etc/passwd

# *********************** Start of backup script ***************************
# Define global variables
TAPE=/dev/rStp0
SAVEDIR=/usr/bin/save
TMPFILE=${SAVEDIR}/tmpfile
TMPFILE2=${SAVEDIR}/tmpfile2
SOURCE=/
CONSOLE=/dev/tty01

# Find today's day
DAY=`date +%a`

# Check to see if it is Monday
if [ $DAY = Mon ]
then
# Skip backup, and do nothing
echo &quot;It is Monday, and we don't do a backup on Mondays&quot; | $CONSOLE
# fixpasswd re-copies the passwd.all, and sends a message
# to specific tty device ( terminals ) informing users to
# log back on... the the script exits with errorlevel 2
/usr/bin/fixpasswd
exit 2
else
# Proceed
:
fi

# Determine the names of today's list and log
LIST=${SAVEDIR}/${DAY}.list
LOG=${SAVEDIR}/${DAY}.log

# Log the fact that we just started
echo &quot;\n\n\rBackup started on `date`\r&quot; | tee $LOG | tee $CONSOLE

# Move to the root of the system
cd $SOURCE

# Create a list of all files to save
echo &quot;Creating backup list... Please wait.&quot; | tee -a $LOG | tee $CONSOLE

if [ $DAYNAME = Sun ]
then
find . -print | sed 's/^\.\///' > ${LIST}
else
find ./etc -print | sed 's/^\.\///' > ${LIST}
find ./usr -print | sed 's/^\.\///' >> ${LIST}
fi

# Make sure the tape is reset and retensioned
echo &quot;Resetting the tape ... Please wait.&quot; | tee -a $LOG | tee $CONSOLE
tape reset
sleep 10

echo &quot;Starting cpio backup .. Please wait.&quot; | tee -a $LOG | tee $CONSOLE

# Use cpio to back up data from the current directory (.)
# Save the cpio output in the log file.
cpio -ocv -O${TAPE} < $LIST

# If cpio failed, declare an error
if [ $? -ne 0 ]
then
echo &quot;\rSomething went wrong with cpio on `date`\r&quot; | tee -a $LOG | tee $CONSOLE
mail root < $LOG
# fixpasswd copies the passwd.all to passwd allowing users back on
# It also sends a message to each specific active terminal
# to inform users to log back on. Then exits with errorlevel 1
/usr/bin/fixpasswd
exit 1
fi

/usr/bin/fixpasswd
# Verify the backup
echo &quot;\rVerifying the backup on `date`\r&quot; | tee -a $LOG | tee $CONSOLE
cpio -itc -I${TAPE} > $TMPFILE2
cat $TMPFILE2 | awk '{ print $1 }' > $TMPFILE 2>> $LOG

diff $TMPFILE $LIST >> $LOG
if [ $? -ne 0 ]
then
echo &quot;\rBackup verification failed.\r&quot; | tee -a $LOG | tee $CONSOLE
mail root < $LOG
/usr/bin/fixpasswd
exit 1
else
echo &quot;\rBackup verification succeeded.\r&quot; | tee -a $LOG | tee $CONSOLE
fi

# Clean up
sleep 5
tape reset # Reset tape to make sure it releases $TMPFILE
sleep 5
cat ${TMPFILE} >> $LOG
sync # Flush the buffers
sleep 2
# *************************************************************************
# fixpasswd copies passwd.all back to passwd to allow users to log back on
# It also send a message to specific tty devices informing users to log back on
#/usr/bin/fixpasswd
#rm -f ${TMPFILE}
 
cpio -itv < /dev/nStp0
will list the filenames on the tape in the cpio archive
(not the data)

Sunday you back up everything
Monday you back up nothing
Tues-Sat you back up /etc and /usr

you also keep a list of files backed up in
/usr/bin/save/$DAY.list
and a log of the backup in
/usr/bin/save/$DAY.log

hth
 
Thanks Stan, also, is there a command to display the file sizes as well as the filenames on the tape and can I browse inside the directories?
 
um ...it does tell you file sizes
[tt]
100644 root 1499 Apr 14 11:35:21 2003 log.rsd069
100644 root 1499 Apr 11 15:11:59 2003 test/log.rsd070
[/tt]

But this is just header information not a check of the actual data on the tape.
 
Ok, thanks. Ya I realized that after I ran the command. I guess I should have ran the command before I asked that question. Also, how can I tell the total space used on the tape?
 
depending on your tape drive....if it's got hardware compression you can't tell exactly.
you can tell how much data has been sent to/from the tape device with the
tape amount /dev/xStp0
command. This only valid on the last tape operation performed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top