From 5a9565c8f746f4d514a2127860c79f5485a2c1bd Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Thu, 16 Jul 2015 11:52:09 -0700 Subject: [PATCH] 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 --- functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions.sh b/functions.sh index 36913aa3..fbd0395a 100644 --- a/functions.sh +++ b/functions.sh @@ -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