This is also for anyone else who comes later, since I suspect you are happily ensconced in your storage paradigm now. But just to be clear, you didn’t do any damage. Using all of eMMC for the overlay is a perfectly acceptable and viable way to use your space. Especially considering the use of extroot in an eMMC environment is still broken in OpenWRT.
You can expand your partitions on the fly and use all the space, no muss no fuss:
- Repartition. You used parted, I use fdisk. Either is fine. I like fdisk because it gives fine control. The built in /dev/mmcblk0 partition table looks like this:
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 640 1663 1024 512K 41 PPC PReP Boot
/dev/mmcblk0p2 2048 67583 65536 32M c W95 FAT32 (LBA)
/dev/mmcblk0p3 69632 282623 212992 104M 83 Linux
Make it look like this:
/dev/mmcblk0p1 512 1535 1024 512K 41 PPC PReP Boot
/dev/mmcblk0p2 2048 67583 65536 32M c W95 FAT32 (LBA)
/dev/mmcblk0p3 69632 11075583 11005952 5.2G 83 Linux
/dev/mmcblk0p4 11075584 15269887 4194304 2G 82 Linux swap / Solaris
Full fdisk output for that process is at the end of this post.
- Once you write the partition table, you can on-the-fly resize:
opkg update
opkg install losetup f2fs-tools f2fsck mkf2fs
OLOOP="$(losetup -n -O NAME | sort | sed -n -e "1p")"
ROOT="$(losetup -n -O BACK-FILE ${OLOOP} | sed -e "s|^|/dev|")"
OFFS="$(losetup -n -O OFFSET ${OLOOP})"
LOOP="$(losetup -f)"
losetup -o ${OFFS} ${LOOP} ${ROOT}
fsck.f2fs -f ${LOOP}
mount ${LOOP} /mnt
umount ${LOOP}
resize.f2fs ${LOOP}
After this IMMEDIATELY do: $ reboot && exit
You’ll have 5.2gb of overlay space and 2gb of swap. Here is the full fdisk output from step 1. The main takeaway from below is don’t remove the existing f2fs signature when it asks:
root@OpenWrt:~# opkg install fdisk
root@OpenWrt:~# fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/mmcblk0: 7.28 GiB, 7818182656 bytes, 15269888 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5452574f
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 640 1663 1024 512K 41 PPC PReP Boot
/dev/mmcblk0p2 2048 67583 65536 32M c W95 FAT32 (LBA)
/dev/mmcblk0p3 69632 282623 212992 104M 83 Linux
Command (m for help): d
Partition number (1-3, default 3): 3
Partition 3 has been deleted.
Command (m for help): n
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3): 3
First sector (67584-15269887, default 67584): 69632
Last sector, +/-sectors or +/-size{K,M,G,T,P} (69632-15269887, default 15269887): 11075583
Created a new partition 3 of type 'Linux' and of size 5.2 GiB.
Partition #3 contains a squashfs signature.
Do you want to remove the signature? [Y]es/[N]o: n
Command (m for help): n
Partition type
p primary (3 primary, 0 extended, 1 free)
e extended (container for logical partitions)
Select (default e): p
Selected partition 4
First sector (67584-15269887, default 67584): 11075584
Last sector, +/-sectors or +/-size{K,M,G,T,P} (11075584-15269887, default 15269887):
Created a new partition 4 of type 'Linux' and of size 2 GiB.
Command (m for help): t
Partition number (1-4, default 4): 4
Hex code or alias (type L to list all): 82
Changed type of partition 'Linux' to 'Linux swap / Solaris'.
Command (m for help): p
Disk /dev/mmcblk0: 7.28 GiB, 7818182656 bytes, 15269888 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5452574f
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 640 1663 1024 512K 41 PPC PReP Boot
/dev/mmcblk0p2 2048 67583 65536 32M c W95 FAT32 (LBA)
/dev/mmcblk0p3 69632 11075583 11005952 5.2G 83 Linux
/dev/mmcblk0p4 11075584 15269887 4194304 2G 82 Linux swap / Solaris
Command (m for help): w
The partition table has been altered.
Syncing disks.