cancel
Showing results for 
Search instead for 
Did you mean: 

Using tar and pax commands

 
SOLVED
Go to solution
Kwahae_1
Regular Advisor

Using tar and pax commands

Hi,

A colleague used tar to backup a /apps/oracle/products/10g to tape using tar with absolute path. How can I restore this to a differnt directory eg /tmp/restore. Was told I could use pax but the syntax is confusing.

Any help?
Regards

5 REPLIES
Robert-Jan Goossens
Honored Contributor
Solution

Re: Using tar and pax commands

Hi,

# cd /tmp/restore
# pax -r -s '|/apps/oracle*||' -f /dev/rmt/0m

http://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1326158

Regards,
Robert-Jan
Kwahae_1
Regular Advisor

Re: Using tar and pax commands

This means if I want to restore files only in
/apps/oracle/products/10g
I should use
pax -r -s '|/apps/oracle/products/10g*||' -f /dev/rmt/0m

??

Re: Using tar and pax commands

>This means if I want to restore files only in
/apps/oracle/products/10g, I should use
pax -r -s '|/apps/oracle/products/10g*||' -f /dev/rmt/0m

You should replace that "*" by a "/" then this will restore the subdirectory tree into the current directory.
(I think Robert-Jan's and JRF's use of "*" is not valid for a RE, only for a File Matching Pattern.)

If you want /tmp/restore, you can use:
-s '|/apps/oracle/products/10g/|/tmp/restore/|'
Suraj K Sankari
Honored Contributor

Re: Using tar and pax commands

Hi,

For easy restore to anywhere do this steps

If I want to take backup or /etc then first
cd /etc
tar cvf /dev/rmt/0m .

it will take /etc into tape

Now when you want to restore /etc

Just go to the directory suppose /tmp
cd /tmp
mkdir etc
cd etc
pwd
/tmp/etc
tar xvf /dev/rmt/0m .

You can restore it anywhere.

Suraj
James R. Ferguson
Acclaimed Contributor

Re: Using tar and pax commands

Hi:

> Dennis: (I think Robert-Jan's and JRF's use of "*" is not valid for a RE, only for a File Matching Pattern.)

Yes, I agree. The manpages for 'pax' note that the substitution is performed using the Basic Regular Expression syntax used by 'ed'

Hence as Dennis noted:

# ... -s '|/apps/oracle*||'

...should be:

# ... -s '|/apps/oracle/products/10g/|/tmp/restore/|'
Regards!

...JRF...