Merge branch 'feature/auto-expand-fs' into develop
This commit is contained in:
commit
b39222230f
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Resize SD card
|
||||
#
|
||||
|
||||
start() {
|
||||
printf "Resize data partition ..."
|
||||
parted /dev/mmcblk0 unit % resizepart 2 yes 100% &&
|
||||
partprobe /dev/mmcblk0 &&
|
||||
sync &&
|
||||
resize2fs /dev/mmcblk0p2 &&
|
||||
chmod -x /etc/init.d/S00resize_sdcard &&
|
||||
echo "[OK]"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
|
@ -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 $?
|
|
@ -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
|
Loading…
Reference in New Issue