[Parted-maintainers] Bug#778712: libparted2: Breakage of RAID GPT header

jnqnfe jnqnfe at gmail.com
Wed Feb 18 21:05:29 UTC 2015


Package: libparted2
Version: 3.2-6
Severity: grave

libparted2 breaks my RAID GPT header!

There appears to be a disagreement between parted and fdisk as to the
correct size. fdisk is happy after creating a GPT partition table, but
parted is not and seems to be forcibly applying what it believes to be
correct (ignoring the fact that it was only asked to display info, not
modify anything). Having done so however parted is still not happy and
now neither is fdisk. Letting parted create the partition table just
leaves both unhappy, reporting the same issues.

In testing reproducibility of my issue here I deleted and recreated the
array, and proceeded to test as documented below, which explains things
more clearly.

**Please pay particular attention to what happened at the very end of
test #3, which is why I marked this as severity grave!

I would appreciate a quick turnaround on this issue, so I can get on
with actually using this RAID array without fear of breaking it simply
by running parted -l or opening gparted.

Background
=================
I have a 'fake-raid' RAID0 array, created from two HDDs using my
motherboard firmware. This is not used for root, just data.

sdb and sdc are the RAID members here and the RAID device is md126.

fdisk -l and parted -l output (cut down to only the devices in question)
generated during this procedure is attached.

Test#1 - gparted
=================
1) Deleted and recreated the RAID array (in MB firmware).
2) Checked fdisk -l and parted -l (see fdisk1 and parted1 output files).
fdisk is happy, parted only complains about unrecognised disk labels.
3) In gparted, with device md126 selected, I asked it to create a GPT
partition table. This was done with no errors reported.

gparted shows warnings for both sdb and sdc. The warning for sdc is just
an unrecognised disk label warning, but the warning against sdb is:
"Both the primary and backup GPT tables are corrupt."!

Checking fdisk -l, I see an "GPT PMBR size mismatch" error.

I created the fdisk2 and parted2 files at this stage.

For some reason fdisk now sees a device '/dev/sdb1', with size equal to
that of the full array. I had not created any partitions yet.

Test#2 - parted
=================
1) Deleted and recreated the RAID array (in MB firmware).
2) Checked fdisk and parted to make sure things had been reset
correctly, they were.
3) Ran: sudo parted /dev/md126 mktable GPT
This ran with no errors directly reported.
4) Checked parted -l, which reported the same corruption issue above
(see parted3).
5) Checked fdisk -l, which reported the GPT PMBR size mismatch error as
before (see fdisk3).

Test#3 - fdisk
=================
1) Deleted and recreated the RAID array (in MB firmware).
2) Checked fdisk and parted to make sure things had been reset
correctly, they were.
3) Ran: sudo fdisk /dev/md126
g (create a new empty GPT partition table)
v (verify) - no errors, looked good to me
w (write) - no errors:
"The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks."
4) Checked fdisk -l output, which looks absolutely fine (see fdisk4).
5) Checked parted -l. This still complains about a corrupt GPT header.
(See parted4).
6) Happened to check fdisk -l again, how it's reporting the GPT PMBR
size mismatch error from before (See fdisk5).

So it seems that the parted -l command here seems to have tried to
forcibly correct the issue it was unhappy with, breaking what fdisk
seemed to have done correctly.
-------------- next part --------------

Disk /dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/md126: 1.8 TiB, 2000381018112 bytes, 3906994176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 16384 bytes / 32768 bytes

-------------- next part --------------
GPT PMBR size mismatch (3906994175 != 1953525167) will be corrected by w(rite).

Disk /dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1           1 3906994175 3906994175  1.8T ee GPT

Disk /dev/md126: 1.8 TiB, 2000381018112 bytes, 3906994176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 16384 bytes / 32768 bytes
Disklabel type: gpt
Disk identifier: DE63532F-0214-43B7-9329-462908AD5B16

-------------- next part --------------
GPT PMBR size mismatch (3906994175 != 1953525167) will be corrected by w(rite).

Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1           1 3906994175 3906994175  1.8T ee GPT

Disk /dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/md126: 1.8 TiB, 2000381018112 bytes, 3906994176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 16384 bytes / 32768 bytes
Disklabel type: gpt
Disk identifier: 9E506ECB-2D2D-455B-A3FA-34FB5E59FC74

-------------- next part --------------

Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/md126: 1.8 TiB, 2000381018112 bytes, 3906994176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 16384 bytes / 32768 bytes
Disklabel type: gpt
Disk identifier: A0427F0B-BE15-4FDF-9770-63C2A3577965

-------------- next part --------------
GPT PMBR size mismatch (3906994175 != 1953525167) will be corrected by w(rite).

Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1           1 3906994175 3906994175  1.8T ee GPT

Disk /dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/md126: 1.8 TiB, 2000381018112 bytes, 3906994176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 16384 bytes / 32768 bytes
Disklabel type: gpt
Disk identifier: A0427F0B-BE15-4FDF-9770-63C2A3577965

-------------- next part --------------
Error: /dev/sdb: unrecognised disk label
Error: /dev/sdc: unrecognised disk label
Error: /dev/md126: unrecognised disk label

Model: ATA WDC WD1001FALS-0 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Model: ATA WDC WD1001FALS-0 (scsi)
Disk /dev/sdc: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Model: Linux Software RAID Array (md)
Disk /dev/md126: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

-------------- next part --------------
Error: Both the primary and backup GPT tables are corrupt.  Try making a fresh
table, and using Parted's rescue feature to recover partitions.
Error: /dev/sdc: unrecognised disk label

Model: ATA WDC WD1001FALS-0 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Model: ATA WDC WD1001FALS-0 (scsi)
Disk /dev/sdc: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Model: Linux Software RAID Array (md)
Disk /dev/md126: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start  End  Size  File system  Name  Flags


-------------- next part --------------
Error: Both the primary and backup GPT tables are corrupt.  Try making a fresh
table, and using Parted's rescue feature to recover partitions.
Error: /dev/sdc: unrecognised disk label

Model: ATA WDC WD1001FALS-0 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Model: ATA WDC WD1001FALS-0 (scsi)
Disk /dev/sdc: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Model: Linux Software RAID Array (md)
Disk /dev/md126: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start  End  Size  File system  Name  Flags


-------------- next part --------------
Error: Both the primary and backup GPT tables are corrupt.  Try making a fresh
table, and using Parted's rescue feature to recover partitions.
Error: /dev/sdc: unrecognised disk label

Model: ATA WDC WD1001FALS-0 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Model: ATA WDC WD1001FALS-0 (scsi)
Disk /dev/sdc: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Model: Linux Software RAID Array (md)
Disk /dev/md126: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start  End  Size  File system  Name  Flags




More information about the Parted-maintainers mailing list