fs-resize: simplify using parted's 3.2 'resizepart'

This commit is contained in:
mglae 2018-10-23 18:50:57 +02:00
parent 46f6d4e931
commit 2be09187dc

View File

@ -36,11 +36,6 @@ if [ -e /storage/.please_resize_me ] ; then
# just in case
if [ ! -z "$DISK" -a ! -z "$PART" ] ; then
# get storage partition start
PART_START=$(parted -s -m $DISK unit b print 2>/dev/null | grep -v ^/dev | grep -v BYT | grep ^2: | cut -f2 -d ":")
# failed to get partition start offset ?
if [ ! -z "$PART_START" ] ; then
umount $PART
echo "PARTITION RESIZING IN PROGRESS"
@ -54,13 +49,10 @@ if [ -e /storage/.please_resize_me ] ; then
StartProgress spinner "Checking layout... " "sgdisk -e $DISK &>/dev/null"
fi
StartProgress spinner "Deleting /storage... " "parted -s -m $DISK rm 2 &>/dev/null"
StartProgress spinner "Creating /storage... " "parted -s -m $DISK unit b mkpart primary $PART_START 100% &>/dev/null"
StartProgress spinner "Checking /storage... " "e2fsck -f -p $PART &>/dev/null"
StartProgress spinner "Resizing /storage... " "resize2fs $PART &>/dev/null"
StartProgress spinner "Resizing partition... " "parted -s -m $DISK resizepart 2 100% &>/dev/null"
StartProgress spinner "Checking file system... " "e2fsck -f -p $PART &>/dev/null"
StartProgress spinner "Resizing file system... " "resize2fs $PART &>/dev/null"
StartProgress countdown "Rebooting in 15s... " 15 "NOW"
fi
fi
fi
reboot -f &>/dev/null