Created
February 8, 2022 22:37
-
-
Save blizzardengle/50faf46fb384326fe259362c5bdc354e to your computer and use it in GitHub Desktop.
Resize the ext4 filesystem on OpenWrt after having resized the partition table.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
opkg update | |
opkg install losetup resize2fs | |
BOOT="$(sed -n -e "/\s\/boot\s.*$/{s///p;q}" /etc/mtab)" | |
DISK="${BOOT%%[0-9]*}" | |
PART="$((${BOOT##*[^0-9]}+1))" | |
ROOT="${DISK}${PART}" | |
LOOP="$(losetup -f)" | |
losetup ${LOOP} ${ROOT} | |
fsck.ext4 -y ${LOOP} | |
resize2fs ${LOOP} | |
reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment