Comment 3 for bug 1737556

Revision history for this message
John Fulton (jfulton-org) wrote : Re: Ironic python agent cleaning fails with invalid GPT

I found a non-interactive workaround but it requires you to ignore errors from the workaround command.

Reproduce the problem:

[root@overcloud-compute-1 ~]# sgdisk -Z /dev/disk/by-path/pci-0000:03:00.0-scsi-0:2:6:0
Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!

Warning! One or more CRCs don't match. You should repair the disk!

Invalid partition data!
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
[root@overcloud-compute-1 ~]# echo $?
2
[root@overcloud-compute-1 ~]#

Override earlier problem, though it unfortunately returns an error code:

[root@overcloud-compute-1 ~]# sgdisk --clear /dev/disk/by-path/pci-0000:03:00.0-scsi-0:2:6:0
Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!

Warning! One or more CRCs don't match. You should repair the disk!

Invalid partition data!
Information: Creating fresh partition table; will override earlier problems!
The operation has completed successfully.
[root@overcloud-compute-1 ~]# echo $?
2
[root@overcloud-compute-1 ~]#

Now -Z does not produce any error code:

[root@overcloud-compute-1 ~]# sgdisk -Z /dev/disk/by-path/pci-0000:03:00.0-scsi-0:2:6:0
Found valid GPT with corrupt MBR; using GPT and will write new
protective MBR on save.
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
[root@overcloud-compute-1 ~]# echo $?
0
[root@overcloud-compute-1 ~]#