diff options
| author | Giulio Fidente <gfidente@redhat.com> | 2018-08-08 12:16:19 +0200 |
|---|---|---|
| committer | Giulio Fidente <gfidente@redhat.com> | 2018-08-08 16:40:22 +0000 |
| commit | bc21b5b1404c269d000e1de6f9dce9c046f7d15d (patch) | |
| tree | a0277635fce436eae997ebd96e820810ddf9f92b /ironic_python_agent/shell | |
| parent | 667589bb007e144e37136e706c0b8196422b0344 (diff) | |
| download | ironic-python-agent-bc21b5b1404c269d000e1de6f9dce9c046f7d15d.tar.gz | |
Clear GPT and MBR headers with dd to avoid sgdisk CRC errors
This change adds a dd before the existing sgdisk -Z command to
workaround CRC verification errors.
Change-Id: Ia1ac4e1c0faf14ad4bb11c2a1c796c93ca8cb5e3
Closes-Bug: #1737556
Story: 1737556
Task: 11496
Diffstat (limited to 'ironic_python_agent/shell')
| -rwxr-xr-x | ironic_python_agent/shell/write_image.sh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ironic_python_agent/shell/write_image.sh b/ironic_python_agent/shell/write_image.sh index 165d7176..0a780490 100755 --- a/ironic_python_agent/shell/write_image.sh +++ b/ironic_python_agent/shell/write_image.sh @@ -36,7 +36,13 @@ 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 -o $DEVICE + +# NOTE(gfidente): GPT uses 33*512 sectors, this is an attempt to avoid bug: +# https://bugs.launchpad.net/ironic-python-agent/+bug/1737556 +DEVICE_SECTORS_COUNT=`blockdev --getsz $DEVICE` +dd bs=512 if=/dev/zero of=$DEVICE count=33 +dd bs=512 if=/dev/zero of=$DEVICE count=33 seek=$((${DEVICE_SECTORS_COUNT} - 33)) +sgdisk -Z $DEVICE log "Imaging $IMAGEFILE to $DEVICE" |
