Description of problem: GPT entries have a partition name. (Note this is different from any filesystem label which might be on the filesystem within the partition). https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_entries libguestfs doesn't handle this at all at the moment, but it is important for some ARM guests to get this right since u-boot on ARM may use partition names in order to locate the right kernel and root filesystem. When you use virt-resize on an ARM filesystem, the names are not copied across. Note that gdisk can read and write these names, and we are already using gdisk for other things (part-set-gpt-type, part-get-gpt-type). Version-Release number of selected component (if applicable): libguestfs 1.25.31. How reproducible: 100% Steps to Reproduce: $ rm -f test1.img $ truncate -s256M test1.img $ sgdisk -n 1:0:0 -c 1:TESTING test1.img $ sgdisk -p test1.img Disk test1.img: 524288 sectors, 256.0 MiB Logical sector size: 512 bytes Disk identifier (GUID): 781B2DA3-2B1F-4CB8-9974-554EDDE03E75 Partition table holds up to 128 entries First usable sector is 34, last usable sector is 524254 Partitions will be aligned on 2048-sector boundaries Total free space is 2014 sectors (1007.0 KiB) Number Start (sector) End (sector) Size Code Name 1 2048 524254 255.0 MiB 8300 TESTING ^ NOTE ^ $ rm -f test2.img $ truncate -s 512M test2.img $ virt-resize test1.img test2.img --expand /dev/sda1 Examining test1.img ... 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ --:-- ********** Summary of changes: /dev/sda1: This partition will be resized from 255.0M to 509.8M. ********** Setting up initial partition table on test2.img ... Copying /dev/sda1 ... Resize operation completed with no errors. Before deleting the old disk, carefully check that the resized disk boots and works correctly. $ sgdisk -p test2.img Disk test2.img: 1048576 sectors, 512.0 MiB Logical sector size: 512 bytes Disk identifier (GUID): 52C75C2E-0562-40E1-A420-54C6CF8997F3 Partition table holds up to 128 entries First usable sector is 34, last usable sector is 1048542 Partitions will be aligned on 2048-sector boundaries Total free space is 4285 sectors (2.1 MiB) Number Start (sector) End (sector) Size Code Name 1 2048 1046271 509.9 MiB 0700 primary ^ NOTE ^ Actual results: In the copy, partition names are changed to "primary". Expected results: Partition names should be preserved.
Actually it looks like the "CODE" field is wrong too. So that's another thing we need to preserve.
(In reply to Richard W.M. Jones from comment #1) > Actually it looks like the "CODE" field is wrong too. So that's > another thing we need to preserve. This has been fixed in libguestfs >= 1.25.33: https://github.com/libguestfs/libguestfs/commit/ef7ac043a640c0dc82260e97fb7ce1f438f7ee2d
https://github.com/libguestfs/libguestfs/commit/78c21ce912a9c251ade8e35b63e82e97c96236cd https://github.com/libguestfs/libguestfs/commit/820b87016794116c783bd224f2e776cfdf65108e https://github.com/libguestfs/libguestfs/commit/59eb9bff87895a2cd779890de73652cb2a0ce503 With the above commits, part of libguestfs >= 1.25.33, virt-resize preserves the labels of GPT partitions.