andsens/ec2debian-build-ami — Issue #3: mkfs.xfs - force overwrite
Author: mpastor
Created: 2012-02-23 17:14:26+00:00
State: open

When EBS contains any fs you need the -f option to force overwrite:

diff --git a/tasks/create-volume b/tasks/create-volume
index bbd7bcd..e23b9ae 100755
--- a/tasks/create-volume
+++ b/tasks/create-volume
@@ -41,7 +41,7 @@ do
attachment_status=`ec2-describe-volumes | grep "ATTACHMENT $volume_id" | awk '{print $5}'`
done
echo "Formatting the device $device_path with $filesystem"
-mkfs.$filesystem $device_path
+mkfs.$filesystem -f $device_path
mount $device_path $builddir
echo "The EBS volume has been formatted and mounted"