1834346 Members
2136 Online
110066 Solutions
New Discussion

problems with tar & gzip

 
Jerry_109
Super Advisor

problems with tar & gzip

Hello All,

I'm having problems restoring files from tape
( DDS4 ).
*******************************************
I used the following command to place file on tape via following script :

cd ; tar -cvf - . | gzip > /dev/rmt/0mn
*******************************************

*******************************************
I used the following script to place files on tape :
more /home/j4s9389/scripts/korn/targzip/targzip.sh
#!/usr/bin/sh
# Created 051205 - jls

TAPE=/dev/rmt/0mn
DIR=/home/j4s9389/scripts/korn/targzip

cd ${DIR}
cat /dev/null > targzip.out

for FILESYSTEM in `cat targzip.fs`

do
echo "Working on ${FILESYSTEM}" >> ${DIR}/targzip.out
cd ${FILESYSTEM} ; tar -cvf - . | gzip > ${TAPE}
if [ $? -ne 0 ]; then
echo "${FILESYSTEM} had a problem" >> ${DIR}/targzip.out
else echo "${FILESYSTEM} Completed OK" >> ${DIR}/targzip.out
fi
done
exit $0
#
*******************************************

*******************************************
I used the following command to restore data from tape :

# cd ; gunzip < /dev/rmt/0mn | tar tvf -
*******************************************

When I placed the data on tape, I received no errors., but when I restored from tape the restoration started fine, until have way through. Then I received the following errors :
x ./www/htdocs/ito_op/jre/lib/PA_RISC2.0/server/Xusage.txt, 1943 bytes, 4 tape blocks
x ./www/htdocs/ito_op/jre/lib/PA_RISC2.0/server/libjvm.sl, 10735616 bytes, 20968 tape blocks

gunzip: stdin: I/O error
Tar: error! blocksize changed
*******************************************

What did I do wrong ?

2 REPLIES 2
Steven E. Protter
Exalted Contributor

Re: problems with tar & gzip

Quite a slick command you are using but it make s me feel uneasy.

I would do the following.

tar the file
gzip the filed you tar

then copy to tape.

example.

tar cvf /tmp/network.tar /etc/
gzip /tmp/network.tar
tar /tmp/network.tar.gz

This will default and put the file on the default tape drive.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
H.Merijn Brand (procura
Honored Contributor

Re: problems with tar & gzip

1. Use gtar

# cd blah
# gtar -czv -b 40 -f /dev/rmt/0m .

2. use dd as buffer

# cd blah
# tar cvf - . | gzip -9 | dd bs=5120 of=/dev/tmt/0m

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn