Expanding OpenWrt squashfs image (SDcard)

The rootfs will be live and any crash will broke it...
Next boot will not get it autorepaired and will give you in a unbootable state !
I have this issue too often on RPi.
You must then repair the uSD from another computer !

The good way is to have a ReadOnly rootfs, then block-mount and overlay will help to expand the storage.
In case of crash or power-fault, the rootfs will work and the overlay will be checked and auto-repaired...
The worst will only be an auto-reboot !

The two methods can be "mixed".
An image customized with image builder, which integrate block-mount and a f2fs overlay as a third partition (which can be resized at first boot) will be a great idea !

1 Like

F2FS is an overlay to the SquashFS. For EXT4 based images you are certainly right and likely that's vulnerable to powerloss-triggered-corruptions.

My understanding is, in case the F2FS-Overlay is damaged it will be checked (and fixed) at startup. Even if that fails, I expected the startup scripts to drop me to failsafe or at least run with just the SquashFS based read-only system.

I am not keen on intentionally corrupting the F2FS just to test it now, but perhaps that would be the way to clarify the behavior / confirm that assumption.

1 Like

You're right...
I do not seen the F2FS overlay from the given link.
But I agree with you it is the best way to handle crashes !

1 Like

I will make it more obvious and edit the post above.

Doesn't work for me unfortunately. Stuck at the resize2fs step.

Tried:

root@OpenWrt:~# resize2fs /dev/loop0
resize2fs 1.45.6 (20-Mar-2020)
resize2fs: Invalid argument while trying to open /dev/loop0
Couldn't find valid filesystem superblock.

Also tried:

root@OpenWrt:~# resize2fs /dev/mmcblk0
resize2fs 1.45.6 (20-Mar-2020)
resize2fs: Resource busy while trying to open /dev/mmcblk0
Couldn't find valid filesystem superblock.

Was able to expand using cfdisk, but stuck at the resize2fs and not able to move forward at this point. Using the ext4 image.

1 Like

Thank you for your post! :slight_smile:

I am using this image for RaspberryPi 4B and I had been trying to expand the /dev/mmcblk0p2 partition using this guide but without much luck.
I would like to just add my experience on resizing using cfdisk, since the Resize option -for some reason- was not available for /dev/mmcblk0p2.

So, these are the steps that I followed based on your post:


  1. ssh in the openwrt device

  2. Install the required packages

    opkg update
    opkg install cfdisk resize2fs
    
  3. Resize the partition

    cfdisk /dev/mmcblk0
    
    • To unlock the Resize option for the last (/dev/mmcblk0p2) partition:
      • Create a New - primary partition in the large free space after the last (/dev/mmcblk0p2) partition (leave default values)
      • Delete this partition you just created
    • Resize the /dev/mmcblk0p2 partition (leave the default values which will use all the unallocated space)
    • Write the changes
    • Quit
  4. reboot

  5. Resize the f2fs file-system

    resize2fs /dev/loop0
    
4 Likes

Wow these instructions were so good.

You're a legend

I've also had luck on some ext4 installs as well with these modified steps:

1. ssh in the openwrt device

2. Install the required packages

	opkg update
	opkg install cfdisk resize2fs tune2fs
	
3. Resize the partition

	cfdisk /dev/mmcblk0
	Resize the /dev/mmcblk0p2 partition (enter desired space)
	Write the changes
	Quit
	reboot

4. remount root as RO (if fails, reboot and remount as ro)

	mount -o remount,ro /

5. Remove reserved GDT blocks

	tune2fs -O^resize_inode /dev/mmcblk0p2
	fsck.ext4 /dev/mmcblk0p2                   (this will probably fail, doesn't seem to effect anything though)
	reboot
	
6. Go to System > File System Check > Click "File System Check"
	This will do some things and then ask to reboot

7. Resize the f2fs file-system

	resize2fs /dev/mmcblk0p2
	
8. Check new root partition size with:

	df -h
	
9. Reboot

Some of these steps might not be needed, but this has worked on x3 CM4 units of mine

2 Likes

Here's what worked for me on OpenWRT 22.03.2 with SquashFS.

1. Flash image to SD as normal with the firmware selector (I added packages to mine)
2. ssh into router
3. "opkg update && opkg install cfdisk resize2fs"
4. "cfdisk /dev/mmcblk0"
5. Create a NEW PRIMARY partition in the free space at the end. Delete this new partition. Select /dev/mmcblk0p2 and RESIZE it. The default entries will take the whole space.
6. Reboot
7. ssh into router
8. "resize2fs /dev/loop0"
9. Success!

I tried to apply the steps for the BPI-R3 but since the SD-Card partition layout significantly differs, I struggle to success. I used the SDCARD.IMG.GZ from

https://firmware-selector.openwrt.org/?version=SNAPSHOT&target=mediatek%2Ffilogic&id=bananapi_bpi-r3

The partition layout is as follows:

/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *255.9 GB   disk3
   1:           Linux Filesystem                         4.2 MB     disk3s1
   2:           Linux Filesystem                         524.3 KB   disk3s2
   3:           Linux Filesystem                         2.1 MB     disk3s3
   4:                        EFI                         4.2 MB     disk3s4
   5:                        EFI                         33.6 MB    disk3s5
   6:                        EFI                         21.0 MB    disk3s6
   7: CAE9BE83-B15F-49CC-863F-081B744A2D93               109.1 MB   disk3s7

After booting OpenWRT intro recovery from SD and installing cfdisk, expanding the partition mmcblk0p7 and rebooting from SD

opkg update && opkg install fdisk resize2fs cfdisk
cfdisk /dev/mmcblk0

                               Disk: /dev/mmcblk0
             Size: 238.3 GiB, 255869321216 bytes, 499744768 sectors
          Label: gpt, identifier: 5452574F-2211-4433-5566-778899AABB00

    Device              Start         End     Sectors     Size Type
>>  /dev/mmcblk0p1         34        8191        8158       4M Linux filesystem 
    /dev/mmcblk0p2       8192        9215        1024     512K Linux filesystem
    /dev/mmcblk0p3       9216       13311        4096       2M Linux filesystem
    /dev/mmcblk0p4      13312       21503        8192       4M EFI System
    Free space          21504       24575        3072     1.5M
    /dev/mmcblk0p5      24576       90111       65536      32M EFI System
    /dev/mmcblk0p6      90112      131071       40960      20M EFI System
    /dev/mmcblk0p7     131072   499744734   499613663   238.2G unknown
 ┌────────────────────────────────────────────────────────────────────────────┐
 │Partition name: bl2                                                         │
 │Partition UUID: 5452574F-2211-4433-5566-778899AABB01                        │
 │Partition type: Linux filesystem (0FC63DAF-8483-4772-8E79-3D69D8477DE4)     │
 │    Attributes: RequiredPartition LegacyBIOSBootable                        │
 └────────────────────────────────────────────────────────────────────────────┘

     [ Delete ]  [ Resize ]  [  Quit  ]  [  Type  ]  [  Help  ]  [  Write ]
     [  Dump  ]
       Device is currently in use, repartitioning is probably a bad idea.
                      Quit program without writing changes

I checked the storage and nothing seems to make any sense:

df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 5.0M      5.0M         0 100% /rom
tmpfs                   997.9M     64.0K    997.8M   0% /tmp
/dev/mmcblk0p66          91.9M     60.3M     31.7M  66% /overlay
overlayfs:/overlay       91.9M     60.3M     31.7M  66% /
tmpfs                   512.0K         0    512.0K   0% /dev

Though, p6 and p7 are said to be (source) virtual partitions of mmcblk0p5 I am curios as to how to expand the storage properly.

Is this something unique to BananaPis image or indeed common practiced? I tried various attempts over the weekend and nothing seems to make any sense to me. Thanks in advance for you help!

EDIT
I believe I am booting form the wrong device. When I check the SD-Card via lsblk the partition seems to have been expanded correctly:

lsblk 
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
mtdblock0     31:0    0 122.5M  0 disk 
mtdblock1     31:1    0     2M  1 disk 
mtdblock2     31:2    0     3M  0 disk 
mtdblock3     31:3    0   512K  1 disk 
mmcblk0      179:0    0 238.3G  0 disk 
├─mmcblk0p1  179:1    0     4M  0 part 
├─mmcblk0p2  179:2    0   512K  0 part 
├─mmcblk0p3  179:3    0     2M  0 part 
├─mmcblk0p4  179:4    0     4M  0 part 
├─mmcblk0p5  179:5    0    32M  0 part 
├─mmcblk0p6  179:6    0    20M  0 part 
├─mmcblk0p7  179:7    0 238.2G  0 part 
├─mmcblk0p65 259:0    0   4.8M  1 part /rom
└─mmcblk0p66 259:1    0 238.2G  0 part /overlay
ubiblock0_1  254:0    0    28M  0 disk

Best
Mike

so close. stuck at resize2fs. nanopi R2S 22.03.3, using fdisk method here.

resize2fs: Bad magic number in super-block while trying to open /dev/loop0
Couldn't find valid filesystem superblock.

Will format and try again. This time cfdisk route. Will see.

edit: at the end, didn't work for me. tried another card, charger, too.
Will put this aside for now until next time. have fun everyone.

I have problems on my r2s too. Did You solve the problem ?
Did anyone help me with squashfs on sdcard on nanopi r2s ?
Did anyone can write step by step what i need to install ?

nope.
However, I came across another post, about the squashfs overlay was ext4. Something liket that. I'll try to dig that other post here for you.
Planning to try that next time myself.
Hey, report back if that worked for you. :slight_smile:

edit: there you go

edit: I've gone the online firmware selector route. Not exactly what I desire, but achieved similar purpose (more space).

edit: I've successfully expanded my sdcard (R4S) using the above link from @spence.

1 Like

I waited to reply in hopes that someone with direct experience would reply.
I suspect that the git repository that you linked to has a document for what should be the exact steps needed to expand the f2fs overlay on an R2S.

https://github.com/anaelorlinski/OpenWrt-NanoPi-R2S-R4S-Builds/blob/main/docs/resize-f2fs.md

Be sure to enter the commands one line at a time and wait for the prompt to come back before entering the next command. It may matter for one or more commands.

Be aware that the expanded filesystem gets reset with an upgrade, rest or new installation and all files added before hand disappear. You would need to back-up all files before any upgrade, reset or OpenWrt installation, redo the filesystem expansion and restore the backed-up files each time ensuring that you don't restore any packages or components that were upgraded.

If you are looking for more space to install more/bigger packages, then the "Customize installed packages" part of the OpenWrt firmware selector site may be an easy and appropriate way to get there with entering the list of added packages needed.
https://firmware-selector.openwrt.org/?version=22.03.4&target=rockchip%2Farmv8&id=friendlyarm_nanopi-r2s

After that, Attended System Upgrade (AUC) makes for an easy upgrade keeping all added packages and config. Make good backups before though. :-)

2 Likes

As mentioned in the second post, instead of growing/enlarging the filesystem on a running system, you can alternatively instruct the ImageBuilder to create images with larger partitions. With the script below you can copy files from the target and restore them automatically after the update.

I am using this now for several releases (21.02.3 --> 22.03.2 --> 22.03.3 --> 22.03.4). I keep a "chroot" and a couple of shell-scripts, that are backed-up and restored automatically, by this script:

Perhaps you want to consider this option, instead of growing the partitions.

#!/bin/bash

#Documentation: https://openwrt.org/docs/guide-user/additional-software/imagebuilder

HOST="192.168.1.123"
OUTPUT="$(pwd)/images"
BUILDER="https://downloads.openwrt.org/releases/21.02.3/targets/bcm27xx/bcm2710/openwrt-imagebuilder-21.02.3-bcm27xx-bcm2710.Linux-x86_64.tar.xz"
BUILDER="https://downloads.openwrt.org/releases/22.03.2/targets/bcm27xx/bcm2710/openwrt-imagebuilder-22.03.2-bcm27xx-bcm2710.Linux-x86_64.tar.xz"
BUILDER="https://downloads.openwrt.org/releases/22.03.3/targets/bcm27xx/bcm2710/openwrt-imagebuilder-22.03.3-bcm27xx-bcm2710.Linux-x86_64.tar.xz"
BUILDER="https://downloads.openwrt.org/releases/22.03.4/targets/bcm27xx/bcm2710/openwrt-imagebuilder-22.03.4-bcm27xx-bcm2710.Linux-x86_64.tar.xz"

KERNEL_PARTSIZE=$((2*1024)) #Kernel-Partitionsize in MB
ROOTFS_PARTSIZE=$((5*1024)) #Rootfs-Partitionsize in MB

# download image builder
if [ ! -f "${BUILDER##*/}" ]; then
	wget "$BUILDER" || exit 1
	tar xJvf "${BUILDER##*/}" || exit 1
fi

mkdir "$OUTPUT"
cd openwrt-*/ || exit 1

# list all targets for this image builder, consider 'make help' as well
#make info

# clean previous images
make clean || exit 1

#adjust partition sizes
sed -i "s/CONFIG_TARGET_KERNEL_PARTSIZE=.*/CONFIG_TARGET_KERNEL_PARTSIZE=$KERNEL_PARTSIZE/g" .config || exit 1
sed -i "s/CONFIG_TARGET_ROOTFS_PARTSIZE=.*/CONFIG_TARGET_ROOTFS_PARTSIZE=$ROOTFS_PARTSIZE/g" .config || exit 1

# Packages are added if no prefix is given, '-packagename' does not integrate/removes a package
make image  PROFILE="rpi-3" \
           PACKAGES="luci-base luci-ssl luci-mod-admin-full luci-theme-bootstrap \
                     collectd-mod-ping collectd-mod-wireless luci-app-statistics pingcheck collectd-mod-uptime \
                     kmod-usb-storage kmod-usb-ohci kmod-usb-uhci e2fsprogs fdisk resize2fs \
                     htop debootstrap debian-archive-keyring gpgv2 gcc python3-pip block-mount \
                     openssh-sftp-server \
                     mosquitto-client-ssl mosquitto-ssl screen socat unshare kmod-usb-serial-cp210x ip-full kmod-veth luci-app-ser2net \
                     shadow-useradd tar" \
            BIN_DIR="$OUTPUT" || exit 1

#save config and copy across
ssh root@$HOST "sysupgrade -v --create-backup /tmp/$HOST.backup.tar.gz" || exit 1
scp root@$HOST:/tmp/$HOST.backup.tar.gz "$OUTPUT/" || exit 1

#preserve a chroot located at /root/mychroot (bind mount it, create tarball, copy across)
ssh root@$HOST 'mkdir -p /root/mychroot_bindmount && mount --bind /root/mychroot/ /root/mychroot_bindmount && tar -c -z -p -v --numeric-owner -f - /root/mychroot_bindmount' > "$OUTPUT/$HOST.mychroot.tgz" || exit 1

#copy all *.sh files across
scp root@$HOST:/root/*.sh "$OUTPUT/" || exit 1

#perform the actual update
scp "$OUTPUT"/openwrt-*-bcm27xx-bcm2710-rpi-3-squashfs-sysupgrade.img.gz root@$HOST:/tmp/ || exit 1
ssh root@$HOST 'sysupgrade -v -c -u /tmp/openwrt*img.gz && exit'

#wait till HOST is online again
echo "wait..."
sleep 10
while true; do
	echo -n .
	ping -c 1 $HOST > /dev/null && break
	sleep 1
done
echo " OK!"

#restore the chroot (copy across, untar, reboot) and the *.sh files
scp "$OUTPUT/$HOST.mychroot.tgz" root@$HOST:/root/ || exit 1
scp $OUTPUT/*.sh root@$HOST:/root/ || exit 1
ssh root@$HOST "cd /root && tar -xvpzf $HOST.mychroot.tgz -C / --numeric-owner" || exit 1
ssh root@$HOST "mv /root/mychroot_bindmount/ /root/mychroot/" || exit 1
ssh root@$HOST 'reboot && exit'

echo "wait..."
sleep 10
while true; do
	echo -n .
	ping -c 1 $HOST > /dev/null && break
	sleep 1
done
echo " OK!"

exit 0

2 Likes

That's next on the list. :slight_smile:

1 Like

Seems to be a bit of a problem on R2S, am I the only one?

I expanded of the second hide partition f2fs of the squashfs filesystem on the VM,
form this
https://forum.openwrt.org/t/howto-resizing-root-partition-on-x86/140631,

but on R2S after reboot it won't start.
Since I don't know how use the serial port to debug R2S, I can't get the startup logs

fsck.f2fs -f ${LOOP}

+ fsck.f2fs -f /dev/loop1
Info: Force to fix corruption
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 62275968 (30408 MB)
Info: MKFS version
  "Linux version 5.10.176 (builder@buildhost) (aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r20134-5f15225c1e) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 SMP PREEMPT Thu Apr 27 20:28:15 2023"
Info: FSCK version
  from "Linux version 5.10.176 (builder@buildhost) (aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r20134-5f15225c1e) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 SMP PREEMPT Thu Apr 27 20:28:15 2023"
    to "Linux version 5.10.176 (builder@buildhost) (aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r20134-5f15225c1e) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 SMP PREEMPT Thu Apr 27 20:28:15 2023"
Info: superblock features = 0 :
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 641408 (313 MB)
Info: CKPT version = 61222f68
Info: Corrupted valid nat_bits in checkpoint
Info: Write valid nat_bits in checkpoint
Info: checkpoint state = c4 :  nat_bits crc compacted_summary sudden-power-off

[FSCK] Unreachable nat entries                        [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking                [Ok..]
[FSCK] Hard link checking for regular file            [Ok..] [0x1]
[FSCK] valid_block_count matching with CP             [Ok..] [0x1bcd]
[FSCK] valid_node_count matching with CP (de lookup)  [Ok..] [0x7f2]
[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [0x7f2]
[FSCK] valid_inode_count matched with CP              [Ok..] [0x7f2]
[FSCK] free segment_count matched with CP             [Ok..] [0x7f]
[FSCK] next block offset is free                      [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs                           [Ok..]
Info: Duplicate valid checkpoint to mirror position 1024 -> 512
Info: Write valid nat_bits in checkpoint
Info: Write valid nat_bits in checkpoint

Done: 1.119534 sec

resize.f2fs ${LOOP}

+ resize.f2fs /dev/loop1
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 62275968 (30408 MB)
Info: MKFS version
  "Linux version 5.10.176 (builder@buildhost) (aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r20134-5f15225c1e) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 SMP PREEMPT Thu Apr 27 20:28:15 2023"
Info: FSCK version
  from "Linux version 5.10.176 (builder@buildhost) (aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r20134-5f15225c1e) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 SMP PREEMPT Thu Apr 27 20:28:15 2023"
    to "Linux version 5.10.176 (builder@buildhost) (aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r20134-5f15225c1e) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 SMP PREEMPT Thu Apr 27 20:28:15 2023"
Info: superblock features = 0 :
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 641408 (313 MB)
Info: CKPT version = 61222f68
[migrate_block:  56] Migrate node block 1003 -> ce00
[migrate_block:  56] Migrate node block 101d -> ce01
[migrate_block:  56] Migrate node block 101e -> ce02
[migrate_block:  56] Migrate node block 1020 -> ce03
[migrate_block:  56] Migrate node block 1027 -> ce04
[migrate_block:  56] Migrate node block 1029 -> ce05
[migrate_block:  56] Migrate node block 102a -> ce06
[migrate_block:  56] Migrate node block 102b -> ce07
[migrate_block:  56] Migrate node block 102c -> ce08
[migrate_block:  56] Migrate node block 102d -> ce09

[migrate_block:  56] Migrate data block a3fa -> eeec
[migrate_block:  56] Migrate data block a3fb -> eeed
[migrate_block:  56] Migrate data block a3fc -> eeee
[migrate_block:  56] Migrate data block a3fd -> eeef
[migrate_block:  56] Migrate data block a3fe -> eef0
[migrate_block:  56] Migrate data block a3ff -> eef1
[FIX] (move_one_curseg_info:2798)  --> Move curseg[0] 11 -> 6d after ce00

[FIX] (move_one_curseg_info:2798)  --> Move curseg[1] 6 -> 6f after ce00

[FIX] (move_one_curseg_info:2798)  --> Move curseg[2] 10 -> 6e after ce00

[FIX] (move_one_curseg_info:2798)  --> Move curseg[3] 0 -> 5f after ce00

[FIX] (move_one_curseg_info:2798)  --> Move curseg[4] 12 -> 6b after ce00

[FIX] (move_one_curseg_info:2798)  --> Move curseg[5] 2 -> 70 after ce00

Info: Write valid nat_bits in checkpoint
Try to do defragement: Done
[migrate_ssa: 270] Info: Done to migrate SSA blocks: sum_blkaddr = 0xe00 -> 0x9200
[migrate_nat: 386] Info: Done to migrate NAT blocks: nat_blkaddr = 0xa00 -> 0xa00
[migrate_sit: 444] Info: Done to restore new SIT blocks: 0x600
Info: Write valid nat_bits in checkpoint
[rebuild_checkpoint: 585] Info: Done to rebuild checkpoint blocks
[update_superblock: 695] Info: Done to update superblock

Done: 13.329668 secs

I made several attempts and I noticed a lot of modifications on resize.f2fs,
tried fsck.f2fs again after resize.f2fs and got a Checkpoint is polluted error, which I think should have failed.

I tried using the tune2fs method. Stuck in resource busy when remount.

mount -o remount,ro /

Is there any way to fix this?
Thanks


Update 1:

The reason I seem to have discovered is that those built using firmware selector will use ext4 as the overlay,
same as this [https://forum.openwrt .org/t/resizing-the-hidden-overlay-filesystem-when-it-is-ext4-and-not-f2fs/140490](https://forum.openwrt .org/t/resizing-the-hidden-overlay-filesystem-when-it-is-ext4-and-not-f2fs/140490),
and when I use imager-builder on my windows wsl, it will use f2fs as overlay.

I suspect that the existing filesystem is not fixable at this point. You should be able to get a larger filesystem after re-installing an image to your sd-card and first boot.

Since you are using image-builder, you probably can build the image with the larger filesystem. See this thread specific to the R2S for info: ImageBuilder - How to create an image with a custom filesystem

It looks like some people have had success with expanding the second partition before first boot and the writable overlay filesystem gets created larger at first boot.

If you want to continue with the expanding method, I have a few thoughts to share.
I suspect the errors you ran into may have been caused by using the wrong tools for the filesystem you have, you had the wrong offset for the loop device you created or you pasted all the commands together rather than one at a time and waiting for the prompt (or error message) between each command. In the set of commands in the method I shared and you linked, you need to type them as-is and don't try to substitute values for variables yourself.

I have an R4S and not and R2S but I think others have said they use the same basic storage layout.
If you want some specific help, please reply with some info from the R2S after re-installing your image and booting it:
Output of df -hT
Output of losetup

Good luck!

  1. This is the information of image-builder

    image-builder .config bigger rootfs for install dockerd

    CONFIG_TARGET_ROOTFS_PARTSIZE=384
    

    image-builder command for install dockerd

    make image FILES=/mnt/f/code/seed-lab4x/seed-homelab-workspace/.config/dev@home/openwrt@home/image/r2s.lan/any/file 'PACKAGES=base-files busybox ca-bundle dnsmasq dropbear e2fsprogs firewall4 fstools kmod-gpio-button-hotplug kmod-nft-offload kmod-usb-net-rtl8152 libc libgcc libustream-wolfssl logd mkf2fs mtd netifd nftables odhcp6c odhcpd-ipv6only opkg partx-utils ppp ppp-mod-pppoe procd procd-seccomp procd-ujail uboot-envtools uci uclient-fetch urandom-seed urngd -dnsmasq dnsmasq-full fdisk cfdisk parted lsblk losetup resize2fs f2fs-tools python3 luci luci-app-firewall luci-app-opkg luci-base luci-lib-base luci-lib-ip luci-lib-jsonc luci-lib-nixio luci-mod-admin-full luci-mod-network luci-mod-status luci-mod-system luci-proto-ipv6 luci-proto-ppp luci-ssl luci-theme-bootstrap docker dockerd docker-compose luci-lib-docker luci-app-dockerman fuse-overlayfs ' PROFILE=friendlyarm_nanopi-r2s
    

    The system information produced by image-builder is as follows

    BusyBox v1.35.0 (2023-09-29 09:56:24 UTC) built-in shell (ash)
    
      _______                     ________        __
     |       |.-----.-----.-----.|  |  |  |.----.|  |_
     |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
     |_______||   __|_____|__|__||________||__|  |____|
              |__| W I R E L E S S   F R E E D O M
     -----------------------------------------------------
     OpenWrt 22.03.5, r20134-5f15225c1e
     -----------------------------------------------------
    root@R2S:~# set -x
    root@R2S:~# parted -l
    + parted -l
    Model: SD  (sd/mmc)
    Disk /dev/mmcblk0: 32.0GB
    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  470MB   403MB   primary
    
    
    root@R2S:~# lsblk -l -o+FSTYPE
    + lsblk -l -o+FSTYPE
    NAME      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS FSTYPE
    loop0       7:0    0 313.2M  0 loop /overlay    f2fs
    mmcblk0   179:0    0  29.8G  0 disk
    mmcblk0p1 179:1    0    16M  0 part             ext4
    mmcblk0p2 179:2    0   384M  0 part /rom        squashfs
    
    root@R2S:~# losetup -l
    + losetup -l
    NAME       SIZELIMIT   OFFSET AUTOCLEAR RO BACK-FILE  DIO LOG-SEC
    /dev/loop0         0 74252288         1  0 /mmcblk0p2   0     512
    
    root@R2S:~# df -hT
    + df -hT
    Filesystem           Type            Size      Used Available Use% Mounted on
    /dev/root            squashfs       71.0M     71.0M         0 100% /rom
    tmpfs                tmpfs         494.4M   1004.0K    493.4M   0% /tmp
    /dev/loop0           f2fs          311.2M    108.4M    202.8M  35% /overlay
    overlayfs:/overlay   overlay       311.2M    108.4M    202.8M  35% /
    tmpfs                tmpfs         512.0K         0    512.0K   0% /dev
    overlayfs:/overlay   overlay       311.2M    108.4M    202.8M  35% /opt/docker
    
  2. The same custom packages cannot be built in firmware-selector, dockerd must be removed

    customize installed packages

    base-files busybox ca-bundle dropbear e2fsprogs firewall4 fstools kmod-gpio-button-hotplug kmod-nft-offload kmod-usb-net-rtl8152 libc libgcc libustream-wolfssl logd mkf2fs mtd netifd nftables odhcp6c odhcpd-ipv6only opkg partx-utils ppp ppp-mod-pppoe procd procd-seccomp procd-ujail uboot-envtools uci uclient-fetch urandom-seed urngd dnsmasq-full fdisk cfdisk parted lsblk losetup resize2fs f2fs-tools python3 luci luci-app-firewall luci-app-opkg luci-base luci-lib-base luci-lib-ip luci-lib-jsonc luci-lib-nixio luci-mod-admin-full luci-mod-network luci-mod-status luci-mod-system luci-proto-ipv6 luci-proto-ppp luci-ssl luci-theme-bootstrap
    

    I've also tried lowering the version for install dockerd

    Unsupported version: 22.03.3
    Unsupported version: 22.03.2
    Unsupported version: 22.03.1
    

    The system information produced by firmware-selector is as follows

    BusyBox v1.35.0 (2023-09-29 09:56:24 UTC) built-in shell (ash)
    
      _______                     ________        __
     |       |.-----.-----.-----.|  |  |  |.----.|  |_
     |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
     |_______||   __|_____|__|__||________||__|  |____|
              |__| W I R E L E S S   F R E E D O M
     -----------------------------------------------------
     OpenWrt 22.03.5, r20134-5f15225c1e
     -----------------------------------------------------
    root@R2S:~# set -x
    root@R2S:~# parted -l
    + parted -l
    Model: SD  (sd/mmc)
    Disk /dev/mmcblk0: 32.0GB
    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
    
    
    root@R2S:~# lsblk -l -o+FSTYPE
    + lsblk -l -o+FSTYPE
    NAME      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS FSTYPE
    loop0       7:0    0 93.3M  0 loop /overlay    ext4
    mmcblk0   179:0    0 29.8G  0 disk
    mmcblk0p1 179:1    0   16M  0 part             ext4
    mmcblk0p2 179:2    0  104M  0 part /rom        squashfs
    
    root@R2S:~# losetup -l
    + losetup -l
    NAME       SIZELIMIT   OFFSET AUTOCLEAR RO BACK-FILE  DIO LOG-SEC
    /dev/loop0         0 11206656         1  0 /mmcblk0p2   0     512
    
    root@R2S:~# df -hT
    + df -hT
    Filesystem           Type            Size      Used Available Use% Mounted on
    /dev/root            squashfs       10.8M     10.8M         0 100% /rom
    tmpfs                tmpfs         494.4M     60.0K    494.4M   0% /tmp
    /dev/loop0           ext4           81.9M     28.0K     75.4M   0% /overlay
    overlayfs:/overlay   overlay        81.9M     28.0K     75.4M   0% /
    tmpfs                tmpfs         512.0K         0    512.0K   0% /dev
    

The two are not quite the same,

  1. /dev/loop0(/overlay), firmware-selector is ext4, and image-builder is f2fs.

    I successfully expanded the firmware-selector ext4, but the image-builder f2fs is stuck at startup.

  2. the firmware-selector build is not stable.

    same customize installed packages sometimes succeed and sometimes fail.
    i cannot install dockerd on firmware-selector


Update 2:

When I removed dockerd in the image-builder custom package,
and CONFIG_TARGET_ROOTFS_PARTSIZE=384 no longer needs and removed,
the /dev/loop0(/overlay) turned into ext4