Unmount the ephemeral drive before formatting it

HPCloud is instructing cloud-init to mount the ephemeral drives now via
metadata. This means that the disk will be mounted by the time d-g runs
previously resulting in a failed job due to the return 1. Instead of
erroring write a warning then unmount the ephemeral drive and format it.

Change-Id: I1c27e6728cccd13aaa03d782a7f6c27065e3447b
This commit is contained in:
Clark Boylan
2015-07-16 11:52:09 -07:00
parent a63d4764dd
commit 5a9565c8f7

View File

@@ -267,8 +267,8 @@ function fix_disk_layout {
local optdev=${DEV}3
if mount | grep ${DEV} > /dev/null; then
echo "*** ${DEV} appears to already be mounted"
mount
return 1
echo "*** ${DEV} unmounting and reformating"
sudo umount ${DEV}
fi
sudo parted ${DEV} --script -- mklabel msdos
sudo parted ${DEV} --script -- mkpart primary linux-swap 1 8192