mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 21:56:42 +00:00
fs-resize: simplify using parted's 3.2 'resizepart'
This commit is contained in:
parent
46f6d4e931
commit
2be09187dc
@ -36,31 +36,23 @@ if [ -e /storage/.please_resize_me ] ; then
|
|||||||
|
|
||||||
# just in case
|
# just in case
|
||||||
if [ ! -z "$DISK" -a ! -z "$PART" ] ; then
|
if [ ! -z "$DISK" -a ! -z "$PART" ] ; then
|
||||||
# get storage partition start
|
umount $PART
|
||||||
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 ?
|
echo "PARTITION RESIZING IN PROGRESS"
|
||||||
if [ ! -z "$PART_START" ] ; then
|
echo ""
|
||||||
umount $PART
|
echo "Please do not reboot or turn off your @DISTRONAME@ device!"
|
||||||
|
echo ""
|
||||||
|
|
||||||
echo "PARTITION RESIZING IN PROGRESS"
|
# identify the partition scheme, and if gpt fix minor issues such as gpt header not at end of disk
|
||||||
echo ""
|
SCHEME=$(blkid -s PTTYPE -o value $DISK)
|
||||||
echo "Please do not reboot or turn off your @DISTRONAME@ device!"
|
if [ "$SCHEME" = "gpt" ]; then
|
||||||
echo ""
|
StartProgress spinner "Checking layout... " "sgdisk -e $DISK &>/dev/null"
|
||||||
|
|
||||||
# identify the partition scheme, and if gpt fix minor issues such as gpt header not at end of disk
|
|
||||||
SCHEME=$(blkid -s PTTYPE -o value $DISK)
|
|
||||||
if [ "$SCHEME" = "gpt" ]; 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 countdown "Rebooting in 15s... " 15 "NOW"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
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
|
fi
|
||||||
reboot -f &>/dev/null
|
reboot -f &>/dev/null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user