#1124312 libparted: Partition type is not updated after changing file system

Package:
libparted2-udeb
Source:
libparted2-udeb
Submitter:
Pascal Hambourg
Date:
2026-05-13 02:43:16 UTC
Severity:
normal
Tags:
#1124312#5
Date:
2025-12-30 11:02:45 UTC
From:
To:
Dear maintainer,

While testing a change in partman, I found out that setting a partition
filesystem type may not update the partition type ID accordingly as one
may expect in GPT and MSDOS partition tables.

Setting a partition filesystem type with ped_partition_set_system() is
supposed to update the partition type ID/GUID accordingly.

GPT partition table:
- FAT, NTFS, UDF -> PARTITION_BASIC_DATA_GUID (flag "msftdata")
- HFS -> PARTITION_APPLE_HFS_GUID (no flag)
...
- linux-swap -> PARTITION_SWAP_GUID (flag "swap")
- default (ext4, btrfs...) -> PARTITION_LINUX_DATA_GUID (no flag)

MSDOS partition table:
- FAT16 -> PARTITION_FAT16 (no flag)
...
- linux-swap -> PARTITION_LINUX_SWAP (flag "swap")
- default (ext4, btrfs...) -> PARTITION_LINUX (no flag)

This mechanism is overridden if the current partition type ID is not
related to a filesystem type (ESP, LVM, RAID...). However it appears
that it may also be overridden when the current partition type is
related to a filesystem type and has an associated parted flag:

- GPT partition table: PARTITION_BASIC_DATA_GUID, PARTITION_SWAP_GUID
- MSDOS partition table: PARTITION_LINUX_SWAP

As a consequence, partman may not update the partition type and flag
when changing the filesystem type. For exemple it may leave a swap or
ext4 partition with the "msftdata" flag, or a FAT or ext4 partition with
the "swap" flag.

A workaround in partman is possible, but I'd rather fix this in libparted.