From ae6055685c26f38e2aa50ac5e546bc84b1278597 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Wed, 26 Oct 2011 12:35:22 -0500 Subject: [PATCH] Always resize the root filesystem --- tools/get_uec_image.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/get_uec_image.sh b/tools/get_uec_image.sh index e9d708d..b903ad7 100755 --- a/tools/get_uec_image.sh +++ b/tools/get_uec_image.sh @@ -131,16 +131,17 @@ fi if [ $ROOTSIZE -gt 2000 ]; then # Resize the container qemu-img resize $IMG_FILE +$((ROOTSIZE - 2000))M +fi - # Connect to nbd and wait till it is ready - qemu-nbd -c $NBD $IMG_FILE - if ! timeout 60 sh -c "while ! [ -e /sys/block/$NBD_DEV/pid ]; do sleep 1; done"; then - echo "Couldn't connect $NBD" - exit 1 - fi +# Connect to nbd and wait till it is ready +qemu-nbd -c $NBD $IMG_FILE +if ! timeout 60 sh -c "while ! [ -e /sys/block/$NBD_DEV/pid ]; do sleep 1; done"; then +echo "Couldn't connect $NBD" + exit 1 +fi - # Resize partition 1 to full size of the disk image - echo "d +# Resize partition 1 to full size of the disk image +echo "d n p 1 @@ -152,8 +153,7 @@ a 1 w " | fdisk $NBD - fsck -t ext4 -f ${NBD}p1 - resize2fs ${NBD}p1 +fsck -t ext4 -f ${NBD}p1 +resize2fs ${NBD}p1 - qemu-nbd -d $NBD -fi +qemu-nbd -d $NBD