Operating System - HP-UX
1834163 Members
2705 Online
110064 Solutions
New Discussion

how to restore a directory

 
Silvance Daniel
Occasional Contributor

how to restore a directory

How to restore a particular directory from DDS using tar command.
3 REPLIES 3
Sunil Sharma_1
Honored Contributor

Re: how to restore a directory

tar -xvf /dev/rmt/0m

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
Fred Ruffet
Honored Contributor

Re: how to restore a directory

tar xvf yourtape yourdir
for example to restore /home/bob from DDS in /dev/rmt/0m, use this :
tar xvf /dev/rmt/0m /home/bob

If it doesn't succeed, there may be option used for backup on the tar comand, such as block size. Provide backup command here, and we will help finding restore one.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Rodney Hills
Honored Contributor

Re: how to restore a directory

You need to determine if the tar save was done relative or absolute file paths.

tar tvf /dev/rmt/0m

will display the contents of the tape. If the path names begin with "/", then it is an absolute path and when you restore it, it will be placed back to its orginal place. You can override this by either using "pax" or gnu tar.

Whether it is an absolute or relative backup, just specify the directory you wish to restore in the same way as the paths are displayed by the above command.
eg-

tar xf /dev/rmt/0m /usr/bin
tar xf /dev/rmt/0m ./usr/bin
tar xf /dev/rmt/0m usr/bin

Even though it is the same directory above, the backup tape was created in 3 different ways.

tar cf /dev/rmt/0m /usr/bin
cd /
tar cf /dev/rmt/0m .
tar cf /dev/rmt/0m usr

HTH

-- Rod Hills
There be dragons...