1748169 Members
4125 Online
108758 Solutions
New Discussion юеВ

Re: Using TAR command

 
SOLVED
Go to solution
Tiago Marques_2
Advisor

Using TAR command

Hi!!

I'm trying to restore an specific file from my DLT tape, using the tar command.

How do I specify the destination directory to restore this file??

Thanks!

Tiago
eestimq
7 REPLIES 7
Vincenzo Restuccia
Honored Contributor
Solution

Re: Using TAR command

#cd /directory
#tar xv ./...
Robin Wakefield
Honored Contributor

Re: Using TAR command

Hi Tiago,

It all depends how the files were backed up.

If you used relative pathnames, then cd into the directory before restoring.

If absolute, then, depending on the original directory, you could create a soft link from the old directory to the new directory before restoring.

Rgds, Robin.
Ravi_8
Honored Contributor

Re: Using TAR command

Hi,

just specify the file name to be extracted. If the path exist in the system where you are extracting, file will be extracted in that path, other wise system will create the extracting file's path.

never give up
Darrell Allen
Honored Contributor

Re: Using TAR command

Hi Tiago,

If you created the tar file using relative pathnames for the input files, tar will extract the files to locations relative to your current directory.

If you created the tar file using absolute pathnames for the input files, tar will extract the files to that absolute path.

An alternative for changing the extract destination for a tar file created with absolute pathnames is to use pax. An example is:

tar cvf /tmp/users.tar /home/users

tar xvf /tmp/users.tar
will extract files back to their original locations because the input file/dir was specified with an absolute pathname (/home/users)

pax -r -s,/home/users,/home/users2, -f /tmp/users.tar
will extract files changing /home/users to /home/users2

See the man page for more info.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
milaren
Super Advisor

Re: Using TAR command

hi,darrell,
when i exacute the following cmd,error occure.why ?thanks!

# pax -r -s,/testdb/test/,/testdb/testx,-f /ovdbf/bak.tar
pax: A replacement string was not added : An invalid trailing option was speci
Elmar P. Kolkman
Honored Contributor

Re: Using TAR command

Did you have a space between the last comma and the minus f? The -f is a different option from the -s with its replacement string...
Every problem has at least one solution. Only some solutions are harder to find.
milaren
Super Advisor

Re: Using TAR command

hi,Elmar P. Kolkman
you are right!
thank you very much!