1834187 Members
2715 Online
110064 Solutions
New Discussion

dd help

 
SOLVED
Go to solution
KPS
Super Advisor

dd help

Hi,

I'm looking to use dd to copy all files from a DAT Tape I have to a Filesystem I just built. Can I pipe the output of this tape to the filesystem name or do I have to unmount the filesystem and specify the target to be the Logical Volume? (I've seen mixed reviews in searching this answer out)

Also can anyone give me an example of what this command might look like?

I was going to try the following but I'm not sure if this would work???

dd if=/dev/rmt/0m of= bs=512
13 REPLIES 13
Pete Randall
Outstanding Contributor

Re: dd help

Ken,

My first question would have to be "how was the DAT tape produced". I don't think dd is going to read a tar or fbackup tape.


Pete

Pete
KPS
Super Advisor

Re: dd help

That's a good questions for an answer that I don't 100% know the answer to. What I do know is that it was not produced from fbackup, since I tried to frecover the data and it doesn't recognize the data or tape header.

I also tried to use cpio to view the data and that seemed to recognize the format.

My guess is that this backup was taken via dd or cpio.

A. Clay Stephenson
Acclaimed Contributor

Re: dd help

If cpio is able to list the files then you must use cpio.

It's possible that dd was used to reblock the output of cpio to make the device perform better.

You need to do a series of cpio 't' commands to get a consistant listing before you try to restore.

e.g.

cpio -ivt < /dev/rmt/0m
If you see messages suggesting 'c' then change to
cpio -icvt < /dev/rmt/0m

Next try
cpio -ivBt < /dev/rmt/0m
or
cpio -icvBt < /dev/rmt/0m

Here is an example of dd'ing reading in 100k blocks and outputting in 5K blocks feeding into a cpio with the 'B' (5K blocks) option.

dd if=/dev/rmt/0m ibs=100k obs=5k | cpio -icvBt

Only when you get a complete listing shoulf you then try the restore.


If it ain't broke, I can fix that.
KPS
Super Advisor

Re: dd help

Hi neither of those examples worked that were given but I appreciate them?

When I said I got results from trying to view what was on tape, I failed to mention that it began listing files, but then became illegible like the data was in some other format?



Any other ideas?
KPS
Super Advisor

Re: dd help

I also just found a thread that tells you to execute the "file" command to see what format the data was backed up. It is:

file - < /dev/rmt/0m

The above is telling me it cannot open.
A. Clay Stephenson
Acclaimed Contributor

Re: dd help

The file command won't help you here; it's for analyzing regular files.

The symptoms you are describing occur when the cpio blocking is incorrect. The first block is read but subsequent blocks are not in phase. You may also have control characters that are changing your display to a new character set.

Do this:
dd if=/dev/rmt/0m bs=1k count=1 of=/var/tmp/xx

od -tc -v -Ad /var/tmp/xx > /var/tmp/xx.od

Post xx.od and someone should at least be able to identify the format of your data. The idea is that we are extracting the first 1k of data and then outputting it in a readable format.


If it ain't broke, I can fix that.
KPS
Super Advisor

Re: dd help

Okay we'll try that thanks, but before we do is that all one line for that command?
KPS
Super Advisor

Re: dd help

0000000

The above is what I get after I run both commands you asked me to. After running the dd command and redirecting the data to a file of my choice in /var/tmp/xx, I was able to view that data and that is what I believe we're looking to restore. Would this mean that the data on this tape was therefore backed by dd or am I getting ahead of myself here??
A. Clay Stephenson
Acclaimed Contributor

Re: dd help

There is no way that the output of the command I gave you is simply 000000. Yes, you are getting ahead of yourself. DD is simply reading 1024 bytes from the first part of the tape. It knows nothing about formats. The octal dump was to help us identify the type of backup you have by looking for "magic" (that's an actual technical term) numbers and other identifying characteristics. When we know that, it's possible to proceed.
If it ain't broke, I can fix that.
KPS
Super Advisor

Re: dd help

Okay let's try this. Looks like I missed the second part of what you wanted me to do.


(See Attachment)


Thanks very much for the effort on this.
A. Clay Stephenson
Acclaimed Contributor

Re: dd help

It's multiple choice time. Please select the correct format from amoung these choices:
A) Oracle EXPORT
If it ain't broke, I can fix that.
Stephen Keane
Honored Contributor

Re: dd help

IF (and it is a big IF) the dd was a complete filesystem, then you would restore it be specifying the output file as the block special file (/dev/lvol/XXX) for the filesystem you think it is a backup of.

The safest way (if you have the space) is

(a) dd the entire contents of the tape into a temporary file. This will give you the size of the filesystem (if it is one) and you can fsck it!

(b) create a temporary fileystem of that size, rounded up to the nearest PE size.

(c) dd from the temporary file you created at (a) into the fileystem block special file (/dev/lvol/XXX) you used at (b).

that way if it isn't a dd of a complete filesystem, then you've only trashed a temporaty filesystem, not a real one!

A. Clay Stephenson
Acclaimed Contributor
Solution

Re: dd help

In case I wasn't being perfectly clear. This is not a backup; it's a very old Oracle export. It only has meaning as a database import medium. If you want to "restore" it then dd will work but your destination is not a filesystem raw device but a regular file.

dd if=/dev/rmt/0m bs=60k of=/xxx/yyy/myfile
If it ain't broke, I can fix that.