Skip to content

Commit 8f5ed3e

Browse files
committed
Clear GPT and MBR data structures on disk before imaging
This patch clears all GPT and MBR data structures on the disk. GPT maintains its data structures at start and at end of the disk. Change-Id: I8d0b367755b568cb44f02f62b873659b4bea0f14 Closes-Bug: #1543339
1 parent e76390b commit 8f5ed3e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ironic_python_agent/shell/write_image.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ DEVICE="$2"
3535

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
38-
log "Erasing existing mbr from ${DEVICE}"
39-
dd if=/dev/zero of=$DEVICE bs=512 count=10
38+
log "Erasing existing GPT and MBR data structures from ${DEVICE}"
39+
sgdisk -Z $DEVICE
4040

4141
log "Imaging $IMAGEFILE to $DEVICE"
4242
qemu-img convert -t directsync -O host_device $IMAGEFILE $DEVICE

0 commit comments

Comments
 (0)