From ec496d6155d889290b156040e2fad13208dd1fb9 Mon Sep 17 00:00:00 2001 From: Milos Jovac Date: Wed, 9 Oct 2019 15:39:38 +0200 Subject: [PATCH] Enable expand on eMMc module --- pishrink.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pishrink.sh b/pishrink.sh index ab77201..f2c2c44 100755 --- a/pishrink.sh +++ b/pishrink.sh @@ -181,18 +181,23 @@ cat <<\EOF1 > "$mountdir/etc/rc.local" do_expand_rootfs() { ROOT_PART=$(mount | sed -n 's|^/dev/\(.*\) on / .*|\1|p') + BLK_NUM=mmcblk0 PART_NUM=${ROOT_PART#mmcblk0p} if [ "$PART_NUM" = "$ROOT_PART" ]; then - echo "$ROOT_PART is not an SD card. Don't know how to expand" - return 0 + PART_NUM=${ROOT_PART#mmcblk1p} + BLK_NUM=mmcblk1 + if [ "$PART_NUM" = "$ROOT_PART" ]; then + echo "$ROOT_PART is not an SD card nor eMMc module. Don't know how to expand" + return 0 + fi fi # Get the starting offset of the root partition - PART_START=$(parted /dev/mmcblk0 -ms unit s p | grep "^${PART_NUM}" | cut -f 2 -d: | sed 's/[^0-9]//g') + PART_START=$(parted "/dev/$BLK_NUM" -ms unit s p | grep "^${PART_NUM}" | cut -f 2 -d: | sed 's/[^0-9]//g') [ "$PART_START" ] || return 1 # Return value will likely be error for fdisk as it fails to reload the # partition table because the root fs is mounted - fdisk /dev/mmcblk0 <