2010-02-17 04:29:39

by Daniel Taylor

[permalink] [raw]
Subject: 4K disk block and disks larger than 2TiB bugs

In order to use disks larger than 2TiB on Windows XP, it is necessary to
use 4096-byte logical sectors in an MBR.

When this MBR is presented to Linux, as from a USB-attached disk shared
with an XP system, Linux cannot recognise the partition if the disk is
very large. The problem is that, while the storage for partition size
is properly 64-bit, in fs/partitions/msdos.c, among other places, there
are 32-bit intermediate variables, so the size is truncated. I can fix
the MBR case myself (and will submit a patch when I learn the format and
protocol from watching the list).

The larger problem is for EFI. There is a significant amount of hard-coded
assumption that LBAs are 512 bytes. It would help if I could work with the
designer to make (and test) the changes in a way that abstracts away the
size (I do know that the kernel always thinks of disks in units of 512-byte
blocks). I have seen attempts in the past to fix this problem, but the
patches
were rejected with erroneous comments about fixing it in user space. If the
kernel will not recognise the partitions, or assigns incorrect values to the
starting block and/or number of blocks, there is nothing that user space can
do with the disk, except notice the EINVAL responses.

I have not, yet, worked my way through the Apple partition to see what
state it is in.

Comments?


2010-02-17 09:25:48

by Christoph Hellwig

[permalink] [raw]
Subject: Re: 4K disk block and disks larger than 2TiB bugs

On Tue, Feb 16, 2010 at 08:14:27PM -0800, Daniel Taylor wrote:
> The larger problem is for EFI. There is a significant amount of hard-coded
> assumption that LBAs are 512 bytes. It would help if I could work with the
> designer to make (and test) the changes in a way that abstracts away the
> size (I do know that the kernel always thinks of disks in units of 512-byte
> blocks). I have seen attempts in the past to fix this problem, but the
> patches
> were rejected with erroneous comments about fixing it in user space. If the
> kernel will not recognise the partitions, or assigns incorrect values to the
> starting block and/or number of blocks, there is nothing that user space can
> do with the disk, except notice the EINVAL responses.

This should be fixed since commit 7d13af3279985f554784a45cc961f706dbcdbdd1,
which is included in Linux 2.6.32.