1833804 Members
2617 Online
110063 Solutions
New Discussion

tar restore

 
SOLVED
Go to solution
Eric Zumwalt_1
Occasional Advisor

tar restore

Hi,

I'm trying to restore the /usr directory from tape using tar but I want to restore it to a different directory. Could someone tell me the command to extract the /usr directory from tape to my /dumps directory.

Thanks,

Eric
HP-PB 100BT LAN/9000 driver install
13 REPLIES 13
Patrick Wallek
Honored Contributor

Re: tar restore

It depends on how it was backed up.

If it was done like:

# tar -cvf /dev/rmt/?mn /usr

Then you'll need to use pax and do some name substitution to do what you want. 'man pax' for more information.

If it was done like:

# tar -cvf /dev/rmt/?mn ./usr
or
# tar -cvf /dev/rmt/?mn usr

Then just do:

# cd /dumps
# tar -xvf /dev/rmt/?mn usr
or
# tar -xvf /dev/rmt/?mn ./usr
RAC_1
Honored Contributor

Re: tar restore

The tar backup taken with absolute names would be difficult to restore to some ther path.

GNU tar can take care of this. Get gnu tar and check if you can do that.

The crude method would be as follows.

cd /dumps

pax -rv -s '/^\///' < /dev/rmt/0m

Anil
There is no substitute to HARDWORK
Sundar_7
Honored Contributor

Re: tar restore

Hi Eric,

PAX is the way to go.

# mt -f /dev/rmt/0mn fsf 1

# cd /mnt

# pax -rvf /dev/rmt/0mn -s '|^\/|\./|'

Sundar
Learn What to do ,How to do and more importantly When to do ?
Eric Zumwalt_1
Occasional Advisor

Re: tar restore

what I did was,

cd /dumps
tar -xvf /dev/rmt/0m

My screen showed it extracting but when I looked in the /dumps directory I didn't see anything so I killed the process.

It was tar'd by this command

tar -cvf /dev/rmt/0m /usr
HP-PB 100BT LAN/9000 driver install
RAC_1
Honored Contributor

Re: tar restore

I missed this step in my posting.

mt -f /dev/rmt/0mn fsf 1

No points for this please.

Anil
There is no substitute to HARDWORK
Patrick Wallek
Honored Contributor

Re: tar restore

You'll HAVE to use either pax or GNU Tar in this case.
Sundar_7
Honored Contributor

Re: tar restore

oops ! sorry, I assumed it is a ignite-ux recovery tape. Please skip the mt command.
Learn What to do ,How to do and more importantly When to do ?
Patrick Wallek
Honored Contributor

Re: tar restore

By the way, I hope this is a development machine or this was a VERY Recent backup tape as you just overwrote part of your /usr stuff. Hopefully you won't suffer any ill effects from this.
Eric Zumwalt_1
Occasional Advisor

Re: tar restore

so even though I was in the /dumps directory when extracting the data it was really extracting into my current /usr directory?
HP-PB 100BT LAN/9000 driver install
RAC_1
Honored Contributor

Re: tar restore

That is because, you had taken backup with absolute path names.

You took it as tar -cvf /dev/rmt/0m /usr

You should have done tar -cvf /dev/rmt/0m ./usr OR usr

Anil
There is no substitute to HARDWORK
Sundar_7
Honored Contributor
Solution

Re: tar restore

Hi Eric,

Yes, your tar command effectively extracted the contents to /usr file system.

With tar,if you create the archive with absolute path, tar -xvf will always restore the contents to the absolute path. You will have to use pax or GNU tar.

Here, since you created the archive using the absolute path (tar -cvf /dev/rmt/0m /usr), tar -xvf will always restore the files to /usr.

How recent was the archive ? What prompted the need for restoring /usr file system from the tape ? were there any signification changes to the system after the archive was created (like installation of sw/patches etc).


-- Sundar.
Learn What to do ,How to do and more importantly When to do ?
Eric Zumwalt_1
Occasional Advisor

Re: tar restore

Well we needed some data from a different company. They had it stored on there /usr directory. So when I tried to extract that /usr directory it looks like it overwrote some directories in my /usr directory. like the bin and sbin directories. So now I'm going to have restore those.
HP-PB 100BT LAN/9000 driver install
Eric Zumwalt_1
Occasional Advisor

Re: tar restore

Anyone know where the license file is located? What directory? I went from Unlimited user license to a two user license.
HP-PB 100BT LAN/9000 driver install