24 lines
696 B
Plaintext
24 lines
696 B
Plaintext
|
# 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
|