Interesting patches for 4k drives w/ GPT
Stefan Bader
stefan.bader at canonical.com
Fri Feb 26 13:26:26 UTC 2010
Mario Limonciello wrote:
> Hi,
>
> Recently Colin Watson raised a bug (
> https://bugs.launchpad.net/bugs/511075
> <https://bugs.launchpad.net/bugs/511075>) to pull in Parted 2.1 for
> Lucid, particularly to be able to enable drives that use 4k sectors
> rather than 512 byte sectors. As this FFe has been approved, it would
> probably be a good idea to support it from the kernel side too. There
> are two patches related to using GPT with these types of drives from
> 2.6.33 that may be interesting to being able to support these drives:
>
> commit 87038c2d5bda2418fda8b1456a0ae81cc3ff5bd8
> Author: Karel Zak <kzak at redhat.com>
> Date: Mon Nov 23 09:29:58 2009 +0100
>
> partitions: read whole sector with EFI GPT header
>
> The size of EFI GPT header is not static, but whole sector is
> allocated for the header. The HeaderSize field must be greater
> than 92 (= sizeof(struct gpt_header) and must be less than or
> equal to the logical block size.
>
> It means we have to read whole sector with the header, because the
> header crc32 checksum is calculated according to HeaderSize.
>
> For more details see UEFI standard (version 2.3, May 2009):
> - 5.3.1 GUID Format overview, page 93
> - Table 13. GUID Partition Table Header, page 96
>
> Signed-off-by: Karel Zak <kzak at redhat.com>
> Signed-off-by: Jens Axboe <jens.axboe at oracle.com>
>
> commit 7d13af3279985f554784a45cc961f706dbcdbdd1
> Author: Karel Zak <kzak at redhat.com>
> Date: Mon Nov 23 09:29:13 2009 +0100
>
> partitions: use sector size for EFI GPT
>
> Currently, kernel uses strictly 512-byte sectors for EFI GPT parsing.
> That's wrong.
>
> UEFI standard (version 2.3, May 2009, 5.3.1 GUID Format overview, page
> 95) defines that LBA is always based on the logical block size. It
> means bdev_logical_block_size() (aka BLKSSZGET) for Linux.
>
> This patch removes static sector size from EFI GPT parser.
>
> The problem is reproducible with the latest GNU Parted:
>
> # modprobe scsi_debug dev_size_mb=50 sector_size=4096
>
> # ./parted /dev/sdb print
> Model: Linux scsi_debug (scsi)
> Disk /dev/sdb: 52.4MB
> Sector size (logical/physical): 4096B/4096B
> Partition Table: gpt
>
> Number Start End Size File system Name Flags
> 1 24.6kB 3002kB 2978kB primary
> 2 3002kB 6001kB 2998kB primary
> 3 6001kB 9003kB 3002kB primary
>
> # blockdev --rereadpt /dev/sdb
> # dmesg | tail -1
> sdb: unknown partition table <---- !!!
>
> with this patch:
>
> # blockdev --rereadpt /dev/sdb
> # dmesg | tail -1
> sdb: sdb1 sdb2 sdb3
>
>
>
Both of those are part of 2.6.32.9 which Andy will pull in after Alpha3 freeze
is done.
Cheers,
Stefan
More information about the kernel-team
mailing list