Operating System - HP-UX
1834602 Members
4336 Online
110069 Solutions
New Discussion

Re: Restoring the entire contents of a tape created using TAR

 
SOLVED
Go to solution
Andre Lemon
Regular Advisor

Restoring the entire contents of a tape created using TAR

I have a request to recover the contents of a
tape from a programmer that was created by another company using Tar, i can do it but i
would like to know of a better way, i am a new
HP-UX jr. admin.

I used tar -tf tape-device to get the contents
of the tape and got 20 files listed.

I then used tar -xvf tape-device -voi ./cht*
17 of the files started with this, however
only 4 were restored, the intertesting thing is that not the 1st 4 files but it did the files in a radom manner.

If i use tar -xvf tape-device -voi filename
for each indivual file on the tape it loads them all.

I am trying to learn....

I tried to create a file that contains the list
of each file on that tape and tried the following without luck

tar -xvf tape-device -voI loadlist
&
tar -xvf tape-device -voi -I loadlist

and nothing was loaded.

Am i doing something wrong?, please share your
wisdom and i will be thankful and will of course award points.

I will check back on monday, I am now going to
get back to the conversion from one EMC box to
another on our HP3000 MPE/ix systems..

Thanks

Andre'
6 REPLIES 6
PIYUSH D. PATEL
Honored Contributor
Solution

Re: Restoring the entire contents of a tape created using TAR

Hi,

I normally used to view the contents of the tape thro

#tar -tvf /dev/rmt/0m

If the contents of the tape shows the filename in the following format (relative path )
./datafile then you can restore the files anywhere you like ie. go to a particular directory where you want to restore /temp and then give
#tar -xvf /dev/rmt/0m
and your file will be restored as /tmp/datafile

If you have the files listed as
/datafile then it will get restored as /datafile only

You can also restore specific files by

#tar -xvf /dev/rmt/0m ./*.xls
#tar -xvf /dev/rmt/0m .

Piyush
Mike Hassell
Respected Contributor

Re: Restoring the entire contents of a tape created using TAR

Andre,

Looks like your trying to to overdue it a bit with your syntax. Here are some examples, so you can better understand tar syntax (note that the hyphen is not required):

tar tvf /dev/rmt/0m ; display the table of contents (t) from /dev/rmt/0m and produce verbose (v) output.

tar xvf /dev/rmt/0m ;
extract (x) the entire contents of the archive on tape /dev/rmt/0m to default destination.

tar xvf /dev/rmt/0m file ; extract (x) only file from the archive on tape /dev/rmt/0m to default destination.

Be sure to take a minute to review the man pages on tar as well as they will provide more detailed syntax:

man tar

Hope that helps.

-Mike
The network is the computer, yeah I stole it from Sun, so what?
Tim D Fulford
Honored Contributor

Re: Restoring the entire contents of a tape created using TAR

the above commands look ok if you drop the -voi bit

BE CAREFUL that the tar is not an absolute (i.e. /home/progs/...) if this is the case tar will restore them to exactly that path. If this is the case you will need to use pax to restore them relatively.

Tim
-
Arockia Jegan
Trusted Contributor

Re: Restoring the entire contents of a tape created using TAR

As Tim mentioned be careful when you untar the data if you created the tar file by using absolute path and don't want to overwrite the existing directories/files.

You can use GNU tar if you want to untar the files at your preferred directory.

Find the GNU tar utility here,

http://hpux.cs.utah.edu/hppd/hpux/Gnu/tar-1.13.25/
Frank Slootweg
Honored Contributor

Re: Restoring the entire contents of a tape created using TAR

Re the ./cht* part: If you use wild-card characters, i.e. in this case the star (*), you will have to escape them.

Why? Because if you don't, the *shell* will expand the pattern and only the *resulting* file names, i.e. the ones which *are* already on disk, will be passed to tar and extracted.

How? By putting the pattern bewteen normal single quotes, i.e.

'./cht*'

Andre Lemon
Regular Advisor

Re: Restoring the entire contents of a tape created using TAR

Thanks to you all, the answers provided helped,
i laughed at how simple it turned out to be.

I used tar -xvf $TWP_TAPE1 (our tape-device)

and all the files loaded, so i see that i was
making it harder than it needed to be. Thanks
again and i will add this to my lessons learned
about HP-UX.


Andre'