bug#18329: mkpart clearing GPT attributes

"Brian C. Lane" <[email protected]>
Newsgroups gmane.comp.gnu.parted.bugs
Message-ID <[email protected]>
On Mon, Aug 25, 2014 at 01:52:07PM -0400, Scott Sullivan wrote:
> Parted version: 3.1.6-e38d-dirty
> 
> Summary: mkpart appears to be wiping out existing GPT attributes.
> 
> To reproduce, consider the below example of me reproducing this issue. It doesn't seem like Parted should be clearing out existing GPT attributes for other pre-existing partitions just by creating a new partition with mkpart.
> 
>  [root@sta-jenkins-slave-01 /opt/template-automation/distros]# lvcreate -L 10G -n test LVM
>   Logical volume "test" created
> [root@sta-jenkins-slave-01 /opt/template-automation/distros]# parted /dev/LVM/test -s mklabel gpt
> [root@sta-jenkins-slave-01 /opt/template-automation/distros]# parted /dev/LVM/test -s p free
> Model: Linux device-mapper (linear) (dm)
> Disk /dev/dm-38: 10.7GB
> Sector size (logical/physical): 512B/512B
> Partition Table: gpt
> Disk Flags:
> 
> Number  Start   End     Size    File system  Name  Flags
>         17.4kB  10.7GB  10.7GB  Free Space
> 
> [root@sta-jenkins-slave-01 /opt/template-automation/distros]# parted /dev/LVM/test -s mkpart lbah 0% 10%
> [root@sta-jenkins-slave-01 /opt/template-automation/distros]# parted /dev/LVM/test -s mkpart lbah 10% 20%
> [root@sta-jenkins-slave-01 /opt/template-automation/distros]# parted /dev/LVM/test -s p free
> Model: Linux device-mapper (linear) (dm)
> Disk /dev/dm-38: 10.7GB
> Sector size (logical/physical): 512B/512B
> Partition Table: gpt
> Disk Flags:
> 
> Number  Start   End     Size    File system  Name  Flags
>         17.4kB  1049kB  1031kB  Free Space
>  1      1049kB  1074MB  1073MB               lbah
>  2      1074MB  2147MB  1074MB               lbah
>         2147MB  10.7GB  8590MB  Free Space
> 
> [root@sta-jenkins-slave-01 /opt/template-automation/distros]# sgdisk -A 2:set:63 /dev/LVM/test
> Warning: The kernel is still using the old partition table.
> The new table will be used at the next reboot.
> The operation has completed successfully.
> [root@sta-jenkins-slave-01 /opt/template-automation/distros]# sgdisk /dev/LVM/test --attributes=2:show
> 2:63:1 (do not automount)
> [root@sta-jenkins-slave-01 /opt/template-automation/distros]# parted /dev/LVM/test -s mkpart lbah 20% 100%
> [root@sta-jenkins-slave-01 /opt/template-automation/distros]# sgdisk /dev/LVM/test --attributes=2:show
> [root@sta-jenkins-slave-01 /opt/template-automation/distros]#
> 
> 
> Can someone confirm this isn't expected behavior? I am happy to help with testing, on latest stable (3.2) or latest master if its useful. Our workaround for now is to globally re-apply the GPT attributes after creating all partitions.

Sadly, yes, this is how it currently works. I am surprised to see that
parted only tracks bit 0 and bit 2. The problem is that when it reads
the partition table it only copies the state of the bits it knows about
instead of making a copy of all of them.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.