Adopting the solution for resizing root from openwrt expand_root guide #65
|
@ -97,6 +97,7 @@ PACKAGES="kmod-i2c-bcm2835 kmod-i2c-mux kmod-i2c-mux-pinctrl \
|
|||
luci-app-mwan3 luci-app-upnp \
|
||||
luci-proto-wireguard \
|
||||
luci-ssl-nginx luci-app-acme \
|
||||
f2fs-tools losetup parted \
|
||||
python3-ansible-core python3-ansible-core-src \
|
||||
python3-yaml \
|
||||
openssh-sftp-server tcpdump \
|
||||
|
@ -117,6 +118,7 @@ chmod 0400 files/etc/dropbear/authorized_keys
|
|||
mkdir -p files/etc/docker
|
||||
chmod 0750 files/etc/docker
|
||||
cp ${pwd}/daemon.json files/etc/docker
|
||||
cp ${pwd}/sysupgrade.conf files/etc
|
||||
mkdir -p files/etc/uci-defaults
|
||||
cp ${pwd}/defaults/* files/etc/uci-defaults
|
||||
|
||||
|
|
22
defaults/70-rootpt-resize
Normal file
22
defaults/70-rootpt-resize
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Copied from https://openwrt.org/docs/guide-user/advanced/expand_root
|
||||
|
||||
if [ ! -e /etc/rootpt-resize ] \
|
||||
&& type parted > /dev/null \
|
||||
&& lock -n /var/lock/root-resize
|
||||
then
|
||||
ROOT_BLK="$(readlink -f /sys/dev/block/"$(awk -e \
|
||||
'$9=="/dev/root"{print $3}' /proc/self/mountinfo)")"
|
||||
DEV_NAME=$(basename "${ROOT_BLK%/*}")
|
||||
[ ${DEV_NAME%%[0-9]*} == mmcblk ] || exit 1
|
||||
ROOT_DISK="/dev/${DEV_NAME}"
|
||||
ROOT_PART="${ROOT_BLK##*[^0-9]}"
|
||||
parted -l ---pretend-input-tty << EOI
|
||||
ok
|
||||
fix
|
||||
EOI
|
||||
parted -s "${ROOT_DISK}" resizepart "${ROOT_PART}" 100%
|
||||
mount_root done
|
||||
touch /etc/rootpt-resize
|
||||
reboot
|
||||
fi
|
||||
exit 1
|
23
defaults/80-rootfs-resize
Normal file
23
defaults/80-rootfs-resize
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Copied from https://openwrt.org/docs/guide-user/advanced/expand_root
|
||||
# Updated for f2fs using
|
||||
# https://github.com/anaelorlinski/OpenWrt-NanoPi-R2S-R4S-Builds/blob/main/docs/resize-f2fs.md
|
||||
|
||||
if [ ! -e /etc/rootfs-resize ] \
|
||||
&& [ -e /etc/rootpt-resize ] \
|
||||
&& type losetup > /dev/null \
|
||||
&& type resize.f2fs > /dev/null \
|
||||
&& lock -n /var/lock/root-resize
|
||||
then
|
||||
LOOP="$(losetup -n -O NAME | sort | sed -n -e "1p")"
|
||||
ROOT="$(losetup -n -O BACK-FILE ${LOOP} | sed -e "s|^|/dev|")"
|
||||
OFFS="$(losetup -n -O OFFSET ${LOOP})"
|
||||
LOOP="$(losetup -f)"
|
||||
losetup -o ${OFFS} ${LOOP} ${ROOT}
|
||||
fsck.f2fs -f ${LOOP}
|
||||
mount ${LOOP} /mnt
|
||||
touch /mnt/upper/etc/rootfs-resize
|
||||
umount ${LOOP}
|
||||
resize.f2fs ${LOOP}
|
||||
reboot
|
||||
fi
|
||||
exit 1
|
5
sysupgrade.conf
Normal file
5
sysupgrade.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
## This file contains files and directories that should
|
||||
## be preserved during an upgrade.
|
||||
|
||||
/etc/uci-defaults/70-rootpt-resize
|
||||
/etc/uci-defaults/80-rootfs-resize
|
Loading…
Reference in New Issue
Block a user