Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to recover a file from tape

Status
Not open for further replies.

rankar

IS-IT--Management
Jul 30, 2001
60
US
Hi all, our servers are being backed up via tape using the tar -cvf command. What I need to know is how can I retreive a file from tape. I tried tar -xvf /dev/ht0 /etc/motd as a test but it would just hang, all suggestions would be helpful.
thanks,
rg
 
Just hang as in it didn't run through the tape or hang as in did nothing useful?

Try "tar tvf /dev/ht0 | more"

If that lists files, note how they are listed- if for example, they begin ./, you may need to do

tar -xvf /dev/ht0 ./etc/motd

Or if they list as //, then

tar -xvf /dev/ht0 //etc/motd

would be what you want (though I din't think Linux tar had these problems- those are typical of regular old Unix tar's behaviour).

Or, it may just be that /etc/motd is not on the tape even though you think it should be- if that's the case, tar will keep on reading until it hits eot, which might look like "hung" on a big backup.


But if you mean hang as in really doing nothing, are yu sure this device is working?


Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
This is the output from tar tvf /dev/ht0 -rw-r--r-- root/root 2147483647 2001-12-27 00:21:02 backup.tar

So it looks like all the filsystems being backed up are in this backup.tar file. Now if I wanted to get just one file from this file, would
tar xvf /dev/ht0 /backup.tar/etc/motd work?
 
Hi,

Yes 'tar xvf /dev/ht0 /backup.tar/etc/motd' should extract the single file /etc/motd from the /backup.tar archive on /dev/ht0. I.e. you use the full path to the file within the archive not just the archive name.

Regards
 
Looks to me like you would need to do something like this:

cat /tmp
tar xvf /dev/ht0 backup.tar
# now see what's in backup.tar
tar tvf backup.tar
cd /
tar xvf /tmp/backup.tar etc/motd

# or- safer -
cd /tmp
tar xvf backup.tar etc/motd
cd /tmp/etc
cat motd
# if it's what you want..

cp motd /etc/motd



Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top