Finish expander
This commit is contained in:
@@ -1,3 +1,25 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
DEVICE_CHILD=$(findfs NAME="hassio-data")
|
||||
DEVICE_ROOT="/dev/$(lsblk -no pkname ${DEVICE_CHILD})"
|
||||
LAST_FREE_SECTOR=$(sgdisk -E ${DEVICE_ROOT})
|
||||
|
||||
# Need resize
|
||||
if [ $LAST_FREE_SECTOR -le 2048 ]; then
|
||||
echo "[INFO] No resize of data partition needed"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Resize & Reload partition
|
||||
echo "[INFO] Update hassio-data partition"
|
||||
sgdisk -d 6 -n 6:0:0 -c 6:"hassio-data" -t 6:"0FC63DAF-8483-4772-8E79-3D69D8477DE4" ${DEVICE_ROOT}
|
||||
sgdisk -v
|
||||
blockdev --rereadpt ${DEVICE_ROOT}
|
||||
|
||||
# Resize filesystem
|
||||
echo "[INFO] Resize hassio-data filesystem"
|
||||
e2fsck -y ${DEVICE_CHILD}
|
||||
resize2fs -f ${DEVICE_CHILD}
|
||||
|
||||
echo "[INFO] Finish hassio-data resizing"
|
||||
|
||||
Reference in New Issue
Block a user