mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
doc: Add notes on how GPT works on 4k sector disks.
I used scsi_debug to create a 4k sector virtual disk: modprobe scsi_debug dev_size_mb=128 sector_size=4096 I then used 'gdisk' to create lots of partitions, and used 'hexdump' to examine what was written to disk.
This commit is contained in:
@@ -199,7 +199,9 @@ do_part_disk (const char *device, const char *parttype)
|
||||
*
|
||||
* - aligned operations are faster
|
||||
* - absolute minimum recommended alignment is 64K (1M would be better)
|
||||
* - GPT requires at least 34 sectors at the end of the disk.
|
||||
* - GPT requires at least 34 sectors* at the end of the disk.
|
||||
*
|
||||
* *=except for 4k sector disks, where only 6 sectors are required
|
||||
*/
|
||||
const char *startstr = "128s";
|
||||
const char *endstr = "-128s";
|
||||
|
||||
@@ -866,8 +866,19 @@ let () =
|
||||
let start =
|
||||
if parttype <> GPT then 512L
|
||||
else
|
||||
(* XXX With 4K sectors does GPT just fit more entries in a
|
||||
* sector, or does it always use 34 sectors?
|
||||
(* With 512 byte sectors, GPT looks like:
|
||||
* 512 bytes sector 0 protective MBR
|
||||
* 1024 bytes sector 1 GPT header
|
||||
* 17408 bytes sectors 2-33 GPT entries (up to 128 x 128 bytes)
|
||||
*
|
||||
* With 4K sectors, GPT puts more entries in each sector, so
|
||||
* the partition table looks like this:
|
||||
* 4096 bytes sector 0 protective MBR
|
||||
* 8192 bytes sector 1 GPT header
|
||||
* 24576 bytes sectors 2-5 GPT entries (up to 128 x 128 bytes)
|
||||
*
|
||||
* qemu doesn't support 4k sectors yet, so let's just use the
|
||||
* 512 sector number for now.
|
||||
*)
|
||||
17408L in
|
||||
|
||||
|
||||
Reference in New Issue
Block a user