1833381 Members
3793 Online
110052 Solutions
New Discussion

Re: backup

 
srinivasa rao vaddadi
Frequent Advisor

backup

can i restore 2 direcotories at same time from tape using tar ?

ex: /d1 and /d2 to be restore at same time
5 REPLIES 5
Cesare Salvioni
Trusted Contributor

Re: backup

hi
sure you can
tar xvf /d1 /d2

but iw ould suggest to NEVER use absolute path in storing files with tar cause hpux tar cannot change directory while restoring. I mean if you do something like:
tar cvf /dev/rmt/0m /users/me/dirtostore
you cannot simply restore in
/users/you/dirtostore
better do something like
cd /users/me; tar c ./dirtostore
last hint
tar store and restore recursively, so tar x /d1
will get everything on tape start with /d1

hope it helps
James R. Ferguson
Acclaimed Contributor

Re: backup

Hi:

Yes, absolutely. For example:

# cd /var/tmp/newdir
# tar -xvf /dev/rmt0m ./dir1 ./dir2

...would restore the directories "dir1" and "dir2" and their respective contents into /var/tmp/newdir. This assumes that your archive was created using relative paths -- which is usually very desirable when creating 'tar' archives. Use of relative paths gives you the flexability to recover (restore) things in places other than from where they came.

Regards!

...JRF...
Stuart Whitby
Trusted Contributor

Re: backup

Follow up to the answers rather than the question, as the question's already answered :)

Actually, you *can* restore absolute paths without overwriting the current contents of those directories, but it's a hassle.

chroot will create a new root directory for you to restore these from. However, you'll also need to copy in a bunch of other files to make the new root dir work correctly - /bin, /sbin, and I think /etc (long time since I did this).

I had a machine set up for this .... some years back when I was having to do a lot of recoveries of tar files from customer machines. I ended up creating a chroot dir on one machine where I'd restore stuff each time, exit from the chroot, then copy the files back to where I wanted them. Was very handy with things like (small) databases etc. We were running multiple customer databases for debugging on one machine, yet the standard install that we'd push out put them all in the same place.
A sysadmin should never cross his fingers in the hope commands will work. Makes for a lot of mistakes while typing.
srinivasa rao vaddadi
Frequent Advisor

Re: backup

thanq for all.
srinivasa rao vaddadi
Frequent Advisor

Re: backup

thnq for replying me.