Re: mounting unpartitioned drives

Phillip Burr (
Fri, 20 Feb 1998 13:00:11 -0700

If what you are looking for is access to the whole physical drive and not
to just a partition, then you don't need to mount anything. Mounting gives
you access to a filesystem. If you want access to the whole drive then
I assume that you do not want the filesystem handled for you. There is,
in fact, a very easy way to access the 'whole disk'. If, for example, you
want to access the primary master ide HD, all you need to do is access
the file /dev/hda. There is nothing more to it. You can read it as you
would any other file. But remember, access through /dev/hda is on a
byte offset and not a sector offset. Therefore, if you wanted to read the
MBR, you would llseek to the beginning of the file and read in 512 bytes.
To read in Cylinder 0, Head 0, Sector 3, you would llseek (512*2) bytes into
the file (remember Sector is a 1 based number) and read in 512 bytes. If
you want to access everything in terms of CHS, you would have to
convert it into its appropriate LBA value.

I hope this really covers the point of what you were trying to do. It looked to
me that you were heading the wrong direction.

Phil Burr

> ...
>Why?? If I have not requested an access to any partition, but to the
>whole disk, there must not be any partition scan. And if the first
>sector does not end with "0x55aa" signature, the partition scan is
>always incorrect.
> Best regards, -- Vladimir.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to