After OpenWrt installation on a 8GB sd card I noticed that I only had 104 MB of disk space left for future software installation. The file system was only using a fraction of the 8GB so I needed to expand the size of the partition as well as for the file system.
Boot up your openwrt device and perform the following steps from CLI.
First of all and just to be safe, remove all external disks attached.
Install software (preferably via Luci):
opkg lsblk parted resize2fs tune2fsNow lets gather information about block devices:
lsblk
sda                   179:0    0 8G   0 disk   
├─sda1                179:1    0   16M   0 part
├─sda2               179:2    0   104M  0 part /  
Now lets enter to parted and Resize Partition
parted
p
Number  Start   End     Size    Type      File system  Flags
1      33.6M   50.3MB  16.8MB  primary   ext2         boot
2      67.1MB  104MB   104MB   primary
resizepart 2 8GB #Decide how much you want to expand according to sd card capacity
qResizing the file system
Remount root as read only:
mount -o remount,ro / Remove reserved GDT blocks:
tune2fs -O^resize_inode /dev/sda2Fix part, answer yes to all. This will remove GDT blocks remnants.
fsck.ext4 /dev/sda2Now reboot, log back in again and then resize the partition:
Expand root filesystem
resize2fs -f /dev/sda2To apply changes, reboot  the system again and finish.Sources
https://openwrt.org/docs/guide-user/installation/installation_methods/sd_card#fn
https://openwrt.org/docs/guide-user/installation/openwrt_x86#resizing_filesystem
https://openwrt.org/toh/friendlyarm/nanopi_r4s_v1#installation


Leave a Reply