Subject: bug#68379: [resizepart] GPT table relocation during partition resizing

From: Andrea Da Col <[email-masked]>
Date: Thu, 11 Jan 2024 07:58:17 +0000

Good morning,

We are dealing with the following status:

~> sudo sgdisk -p /dev/sda
Disk /dev/sda: 60538881 sectors, 28.9 GiB
Model: DataTraveler 3.0
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): DB25F93B-B36F-46DE-A10D-D5D5BA500CE8
Partition table holds up to 128 entries
Main partition table begins at sector 8192 and ends at sector 8223
First usable sector is 8224, last usable sector is 60530657
Partitions will be aligned on 8-sector boundaries
Total free space is 57902538 sectors (27.6 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1           16384           59979   21.3 MiB    0700  boot
   2           65536          114831   24.1 MiB    0700  bootfs_A
   3          122880          988179   422.5 MiB   8300  rootfs_A
   4          991232         1040527   24.1 MiB    0700  bootfs_B
   5         1048576         1913875   422.5 MiB   8300  rootfs_B
   6         1913880         2254665   166.4 MiB   8300  datafs
   7         2254672         2595457   166.4 MiB   8300  varfs
   8         2595464         2660999   32.0 MiB    8300  appfs

As you can see, we have GPT not at the beginning of the disk, but we have relocated it at sector 8192 (architectural needs). We need to resize appfs partition to take all free space. So:

~> sudo parted /dev/sda
GNU Parted 3.4
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) resizepart
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of
the space (an extra 8190 blocks) or continue with the current setting?
Fix/Ignore? Ignore
Partition number? 8
End?  [1362MB]? 100%
(parted) q
Information: You may need to update /etc/fstab.

~> sudo sgdisk -p /dev/sda
Disk /dev/sda: 60538881 sectors, 28.9 GiB
Model: DataTraveler 3.0
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): DB25F93B-B36F-46DE-A10D-D5D5BA500CE8
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 8224, last usable sector is 60530657
Partitions will be aligned on 8-sector boundaries
Total free space is 32880 sectors (16.1 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1           16384           59979   21.3 MiB    0700  boot
   2           65536          114831   24.1 MiB    0700  bootfs_A
   3          122880          988179   422.5 MiB   8300  rootfs_A
   4          991232         1040527   24.1 MiB    0700  bootfs_B
   5         1048576         1913875   422.5 MiB   8300  rootfs_B
   6         1913880         2254665   166.4 MiB   8300  datafs
   7         2254672         2595457   166.4 MiB   8300  varfs
   8         2595464        60530657   27.6 GiB    8300  appfs

As you can see, the partition has correctly been resized, but the partition table has been relocated at sector 2. I am expecting the resizepart command would update the current GPT information without moving it.

Thank you all in advice
Best regards,

Andrea Da Col

____

Embedded SW Engineer

SECO S.p.A.
Via Achille Grandi, 20 - 52100 Arezzo, ITALY - VAT IT 00325250512
Ph.: +39 0575 26 979 - Fax +39 0575 350 210
www.seco.com<https://www.seco.com/>

 Le informazioni contenute nella presente e-mail e negli allegati sono strettamente confidenziali in conformità al D.lgs. n. 196/2003 e al Regolamento (UE) 679/2016, pertanto i soggetti non autorizzati non possono avervi accesso e/o farne uso. Per maggiori informazioni sul trattamento dei dati personali è possibile visitare la sezione Legal del nostro sito.

The information included in this e-mail and in the attachments are strictly confidential in compliance with Legislative Decree n. 196/2003 and Regulation (EU) 2016/679 and should not be accessed and/or used by unauthorized person. For further information on the processing of personal data see the Legal section of our website.