Expanding storage capacity of OpenWrt using SquashFS

Hello, I'm using a squashfs image installation of OpenWrt on my NanoPI R2S, but I'm running low on storage space despite having a 32GB SD card. Can someone assist me in expanding the available storage without risking data loss or bootloops? If data loss is unavoidable, I'm still willing to follow the necessary steps.

I am also curious to understand, why does the default squashfs image come with so less space after install?

Here are the partition details:

Model: SD JULIE (sd/mmc)
Disk /dev/mmcblk0: 31.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      33.6MB  50.3MB  16.8MB  primary  ext2         boot
 2      67.1MB  176MB   109MB   primary

You can add new data partitions and still keep ability to upgrade OpenWRT.

I am new to this, can you please guide me? Currently I plan to do it on the running device itself if that is possible.

if you generate your own image, from scratch, you can define the size of the rootfs, but you'll have to create those images yourself "forever" ...

there's also a way of resizing the squashfs, not sure it works on the R2S though.

https://openwrt.org/docs/guide-user/advanced/expand_root

1 Like

https://openwrt.org/docs/guide-user/storage/usb-drives-quickstart
You do not need any USB drivers, just mount and filesystem utilities. Add new partition, initialize filesystem and automount.

This is the current status.

Read the wiki guide - add new partition, make it filesystem, automount newly made filesystem.

1 Like

Can i do something using cfdisk?

Yep - scroll to last free space and add new linux partition.

Should i choose primary or extended?

doesn't really matter.

you could have made it ~30GB.

now mkfs.ext4 /dev/mmcblk0p3

https://openwrt.org/docs/guide-user/additional-software/extroot_configuration

root@OpenWrt:~# mkfs.ext4 /dev/mmcblk0p3
mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: done
Creating filesystem with 2621440 4k blocks and 655360 inodes
Filesystem UUID: f8c98797-75e0-41ef-aed9-9e7d2a4efa38
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

Thanks a lot for helping out. Can i automount it via the luci interface?

Will this script work? I mean will it detect the unmounted partition and configure as exroot?

add it to /etc/fstab.

but it really depends on what you're going to use it for, I'd have used it for extroot, or extended the root partition instead.

Actually i am using AdGuardHome and running out of space for filter lists. I did place it in a directory named /opt in root.

image

ok, if it's only for the filters, I guess you can relocate them.

are you sure it's the disk you're running out of, not the RAM ?

Yeah its for the disk size. Am reaching the limits. In some cases the filterlists generate some txt.old files (bug with adgh) which get piled up over time unless manually removed.

How exactly? Can i do it via mount point gui?