1830024 Members
18138 Online
109998 Solutions
New Discussion

Restoring Tar Archive

 
SOLVED
Go to solution
ramesh_6
Frequent Advisor

Restoring Tar Archive

Hi Experts,

I have a tape which contains two different tar archives

When i did a tar -tvf these are the two files i found

ugsapp/file1.db
/c7sysna2/file2.db

I created a file system of around 10 Gigs (these two files are hug) and mounted it under /restore and started extracting the archives inside /restore

i did
#cd /restore
#tar -xvf /dev/rmt/0m

this created a directory by name "ugsapp" under /restore and extracted file1 perfectly. When it went to file 2 it created a directory under / and tried extracting the files to /c7sysna2. This failed due to write error as there was not enough space in / to hold the files.

Can someone help me in solving how to get the extract back onto /restore and avoid /
4 REPLIES 4
melvyn burnard
Honored Contributor

Re: Restoring Tar Archive

the reason it did this is that the second file is archived with an absolute path.
You can use pax to recover the file and remove the leading /
man pax
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Graham Cameron_1
Honored Contributor
Solution

Re: Restoring Tar Archive

Can't use tar to restore to a different directory, you can use pax though.
--
pax -irf /dev/rmt/0m # will allow interactivre rename
--
or you can use the -s switch to generate the output filename on the fly.
See man pax
-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
melvyn burnard
Honored Contributor

Re: Restoring Tar Archive

here is what I use when I get tapes sent in with /var as the leading absolute path.
pax -r -s ',//*var//*,,' -f /dev/rmt/0m
This removes the /var and places any subdirectories/files directly under my cwd
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Michael Steele_2
Honored Contributor

Re: Restoring Tar Archive

So try 'PAX' instead of 'TAR'. 'PAX' will translate both tar and cpio:
cd
pax -rv -s'/^\///'

http://forums1.itrc.hp.com/service/forums/parseCurl.do?CURL=%2Fcm%2FQuestionAnswer%2F1%2C%2C0x61d7506d69a7d711abdc0090277a778c%2C00.html&admit=716493758+1065617693443+28353475
Support Fatherhood - Stop Family Law