Expanding root partition and filesystem (x86 ueif ext4)

Hello,

I installed OpenWrt on an x86 system using the generic-ext4-combined-efi.img.gz installation image.

After installation, here's the disk information where OpenWrt is installed:

sda 8:0 1 14.3G 0 disk
└─sda1 8:1 1 14.3G 0 part
nvme0n1 259:0 0 232.9G 0 disk
├─nvme0n1p1 259:1 0 16M 0 part /boot
│ /boot
├─nvme0n1p2 259:2 0 104M 0 part /
└─nvme0n1p128 259:3 0 239K 0 part

The installed OpenWrt is not utilizing the full capacity of the disk (only 104MB used out of 256GB). To address this, I followed the automated script from [OpenWrt's expand_root documentation]
-https://openwrt.org/docs/guide-user/advanced/expand_root#automated -(https:// OpenWrt's expand_root documentation).

I am also creating an image with Image Builder and have implemented the script to be processed during image creation.

After applying the script, the disk space increased, but I encountered error messages in the log:

[ 306.468024] EXT4-fs (nvme0n1p2): error count since last fsck: 3
[ 306.474217] EXT4-fs (nvme0n1p2): initial error at time 1700119489: ext4_find_dest_de:1996: inode 73: block 586
[ 306.484737] EXT4-fs (nvme0n1p2): last error at time 1700119489: ext4_readdir:243: inode 85: block 598

I'm unsure how to resolve these errors.

Could you please assist or provide guidance on how to adjust the x86 generic-ext4-combined-efi.img.gz image to fully utilize the installation disk capacity without encountering these errors? :sob:

Thank you.

mount -o remount,ro /
fsck.ext4 -y /dev/nvme0n1p2
reboot
1 Like

Thank you for always answering! It's really helping me a lot~!! Let’s try it right now!

2 Likes

fsck.ext4 -y /dev/sda2
Fixed the error for me, thanks!
Perhaps we could add this to the automated script?

Another issue with the automated expand partition is if I leave a Memtest86 Plus USB stick plugged in the script tries to resize the partition on it, gets confused and reboots. This goes into reboot loop until I pull out the Memtest86 stick.
Pity there is no memtest for OpenWRT anymore.

you can put the memtest binary/image in the /boot folder of /dev/sda1, and add an entry in grub.

might need to extend the /dev/sda1 partition for it to fit though.