Re: Changing the default CHS used by Linux partition editors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Theodore Tso wrote:
On Thu, Dec 11, 2008 at 04:57:40PM -0600, James Bottomley wrote:
The fatal flaw is that the C/H/S information is used by the msdos disk
label.  Change it on the fly and existing partition tables don't say
what they previously said (this isn't fatal, since the CHS geometry is
actually encoded in the partition table, so as long as you don't
repartition it's preserved).

Perhaps I wasn't clear.  I wasn't suggesting that we change things on
the fly, but for new partition tables, when there isn't a valid MSDOS
partition table we use a slightly smaller geometry.  The SCSI code
apparently tries to read the MS-DOS partition table and uses that to
return the geometry when requested by HDIO_GETGEO; I was proposing
changing the default when there isn't a valid partition table present.

The other flaw is that the 255/63/X C/H/S
is carefully crafted to let us limp to a 0.5TiB volume size with dos
labels.  If we change that to 255/56/X we can only limp to about 480GiB
meaning you won't be able to put a dos label on the new 0.5TiB SATA drives ... or rather you will (since we just silently truncate), but
you'll be surprised to learn your disk shrunk ...

Actually, the MSDOS partition table *can* support more than 0.5TB;
that's because no one really uses CHS fields any more.  So if the
number of cylinders are greater than 1023, the CHS field simply uses a
"fill" value of 1023 for the number of cylindrs.  For example:

Disk /tmp/foo.img: 255 heads, 56 sectors, 2097152 cylinders

Nr AF  Hd Sec  Cyl  Hd Sec  Cyl     Start      Size ID
 1 00   1   1    0 254  56   18         56     271264 83
 2 00   0   1   19 254  56 1023     271320  781258800 83
 3 00 254  56 1023 254  56 1023  781530120  646469880 83
 4 00 254  56 1023 254  56 1023 1428000000 2866967040 83

So yes, the 253/63/X C/H/S allows BIOS's from circa 2000 to limp to
0.5TB --- but modern BIOS's and OS's are perfectly capable of using
the MSDOS label to 2TB (when the 2**32 512-byte LBA field overflows),
and all that is necessary is to simply fill in a cylinder field of
1023 in the partition table, as shown in the above example of a 1TB drive.

The problems being described all come down to 4k sector disks pretending
to be 512b sector ones so as to remain "compatible" in windows.  In this
case it's hard to prevent a user doing the wrong thing since they
naturally use msdos labels and end up with the misalignment.  Note, we
can't even necessarily tell users to turn off windows compat mode on the
disks because most BIOSs aren't 4k ready and so can't boot properly
unless it's enabled.

Exactly, but by using a 255/56 C/S partitioning scheme for newly
installed systems, we'll do the right thing with Windows compat mode,
and as near as I can tell, with no downsides since BIOS's that still
require the use of C/H/S partitio table entries are ***highly***
unlikely to be using, let alone accepting, SATA drives with 4k sector
sizes.

						- Ted
More than a year back, I was the sacrificial Linux person invited to represent Linux at IDEMA. At that point, I seem to remember that Vista supported native 4k drives only on data partitions (non-boot) and that they required a 1MB alignment (no more odd 512 byte sector offsets).

I don't think that this is a hard problem to fix, just get someone to give us drives and we can work through the details (grub, etc)...

ric

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux