1834156 Members
2540 Online
110064 Solutions
New Discussion

cpio error

 
karbach
Occasional Contributor

cpio error

Hello,
To backup a given directory i use the following
command line:

find /working_dir -print | cpio -oc >/device_tape_name

and the backup terminates whitout errors.
But when trying to list or extract the backuped files with :

cpio -itcv or
cpio -icv
I recieve the following message:
cpio: unexpected end-of-archive encountered.
What could be the error i commited ?
4 REPLIES 4
Rainer von Bongartz
Honored Contributor

Re: cpio error

What is your 'device_tape_name' ?
is a a 'rewind' device ?
Re-wind the tape (mt -f device> rew) and try to read with cpio again

Regards
Rainer
He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...
Edward Alfert_2
Respected Contributor

Re: cpio error

I also use cpio for backups... take a look at the script i use. there are some differences with the options for cpio as well as i also verify the tape after creation. hope the information is useful.

# HP BACKUP.SYS Backs up everything under /
echo "Starting Backup Routine ...............`date`" > /usr/tmp/bulog
TERM=vt220; export TERM
echo "------------------------------------------------" |tee -a /usr/tmp/bulog
echo "Creating Backup List .................`date`" |tee -a /usr/tmp/bulog
cd /
date > ./datestamp
find ./datestamp -print > /usr/tmp/backuplist
find ./ -size +0 -print >> /usr/tmp/backuplist
NUM=`cat /usr/tmp/backuplist|wc -l`
echo "------------------------------------------------" |tee -a /usr/tmp/bulog
echo "Rewinding tape before the write ......`date`" |tee -a /usr/tmp/bulog
mt -t /dev/rmt/0m rew
echo "------------------------------------------------" |tee -a /usr/tmp/bulog
echo "Writing to tape .....................`date`" |tee -a /usr/tmp/bulog
cat /usr/tmp/backuplist | cpio -ocuvB > /dev/rmt/0m
echo "$NUM file(s) should be written to tape..." |tee -a /usr/tmp/bulog
echo "Write Complete! .......................`date`" |tee -a /usr/tmp/bulog
echo "------------------------------------------------" |tee -a /usr/tmp/bulog
echo "Rewinding tape before the verify ......`date`" |tee -a /usr/tmp/bulog
mt -t /dev/rmt/0m rew
echo "------------------------------------------------" |tee -a /usr/tmp/bulog
echo "Verifying Tape Backup .................`date`" |tee -a /usr/tmp/bulog
cpio -ictBv < /dev/rmt/0m > /usr/tmp/tapelist
NUM2=`cat /usr/tmp/tapelist|wc -l`
echo "**************************************" |tee -a /usr/tmp/bulog
echo "$NUM file(s) should write to tape..." |tee -a /usr/tmp/bulog
echo "$NUM2 files verified from tape..." |tee -a /usr/tmp/bulog
echo "**************************************" |tee -a /usr/tmp/bulog
if [ "$NUM" != "$NUM2" ]
then
echo "WARNING!!! Tape Verification has failed " |tee -a /usr/tmp/bulog
echo "Please notify R&D Systems immediately " |tee -a /usr/tmp/bulog
fi
echo "Tape Verification Complete ............`date`" |tee -a /usr/tmp/bulog
echo "------------------------------------------------" |tee -a /usr/tmp/bulog
echo "Taking tape drive offline .............`date`" |tee -a /usr/tmp/bulog
mt -t /dev/rmt/0m offline &
echo "BACKUP COMPLETE! ......................`date`" |tee -a /usr/tmp/bulog
echo "------------------------------------------------" |tee -a /usr/tmp/bulog
echo "Backup log is /usr/tmp/bulog" |tee -a /usr/tmp/bulog
echo "Backup list is /usr/tmp/backuplist" |tee -a /usr/tmp/bulog
echo "Tape Verify list is /usr/tmp/tapelist" |tee -a /usr/tmp/bulog
"Do what you love and you will never work a day in your life." - Confucius
John Waller
Esteemed Contributor

Re: cpio error

Your commands should work fine , I've tried the exact same thing here on a 10.20 and also 11.00 system and it worked fine to a DDS drive (/dev/rmt/0m). Its a good point about the rewind option , but if that is OK then you make have a faulty drive or bad tape. Have you tried a different tape?
Wodisch
Honored Contributor

Re: cpio error

Hello,

are you really certain that you did not use any kind of
buffering on writing or reading, that being the most
common reason for that message in my experience.

do you get the same message, when you you try

dd if=/dev/rmt/cYtYd0 obs=64k | cpio -ictv

HTH,
Wodisch