On 23/03/2026 at 19:49, Brian C. Lane wrote:
In a GPT partition table, when the file system type of a partition is set to
a Microsoft filesystem (ex: FAT) with ped_partition_set_system(),
gpt_partition_set_system() sets the partition type to
PARTITION_BASIC_DATA_GUID (Microsoft basic data partition type GUID),
resulting in the "msftdata" flag being set. As expected.
However when a partition has the PARTITION_BASIC_DATA_GUID type, if the
filesystem type is changed to a non-Microsoft filesystem (ex: ext4),
gpt_partition_set_system() does not reset the partition type to the
associated partition type GUID (ex: PARTITION_LINUX_DATA_GUID), resulting in
the "msftdata" flag still being set.
It is the same with the PARTITION_SWAP_GUID partition type.
This is caused by PARTITION_BASIC_DATA_GUID and PARTITION_SWAP_GUID being
included in skip_set_system_guids[]. Is there a reason for this or is it a
bug ? Shouldn't all filesystem-specific partition types be excluded from
this list ?
This isn't a bug. The partition GUID is only set at creation time, using
input from the user to pick the most appropriate type. But parted isn't
(and should not be) tracking filesystem changes and changing the GUID.
This does not match my observations:
- ped_partition_set_system() can set the 'msftdata' or 'swap' flag on an
existing partition, it just cannot clear it.
- ped_partition_set_flag() sets the 'msftdata' or 'swap' flag in
accordance with the detected filesystem when clearing the GUID type flag
(esp, raid...) on an existing partition. Easy to reproduce with parted.