The man page says "The default value of size is as much as possible (until the next partition or end-of-device). A '+' can be used instead of a number for size, which also means as much as possible." However the source is setting FDISK_RESIZE_ENLARGE when you use a '+' for size; something not done for the default case? [1] I can't find any difference between the "+" and "-" in some empirical testing, but it would be good to clarify what's going on. [1] https://git.kernel.org/cgit/utils/util-linux/util-linux.git/tree/libfdisk/src/script.c#n1050
The "-" has no any meaning, it's just place-holder to support formats without delimiters, like "2048 - L *". Note that "-<num>" means reduce size. The unspecified size field means "follow the label driver default" -- it's usually all available space for a new partition. The "+" calls generic resize code if used for *already existing partition*, if the partition does not exist then it's the same as the previous case (driver default). For example: 2048 , , L 2048, -, L 2048, +, L all have the same meaning, for empty disk, but echo "2048, +, L" | sfdisk -N 1 /dev/sdb enlarge the first partition (-N 1) as much as possible. So, it depends on context, for empty disks where you create a new partitions (fdisk_add_partition()) it's always driver default, for existing partition it's about resizing (fdisk_set_partition()). Note that the parser in the script.c has no clue about the current disk layout, it's the reason why it sets fdisk_partition_end_follow_default() as well as FDISK_RESIZE_ENLARGE for alone "+". The final interpretation depends on used function (fdisk_{add,set}_partition()). Please, close if you have enough information :-) Thanks.
Created attachment 1059296 [details] clarification for sfdisk man page Thank you for the info. Do you think something like the attached patch might help clarify the sfdisk man page?
(In reply to Ian Wienand from comment #2) > Do you think something like the attached patch > might help clarify the sfdisk man page? Applied, thanks. https://github.com/karelzak/util-linux/commit/11aa2aa290d2d654d621bd4729b535234480734b The change will be available in f23.