On Mon, Mar 02, 2015 at 09:13:11PM +0100, Karel Zak wrote: > On Mon, Mar 02, 2015 at 12:19:32PM -0400, Peter Cordes wrote: > > If libfdisk doesn't actually store anything after sector 33, it would > > be nice if it wrote a GPT to disk that that has sector 34 as the > > first-usable. > > I'm not sure, the common consensus is to use 1MiB offset for the > first partition -- then it does not make sense to define > FirstUsableLBA smaller, because the extra space between the first > partition may be interpreted as gap and later (inadvertently) > partitioned. If libfdisk-based tools depend on this to avoid showing the user there's partitionable space before the first partition, then they'll behave differently when editting GPT partitions written by other tools. (The widely-used parted sets FirstUsableLBA = 34, and I assume so do most others.) If that's just for the benefit of "other tools", then parted doesn't need this help. gparted doesn't seem to offer a way to create non-1MiB-aligned partitions even if you wanted to. (IDK about the CLI). If a tool doesn't try to enforce alignment, the 2nd partition a user creates could be un-aligned, if the first partition doesn't end on a 1MiB boundary. Anyway, IDK how useful this theoretical benefit is to anyone. > Note the I'm talking about default layout, your example with > --dump and restore is different -- sfdisk has to be able to > copy existing partition tables. > > BTW, the problem should be fixed in git tree, you have to --dump with > new sfdisk and then it will add "first-lba" number to scrit header. Ok, cool. It might not be hard to detect scripted partitions starting below 2048, but above 33, and set first-lba to the lowest number found. Or to 34, if a partition before 2048 is found at all. Requiring scripts to have a first-lba: 34 is a non-obvious extra step that might take some debugging time for someone generating a script from scratch in a program, rather than with sfdisk -d. > It would be better to learn partitioning tools to modify <englishlesson> teach </englishlesson> :) > FirstUsableLBA in GPT header. I'll probably implement it for v2.27 > fdisk, so creative users like you will be able to tune up their > partition tables :-) Yeah, neat. That could be useful either way, for setting to 2048 in other tables, as well. Thanks again for the quick response and getting a fix in. I'll use it to re-copy my partition tables now, before I'm booting from them. So it should be easy to fix anything that happens because of different UUIDs. -- #define X(x,y) x##y Peter Cordes ; e-mail: X(peter@cor , des.ca) "The gods confound the man who first found out how to distinguish the hours! Confound him, too, who in this place set up a sundial, to cut and hack my day so wretchedly into small pieces!" -- Plautus, 200 BC
Attachment:
signature.asc
Description: Digital signature