1834150 Members
2414 Online
110064 Solutions
New Discussion

tar file

 
SOLVED
Go to solution
peterchu
Super Advisor

tar file

I use the tar command to backup files to the tape , and set the error checking , if no error code then generate a file (success.$br_date) ,the below is the script , I also want to backup this file (success.$br_date) to the tape , ( because I found the tape already eject after it completed tar process ) , what can i do? thx

tar -cvf /dev/rmt/0m

if [ $? -eq 0 ] ;
then
echo SUCCESS Backup on $(hostname) from $br_sttime to `date "+%a %Y/%m/%
d %T"` ,Result is 0 >> /tmp/success.$br_date
5 REPLIES 5
Mark Grant
Honored Contributor
Solution

Re: tar file

Well, if you use the no-rewind device /dev/rmt/0mn, the tape will not rewind and eject. You can then do a second "tar" to backup the additional file. Use the normal device for the second backup.

However, to restore that file you will have to skip past the first backup using "mt -t /dev/rmt/0mn fsf 1" and then restore.

Never preceed any demonstration with anything more predictive than "watch this"
peterchu
Super Advisor

Re: tar file

thx reply , another question , how can I know whether the tape is still inside the drive or has been ejected from the drive , ( as I am in the remote site to do the testing ) ? thx.
Borislav Perkov
Respected Contributor

Re: tar file

Hi,
with

mt -f /dev/rmt/0m rewind > /dev/null
if test $? -eq 0
then
# tape is inside
# commands
fi

Regards
Steven E. Protter
Exalted Contributor

Re: tar file

tar tvf /dev/rmt/0m

If the tape is in the $? will be 0 if not, it will be not zero.

Crude but effective.

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
Mark Grant
Honored Contributor

Re: tar file

Or even

diskinfo /dev/rmt/0mn
Never preceed any demonstration with anything more predictive than "watch this"