Tom Uban wrote:
Because there aren't any raw disk devices, at least not by default
and my google searches on the subject confirmed this. Of course as
this thread has discussed, the meaning of raw I/O and the reasons
for it vary, so I'll clarify.
I am copying a 40GB disk to a 100GB disk and when finished, would
like to have the first 40GB of the 100GB disk match the original
40GB disk, bit for bit.
well, if you dd the base (unpartitioned) device on linux that's what
you'll get. the block caching will have no effect on your copy (except
perhaps to speed it up).
the raw device on unix is designed to eliminate the effects of caching
but in this case (a straight copy) the raw device on bsd unix and the
block device would yield exactly the same output.
Yes. By "raw I/O", I was meaning that I
don't want any interpretation
of the disk as a file system, etc. Under Un*x, the block device typically
requires that the disk be initialized with a filesystem,
I would disagree. the block device knows nothing about file systems.
the disk be mounted, etc.
again, I disagree. This is not the case.
The raw device provides access to the disk without any
of this and allows the disk to be initialized with a partition table
and filesystem...
the block device provides the same access.
I think you are attaching more semantics to the raw device (and the
block device) than are there.
The block device has a purpose which is outside the scope of this
discussion. When you read it with dd it acts just like the old
unix raw device.
In years past, on non-PC platforms, I too have done
this without any
difficulty. I believe that the heritage of the PC is throwing a wrench
into the works.
I don't see that.
By "intact", I mean that the bits on the
destination drive (at least
the first 40GB) match those which are on the source drive, identically.
ok. I think they didn't match because you used the wrong device nodes.
When I did the copy under linux, I used /dev/hda and
/dev/hdb as you
describe. Under NetBSD, I used /dev/rwd0d and /dev/rwd1d. Note that
the linux /dev/hda device entry is a "block" device and the NetBSD
/dev/rwd0d device entry is a "raw" (or character) device. As an old
Un*x kernel developer, this is what I meant by "raw I/O" -- sorry
for any confusion.
i've worked with block devices on *bsd, sunos, solaris and linux. I
think I get it.
if you did "dd if=/dev/hda of=/dev/hdb" you got what you asked for.
how did you determine it was not "intact"?
An update on my current results is that using NetBSD on
the raw
device was only slightly better than my results with linux. I am
guessing that this is due to a difference in where the copy terminated
at the end of the source drive due to a difference in cylinder/block
alignment or something. As of yet, neither method has produced the results
that I am looking for.
really? how are you defining success?
I thought that the IDE drives these days were just a
logical stream
of blocks and that disk geometry was no longer a consideration.
they are.
A reply on this thread by JBG seems to confirm this,
but perhaps there
is still some sort of translation going on due to the difference in
sizes of these two disks? I have noted that the 40GB disk is LBA
and the 100GB disk is LBA48.
that's just the size of the block number. if they are both LBA then they
are a stream of blocks.
Have you tried "dd if=/dev/hda of=/filesystem/file"?
That will (I promise) copy every block off the disk attached to /dev/hda
into a file. It is possible to confuse linux with kernel args which
force it to believe a bogus geometry, but I doubt you are doing that, so
the IDE subsystem is going make it's own determination as to the size of
the drive and give you every block there is.
After trying the G4U utility suggested by John, which
is really just
a nicely wrapped NetBSD boot with some simple tools that utilize
'dd' and such, it looks like my problem is that the 40GB drive has
some uncorrectable data errors in the middle of the disk and these
have been stopping the copy prematurely.
oh wait. you didn't mention that.
"dmesg" will show kernel messages and those should have been seen on the
console.
As the PC screen does not
allow scrollback and is only a small number of lines I had not
gathered that the completions were short and due to data errors
try "dmesg | more"
So it would seem that both linux and NetBSD are both
working similarly.
yes, errors can and probably will stop the copy.
I should probably just have erased this message (or read it all first).
sorry.
-brad