]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libfdisk: (gpt) don't offer first sector before the first partion
authorKarel Zak <kzak@redhat.com>
Mon, 10 Nov 2014 13:01:09 +0000 (14:01 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 10 Nov 2014 13:01:09 +0000 (14:01 +0100)
commit4a4616b22e21f3c05030dc05d98016fcb15a2ee9
tree527cd026534c7983b4081a6a17b875f8d8158523
parent8ccfcf70dad4e005d6fe05cd5ed99524a775f15d
libfdisk: (gpt) don't offer first sector before the first partion

The GPT first usable LBA is usually aligned to grain (1MiB), but for small
(<=4MiB) devices we strictly follow sector sizes.

In this case there is a small space in front of the aligned begin of
the first partition. This useless space should not be offered for the
next partitions.

Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 32768 bytes
Disklabel type: gpt
Disk identifier: 041E2D54-AD0C-4C7E-A50D-363D23058D47

Device    Start          End Size Type
/dev/sdb1    40         2087   1M Linux filesystem

Command (m for help): n
Partition number (2-128, default 2):
First sector (34-8158, default 2088):
                      ^^

first usable LBA is 34, but first aligned (recommended) LBA is 40, we
use it for the first partition. All this is correct, but the space
before the first partition should be ignored. Fixed version:

        Command (m for help): n
Partition number (2-128, default 2):
First sector (2088-8158, default 2088):
                      ^^^^

Note this problem does not exist for "normal" (large) devices where
first usable LBA is aligned to grain.

Reported-by: Boaz Harrosh <boaz@plexistor.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/gpt.c