Operating System - Linux
1830239 Members
2204 Online
109999 Solutions
New Discussion

Re: getting data off tape

 
SOLVED
Go to solution
keith evans_4
Occasional Contributor

getting data off tape

Suppose I had a tape with some tar'd backups on it. I tried to retrieve the backups, but put tar cv filename instead of tar xv filename. It gave an error saying 'tar: filename: No such file or directory'

When I correct it to xv, it just returns after a few seconds. Is my data on tape lost? Is there some way to retrieve this data? I failed to make 2 copies of the backup tape.

Can I dd the data off?

thanx,
keith
9 REPLIES 9
Steven E. Protter
Exalted Contributor

Re: getting data off tape

Scenario:

tar cv /etc/*

then

tar cv /sbin/*

The only thing thats going to be on that tape is the last archive, /sbin

If you did this:
tar cvf /tmp/net.tar /etc/*
tar cvf /tmp/sbin.tar /sbin/*

and then tar cv /tmp/*.tar

both files would be on the tape.

or:


tar cv /etc/*

then

tar rv /sbin/*

Both archives would be on the tape.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Huc_1
Honored Contributor
Solution

Re: getting data off tape

one way to know what data is on the tape is to
do the following

#mt -f /dev/st0 rewind
#tar -tvf /dev/st0

this should tell you what you have on tape

If you got the error 'tar: filename: No such file or directory' my guess is you stil have your info, but I am confused because, if you use a tape your command should have been something like

#mt -f /dev/st0
#tar -xvf /dev/st0
this would extract all the file on the tape

#tar -xvf /dev/st0 /somefile/blabla
this would extract /somefile/blabla if it exists.

<< but put tar cv filename instead of tar xv filename

sound like your mixing filename (like example.tar) with device name (like /dev/st0)

but, then it could just be me understanding it wrongly ?

Tell us if this helps, and perhaps the exact sequence of input,output and error, if you need futher assistance.

J-P
Smile I will feel the difference
Stuart Browne
Honored Contributor

Re: getting data off tape

For the record 'file -s /dev/nst0' is your friend. It will tell you what type of file is at the given device. Rewind the tape, run the above, see what it says. If it says it's not a tar archive, then you're in trouble.

You could try recovering it using 'dd', but that will get messy, fast. Depends on how desperate you are to get the data.
One long-haired git at your service...
Martin P.J. Zinser
Honored Contributor

Re: getting data off tape

One other thing you might need to experiment with is the -b (locksize) factor for tar. 10240 is popular, but other values are possible too.
Mark Grant
Honored Contributor

Re: getting data off tape

Whether the "cv" broke your backup will depend entirely on whether the filename was available on your hardrive when you did it. If the filename path was not on your machine, the "tar cv" would have failed before it wrote to the device. If the filename path was available you would have a nice new shiny backup of your file which would have destoyed your backup. I reaalise that you did actually get an error but if "filename" that you typed was e.g data* then the explanation above would apply to the first file in the list.

SEP's explanation above on how to get multiple "tar" sessions on a tape is an extremely useful method but there is another method which people often forget and is sometimes more appropriate.

tar to tape and then use "mt" to position the tape head to the end of your backup using the "fsf" argument and then do another tar backup, rinse and repeat. You can then pick which tar archive to restore by using the same command several times (or with a count) to get to the particualr archive you want. Then "tar xv"
Never preceed any demonstration with anything more predictive than "watch this"
keith evans_4
Occasional Contributor

Re: getting data off tape

I tar'd a bunch of files into a big tar file and then tar'd that big file into the tape. When I tar'd it off to verify that it was written to tape, I thought I had done a tar xv filename. This is on UNIX/Solaris machine.

The file command only works on files.

I am desparate to get the data off. It's several years of processed data. How should I use the dd command?

thanx,
keith
Mark Grant
Honored Contributor

Re: getting data off tape

Keith,

If you did "tar cv" with one filename and you got the a "No such file" error, then the tar cv did not break your backup.

However, assume for a moment it did. You MIGHT be able to retrieve data off the tape despite the problem of "tar xv" not finding anything by moving the tape head over the end of the suspected small tar archive at the front of the tape. Use "mt -f device fsf 1". You must use a no rewind device! Try your tar xv again. Failing this, instead of using tar, try and get the data off with "dd". If it is a tar of tar files and you are desperate enough, you might be able to edit the result of dd to get individual tar archives out of it.
Never preceed any demonstration with anything more predictive than "watch this"
Martin P.J. Zinser
Honored Contributor

Re: getting data off tape

Hi Keith,

It would be helpfull if you could give us the
<> commands you used to create the tape in the first place and exactly which commands you used yet.

One more thing, if the tar archive was created with absolute paths it will recreate the files
on disk with exactly this path, i.e. anything you have there right now with the same name will be overwritten. So maybe a tar tv would be a good idea first.

Greetings, Martin
Stuart Browne
Honored Contributor

Re: getting data off tape

.. and the 'file' command (with the -s argumnent) doesn't just work on files, but on device nodes.
One long-haired git at your service...