Skip to content

Commit 5fcf3f0

Browse files
committed
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
1 parent 0889051 commit 5fcf3f0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ironic_python_agent/shell/write_image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ DEVICE="$2"
3636
# In production this will be replaced with secure erasing the drives
3737
# For now we need to ensure there aren't any old (GPT) partitions on the drive
3838
log "Erasing existing GPT and MBR data structures from ${DEVICE}"
39-
sgdisk -Z $DEVICE
39+
sgdisk -Z $DEVICE || sgdisk -o $DEVICE
4040

4141
log "Imaging $IMAGEFILE to $DEVICE"
4242

0 commit comments

Comments
 (0)