nix-community / disko

Declarative disk partitioning and formatting using nix [maintainers=@Lassulus @Enzime @iFreilicht]
MIT License
1.85k stars 197 forks source link

sgdisk behaves confusingly when specifying `partitions.${name}.start = "0M"` #702

Open nativerv opened 4 months ago

nativerv commented 4 months ago

partitions.${name}.start = "0M" causes sgdisk to begin at the start of next free space on disk, which crashes disko with confusing errors.

This is despite the manpage setting a distinction between plain 'N' as sector numbers and 'N[K/M/G]' as logical size/byte positions, and stating that '0' is the 'next free space' position, not 0 with a letter.

In any case it would be nice to have a check for start = '0*' (and possibly any intersections which fail too) in disko as the sgdisk is an implementation detail. Start should be 1M (or whatever is physically possible minimum considering GPT and such) or not specified for the first partition, with only size being specified.

Encountered errors for reference:

iFreilicht commented 1 month ago

It might be enough to implement this check by changing the type definition of start. A good example is the type of size just a few lines above.