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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restore from Sun to Linux

Status
Not open for further replies.

Phizzle

IS-IT--Management
Aug 2, 2001
40
US
I have a backup tape for our Sun box that contains 1 (albeit large) file I need to restore. However, the disk is bad on the sun box and I need to restore it elsewhere. I have a linux box on the network as well that I have access to. Is there a way to restore that file to the linux box either from the sun (I can still access it, just having problems restoring) to the linux or from the linux?
Better yet, can I drop it into a win box (we are going to convert the data to x86 once restored)??
Thanks in advance,
Phil
 
tar is completely portable.

If you've dd'ed the tape onto disk, you should be able
to 'tar tvf filename' to look at the index.

tar by default has a blocking factor of 20 (in 512 bytes increments) for both solaris and linux. If you dd in 10k blocks, and get something strange, perhaps the tape was written with a higher B option? I believe modern tar will also complain if the blocking factor is wrong when accessing the tape drive.

gene
 
I'm not very sure how to use the dd command to get the file off the tape...can you explain?

Thanks
Phil
 

Fist, put the tape read only (with whatever switch is on the cartridge.)

I assume you can access the drive on the Sun, usually /dev/rst0 or /dev/rmt0. (this would be the same special file that the tape was written to, so you could
look at the command that created the tape or perhaps it is written on the tape. If the special file name is different, it might be due to tape density or compression.

Suppose it is /dev/rst0.

I would first read in a few blocks to check it out:

% dd if=/dev/rst0 of=/tmp/output bs=10k count=1000

So this should read in the first 1000 blocks x 10520 bytes
and it will return something like:
1000+0 records in
1000+0 records out
which means 1000 full records read in with no partial reads.

So since the tar header is at the front of the file, you should be able to:

tar tvf /tmp/output

and it should spit out at least one tar index link like:

drwxr-xr-x 0/1 0 Feb 24 07:58 2006 ./
-r-------- 343/1 15 Feb 23 10:06 2006 ./thisdat
tar: tape blocksize error

The error is just because the tar image is truncated.

To dd the whole tamale:

dd if=/dev/rst0 of=/tmp/wholething bs=10k

Then you can run "tar tvf /tmp/wholething" to look at the table of contents of the file.

You then can move the file to linux, and
use "tar xf filename" to extract the whole thing,
or "tar xf filename PATTERN" to extract part.

read the tar man page.

BTW, if the tar output has a leading '/', then some
care must be taken to avoid overwriting existing files.

gene





 
Gene said:
BTW, if the tar output has a leading '/', then some care must be taken to avoid overwriting existing files.

Very true. You might also consider pax which has functionality to read tar files written with absolute pathnames (ie with a leading /) to relative paths (without the /). HTH.

 
Thanks for the help - when I do the test, I get...
read: Not enough space
0+0 records in
0+0 records out

Which brings me to another question - shouldn't I be able to mount the tape drive from a linux box? I have nfs running on the sun, but still get connection refused when I try to mount.

Thanks again,
Phil
 

No, a tape drive isn't like a cdrom, it doesn't look like a filesystem and can't be mounted.

try this:

dd if=/dev/TAPENAME of=/tmp/output bs=32 count=100

I believe either you have the wrong tape device or
the blocking (10K) was too big or there are multiple
files on the tape and the first one is just a tape mark.

Do you have how the tape was written? Either the script
or on the tape label?

gene
 
Ok - tried that - same results.

This was done via script. It is a system backup, however, I only need to recover our database .dat file.

Thanks again!
Phil
 
Do you have the script? Or can you paste in
the part that might invoke tar?

gene
 
tar -cvEbfx 20 /dev/rmt/0u /usr/root/exclude_file ./usr/root/._TAGFILE ./Mail ./TT_DB ./bin ./cdrom ./dev ./devices ./etc ./export ./fld644gsa ./home etc. etc. etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top