Resizing squashfs on SDcard steps

From wiki below are the steps I found.

  1. Are steps 2-5 all on the computer?
  2. on my sdcard there is a 20MB fat16 boot partition and a 104MB unknown partition
    Gparted does not let me resize the 104MB partition because it is unknown.
    What should i do?
squashfs image

To resize the squashfs-image one has to know the offset of the hidden f2fs filesystem. In this example, the squashfs partiton is /dev/sde2.

    1.You can find the offset, by running losetup on your openwrt device.
    2.On your computer, resize the squashfs partition, for example with cfdisk.
    3.Loop mount the underlying f2fs partition 2)

    losetup -d -o <offset> /dev/loop0 /dev/sde2

   4.Run filesystem checks

    fsck.f2fs /dev/loop0

   5. Resize f2fs filesystem

    resize.f2fs /dev/loop0

Now your filesystem should be recognized with the correct size.

Device : Nanopi R1 ( no EMMC ) 512 MB ram H3

I have not used those specific steps in the wiki but I think they can be done either on a linux / mac computer or on the OpenWrt device with the needed utilities installed.

A modified procedure works well run on NanoPi R4S routers with anaelorlinski builds or the standard OpenWrt builds which has a f2fs filesystem as the hidden writable filesystem in the squashfs image.

I found that using the imagebuilder to create an image with extra packages produces a squashfs image with a hidden ext4 filesystem after first boot so I successfully modified anaelorlinski's script to use the ext4 resizing tool.

Note that these "scripts" are a list of commands to be typed or pasted on the router command line one at a time. Do not copy/paste all of them at once and stop if you get an error.

Be sure to have your router configuration backed up before doing this and also have the list of any manually installed packages saved on your computer (someplace off the sd card you are modifying).

In case you are not aware, everything on the sd card gets wiped out with each sysupgrade so your filesystem expansion needs to be redone and all the data needs to be restored from backups etc.

1 Like
In case you are not aware, everything on the sd card gets wiped out with each 
sysupgrade so your filesystem expansion needs to be redone and all the data needs 
to be restored from backups etc.

I didnt realize that , thx for the warning.

1 Like