Fix for fatal error when GPT was used and only MBR was cleaned
You can generate this error if after having provisioned a node using GPT partitioning, you clean its MBR using say dd if=/dev/zero bs=1024 count=1 of=/dev/sda and then cleanup all Ironic/Bifrost informations to get it reprovisioned. In this case sgdisk -Z returns an error and last_error field in Ironic contains: Error writing image to device: Writing image to device /dev/sda failed with exit code 2 Caution: invalid main GPT header, but valid backup; regenerating main header\nfrom backup!\n \nInvalid partition data!\ Change-Id: Ib617737fff5e40cb376edda0232e0726d9c71231
This commit is contained in:
parent
0889051159
commit
5fcf3f066c
|
@ -36,7 +36,7 @@ DEVICE="$2"
|
|||
# In production this will be replaced with secure erasing the drives
|
||||
# For now we need to ensure there aren't any old (GPT) partitions on the drive
|
||||
log "Erasing existing GPT and MBR data structures from ${DEVICE}"
|
||||
sgdisk -Z $DEVICE
|
||||
sgdisk -Z $DEVICE || sgdisk -o $DEVICE
|
||||
|
||||
log "Imaging $IMAGEFILE to $DEVICE"
|
||||
|
||||
|
|
Loading…
Reference in New Issue