Operating System - HP-UX
1834134 Members
2359 Online
110064 Solutions
New Discussion

Re: Extract files with TAR

 
SOLVED
Go to solution
Coolmar
Esteemed Contributor

Extract files with TAR

Hi folks,

I have a tape and I need to extract everything on it. However it was created with the absolute path...so tar tvf gives:
/dir/file
/dir/file2 etc

I don't want the files to be restored to /dir which a tar xvf will do. I want to redirect the extract to /dir2. Is this possible, and if so, how?

Thanks!
10 REPLIES 10
Patrick Wallek
Honored Contributor
Solution

Re: Extract files with TAR

pax can do this for you. Have a look at the pax man page as it gives examples of how to do this.
A. Clay Stephenson
Acclaimed Contributor

Re: Extract files with TAR

You've now learned why backing up using absolute paths is less than optimal. You are stuck if using tar (although chroot with a lot of work could fix you). It's much easier to use pax (which will read cpio and tar files) and use -s to substitute the old/new filename patterns. Man pax for details.
If it ain't broke, I can fix that.
Peter Godron
Honored Contributor

Re: Extract files with TAR

Sally,
pax or gnu tar should do the trick.
Avoid absolute path tar if possible.
Sorry.
Peter Godron
Honored Contributor

Re: Extract files with TAR

Sally,
harry also found another way (may be worth trying)
/usr/bin/cp /usr/sbin/static/tar /tmp
/usr/bin/dd if=file.tar | /usr/bin/chroot /tmp ./tar xf -

in
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x38d6cf38d6bdd5118ff10090279cd0f9,00.html

Regards
harry d brown jr
Honored Contributor

Re: Extract files with TAR

You can do so with "pax":

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=192383

live free or die
harry d brown jr
Live Free or Die
Coolmar
Esteemed Contributor

Re: Extract files with TAR

Thanks everyone! I didn't make these tapes, I just have to get the data off :0)
Peter Godron
Honored Contributor

Re: Extract files with TAR

Sally,
did you succeed in getting the data off the tape?
Thanks
Coolmar
Esteemed Contributor

Re: Extract files with TAR

I tried PAX and it worked great (thanks!) but then the tape got a "tape error 5". Actually many of their tapes, created in '95, have these tape error 5 errors. I have cleaned the drive a bunch of times but that doesn't even work. Don't know why they were not created with Fbackup or Data Protector...oh well, I guess they will be next time!
Bill Hassell
Honored Contributor

Re: Extract files with TAR

error 5 means I/O error. Almost always, this is a bad spot on the tape or the original tape was written on a dirty drive. Not much you can do about this as tar (and pax) have no resync or I/O recovery options.


Bill Hassell, sysadmin
Tim D Fulford
Honored Contributor

Re: Extract files with TAR

Hi

A long time ago I had problems with restoring data. We had similar errors (though I'm not 100% sure it was error 5). Anyway after trying it LOTS of times it did eventually extract. Whilst perseverance is not garenteed it can sometimes pay off!

If the data is really important there are companies that will (for a fee) extract data off tapes etc.

here is a company that might help

http://www.vogon-international.com/data%20recovery/tape_recovery-00.htm

Regards

Tim
-