gh-10: add script to grow root fs

Uses growpart from cloud-utils and supports ext4 and xfs
pull/15/head
Javi Fontan 10 years ago
parent 598fc14576
commit 382b3d602d

@ -0,0 +1,28 @@
#!/bin/bash
MOUNT_LINE=$(cat /etc/mtab | grep ' / ' | grep -v '^rootfs')
DEVICE=$(echo "$MOUNT_LINE" | cut -d' ' -f1)
FSTYPE=$(echo "$MOUNT_LINE" | cut -d' ' -f3)
DISK=$(echo "$DEVICE" | sed 's/.$//')
PARTITION=$(echo "$DEVICE" | sed "s|^$DISK||")
if [ -n $DEBUG ]; then
echo DEVICE: $DEVICE
echo FSTYPE: $FSTYPE
echo DISK: $DISK
echo PARTITION: $PARTITION
fi
growpart "$DISK" "$PARTITION"
case "$FSTYPE" in
ext2|ext3|ext4)
resize2fs "$DEVICE"
;;
xfs)
xfs_growfs /
;;
esac
Loading…
Cancel
Save