On Tue, 2006-04-25 23:15:14 -0400, Doc Shipley <doc at mdrconsult.com> wrote:
Simply put, Linux (well, all the common Linux
filesystems) wants a
partition to end on a cylinder boundary. Two drives of different
geometries, even if they're the same size, will have differing block
counts per cylinder.
These days are gone. Long gone. The C/H/S layout of a disk isn't
meaningful since years. In early days, these represented physical
characteristics of a disk; operating systems had been programmed to
use these directly. As a result, eg. the well-known DOSsish partition
table evolved, that encoded the partition layout in C/H/S terms.
Disks got larger, which typically involved the cylinder count to rise
up. Unfortunately, the partition table as well as the ABI to the disk
controllers at that time only had 9 bits (1024 values, 0..1023) to
encode cylinder count, so something new had to be implemented.
That was when actually two things were done: the controllers
_internally_ started to not use C/H/S geometry to access the drive,
but linear addresses. (So all C/H/S values are converted to linear
addresses irrelevant of the operating system's access mode.)
Additional to that, fake plattern were simulated: there were 6 bits
(64 values, 0..63) reserved for heads, but no real disk would ever use
64 heads (famous last words...) So "newer" drives scaled their size
by claiming to have more hads than there are in reality, with the
result that the C/H/S addressing a "legacy" operating system is using
doesn't match the physical layout anymore.
Linux doesn't use the C/H/S values internally anymore, except for
reporting these legacy settings to the user once they're read out from
the drive. (Though, these values don't make much sense anyway.)
There is, unfortunately, one point in the boot-up phase where they are
still used: that's when the BIOS reads the partition sector (which
also contains the very first modifyable boot code). For legacy issues,
the partition table still contains C/H/S addresses and the BIOS honors
them. This is why, on "real" PeeCees, you'd keep your boot partition
below 8GB: 1024 Cylinders * 64 Heads * 256 Sectors * 512 Bytes.
[Note that there are bugs in many early BIOSes that will crash with
accesses beyond typically at limits beyond 2GB, 1GB or even 512MB.)
This basically means that all data the PC needs to start up (kernel,
boot code, extended partition table, initial ramdisk) needs to be
within the 8GB addressable limit. (To make things even worse, many
today's BIOSes implement non-standard extensions to allow access to
the full size of today's disks. This means that a disk which used to
work (as in: boot) in one machine won't neccessarily boot in a
different box.)
That means that if I do a block-level dd to a disk
with different
geometry from the source disk, the data will be valid, but the
partitions will probably not end on cylinder boundaries and the
filesystems will forever be inconsistent as far as the kernel and fsck
are concerned.
The cylinder boundary is only a legacy thing. With today's linear
addresses, that's no problem. Indeed, it's only needed due to DOS
bugs. A PeeCee'ish partition table allows partition boundaries not
matching a cylinder boundary, but DOS won't probably be happy with it.
Eg. if you use some Linuxish fdisk variant, they'll probably allow you
to create such partitions and possibly warn about them.
A different C/H/S layout (for disks of otherwise the same size) will
only matter in the boot-up phase, IFF the BIOS doesn't implement
extensions to just ignore the whole C/H/S stuff and use linear
addresses. For a real operating system (which uses it's own drivers
and not the BIOS callbacks), this doesn't matter at all.
And finally, people realized that the C/H/S layout is overcome:
There's a new standard (though not yet really implemented beyond the
scope of some Itanium or i386 Apple machines) called EFI (Extended
Firmware Interface) that fixes a lot of old time's shortcomings.
MfG, JBG
--
Jan-Benedict Glaw jbglaw at lug-owl.de . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
f?r einen Freien Staat voll Freier B?rger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));