raw disk copying?

Brad Parker brad at heeltoe.com
Tue Apr 25 19:15:51 CDT 2006


Tom Uban wrote:
>To my amazement, I discovered
>that linux does not have a raw disk I/O capability by default.

I'm not sure how you came to that conclusion, but if you met me
at a cocktail party I'd bet you a steak dinner that it did,
in fact, have raw i/o and dd should work to copy from one drive
to another.

There are issues with ide disks, of course, and what "raw i/o" means.
Others here can, I'm sure, speak more cogently but the issue surrounds
what linux things block "n" and how that maps to a particular
cylinder/head/sector on the disk and if linear block addressing is used
or not.

But with care you can certainly dd one disk to another.  I've done it
many times.  You can also dd one disk to a file.  I do that all the
time.  And then I dd it back to a disk of the same type and it works
fine.

>I tried using the block devices, but the resulting copy was
>not intact.

I don't know what "not intact" means.  You may have not use the "whole
disk" raw device.  If you used a partition device you won't get the
whole disk.  It depend on what version of the kernel you used.  2.2?
2.4?  2.6?

typically something like "/dev/hda" or "/dev/hdb" will give you the
whole disk.

>After doing a bit of searching, I discovered that
>there is some sort of rawio extension which allows a raw device
>to be associated with a block device, but it also said that dd
>would not work with this raw device due to buffer alignment
>issues vs. DMA. Go figure...

rawio is something else.

>My second attempt was with a NetBSD 3.0 install CD, exiting to
>the shell and trying dd from rwd0a to rwd1a. I know that back
>in the dark ages, this was possible, but apparently in these
>modern times things have changed. When I try to do this I receive
>a read only error on the /dev/rwd1a device

you're using a parition device again.  you got the raw character
device "rxxx" but wd1a is not the whole disk.  I'm guessing but 
I bet /dev/rwd1 might be.

-brad



More information about the cctech mailing list