Always resize the root filesystem
This commit is contained in:
parent
ea442c1cb7
commit
ae6055685c
1 changed files with 12 additions and 12 deletions
|
@ -131,16 +131,17 @@ fi
|
||||||
if [ $ROOTSIZE -gt 2000 ]; then
|
if [ $ROOTSIZE -gt 2000 ]; then
|
||||||
# Resize the container
|
# Resize the container
|
||||||
qemu-img resize $IMG_FILE +$((ROOTSIZE - 2000))M
|
qemu-img resize $IMG_FILE +$((ROOTSIZE - 2000))M
|
||||||
|
fi
|
||||||
|
|
||||||
# Connect to nbd and wait till it is ready
|
# Connect to nbd and wait till it is ready
|
||||||
qemu-nbd -c $NBD $IMG_FILE
|
qemu-nbd -c $NBD $IMG_FILE
|
||||||
if ! timeout 60 sh -c "while ! [ -e /sys/block/$NBD_DEV/pid ]; do sleep 1; done"; then
|
if ! timeout 60 sh -c "while ! [ -e /sys/block/$NBD_DEV/pid ]; do sleep 1; done"; then
|
||||||
echo "Couldn't connect $NBD"
|
echo "Couldn't connect $NBD"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Resize partition 1 to full size of the disk image
|
# Resize partition 1 to full size of the disk image
|
||||||
echo "d
|
echo "d
|
||||||
n
|
n
|
||||||
p
|
p
|
||||||
1
|
1
|
||||||
|
@ -152,8 +153,7 @@ a
|
||||||
1
|
1
|
||||||
w
|
w
|
||||||
" | fdisk $NBD
|
" | fdisk $NBD
|
||||||
fsck -t ext4 -f ${NBD}p1
|
fsck -t ext4 -f ${NBD}p1
|
||||||
resize2fs ${NBD}p1
|
resize2fs ${NBD}p1
|
||||||
|
|
||||||
qemu-nbd -d $NBD
|
qemu-nbd -d $NBD
|
||||||
fi
|
|
||||||
|
|
Loading…
Reference in a new issue