diff --git a/buildroot-external/rootfs-overlay/etc/init.d/S00resize_sdcard b/buildroot-external/rootfs-overlay/etc/init.d/S00resize_sdcard new file mode 100755 index 00000000..1079c75f --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/init.d/S00resize_sdcard @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +echo "Resize data partition ..." +parted /dev/mmcblk0 unit % resizepart 2 yes 100% +echo "Resize partition done" + +partprobe /dev/mmcblk0 +sync + +echo "Resize data filesystem ..." +resize2fs /dev/mmcblk0p2 +echo "Resize filesystem done" + +chmod -x /etc/init.d/S00resize_sdcard + diff --git a/buildroot-external/rootfs-overlay/etc/init.d/S00resizefs_once b/buildroot-external/rootfs-overlay/etc/init.d/S00resizefs_once deleted file mode 100755 index 39cc5fb4..00000000 --- a/buildroot-external/rootfs-overlay/etc/init.d/S00resizefs_once +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# -# Auto resize root partition at first boot after init_resize -# - -start() { - printf "Starting resize2fs_once: " - ROOT_DEV=$(findmnt / -o source -n) && - resize2fs $ROOT_DEV && - rm /etc/init.d/S00resizefs_once && - echo "OK" -} - -case "$1" in - start) - start - ;; - *) - echo "Usage: $0 {start}" - exit 1 -esac - -exit $? diff --git a/buildroot-external/rootfs-overlay/etc/init.d/init_resize.sh b/buildroot-external/rootfs-overlay/etc/init.d/init_resize.sh deleted file mode 100755 index e792e123..00000000 --- a/buildroot-external/rootfs-overlay/etc/init.d/init_resize.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -set -e - -mount -t proc proc /proc -mount -t sysfs sys /sys -mount -t tmpfs tmp /run - -mount /boot -mount / -o remount,rw - -sed -i 's| init=/etc/init.d/init_resize.sh||' /boot/cmdline.txt -sync - -DEVICE="/dev/mmcblk0" -PARTNR="p2" - -CURRENTSIZEB=`fdisk -l $DEVICE$PARTNR | grep "Disk $DEVICE$PARTNR" | cut -d' ' -f5` -CURRENTSIZE=`expr $CURRENTSIZEB / 1024 / 1024` -MAXSIZEMB=`printf %s\\n 'unit MB print list' | parted | grep "Disk ${DEVICE}" | cut -d' ' -f3 | tr -d MB` - -echo "[ok] applying resize operation.." -parted ${DEVICE} resizepart ${PARTNR} ${MAXSIZEMB} -echo "[done]" - -partprobe $DEVICE - -umount /boot -mount / -o remount,ro -sync - -reboot