Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tar query

Status
Not open for further replies.

Mushr00m

IS-IT--Management
May 6, 2002
38
MY
I need to copy a tar backup to a fs. The scenario is that inside the tar backup has multiple directory but need to extract to a single directory. can it be done?
 
Hi,
you can. First you have to now the the tree your tar file.
For example you need all files under /a/b/c
$ tar -xvf /dev/rmt<number> /a/b/c
Regards Boris
 
Boris,

I dun quite get you... I want all the file inside the tape to be extracted to the directory. I've tried cd to the directory that i wanted and executed the tar command. It ended up restoring to /. Thos direcroty in the tape are copy of fs I made before the the server crashes using tar command. These fs are important coz it contains fixes and patches for AIX from version 4.1.5. to 5.1. I really need these files.
 
Hi
If your tar backup is an absolute path backup and you want to restore the files from the backup in another dir then you will have to use the command pax.

Lets say that you have backed up /home using absolute path backup
# tar -cvf /dev/rmt0 /home

and you want to restore this in the dir /work then
using pax
# pax -rf /dev/rmt0 -s/home/work/p

-s/home/work/p does the dir change. It functions simillar to the vi search and change.
Check out the pax man page for more details

Cheers
 
What if your directory tree contains the following on tape:
/home/backup/files...

And I want to restore this to:
/new/files...

the pax command above didn't work.
Can you let me know how to do this
r
 
trying using a different deliminator for your substitution operation - pax uses same regexp rules as sed/ed so if you can use either:

pax -rf /dev/rmt0 -s !/home/backup/files!/new/files!p

or

pax -rf /dev/rmt0 -s /\/home\/backup\/files/\/new\/files/p

Where in above, have escaped each directory deliminator &quot;/&quot; to look like &quot;\/&quot;. I think the first example is easier to follow.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top