Tom Uban wrote:
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, the disk be
mounted, etc. 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...
I think that you are making this far more complicated than it is.
Linux has two types of devices - block and character. Obviously block
devices communicate in fixed sized chunks while character devices are
everything else.
You can do anything you want to a hard disk using the /dev/hd* or
/dev/sd* block devices. When you access a hard disk in this way, there
is no filesystem interpretation or data structure interpretation at all.
It's just plain raw data. It might be buffered at some level, but it
is certainly not interpreted in any way.
Older Unix's may have allowed you to use a character interface to speak
to a hard disk to avoid buffering. Remember, Linux isn't technically
Unix. It is Unix-like.
Go read the list of devices .. there is no character mode access to
block devices, unless you write your own device driver to do it. The
standard set of major and minor numbers always have hard disks as block
devices - nothing else.
The issue of how to handle read errors is different .. dd isn't very
graceful about error handling. I would suspect that after a retry or
two it should clear up. I'm not sure if the kernel or the hardware
automatically retry for you, and at what point they give up.
Mike