How can I create a data partition on my MT6000's 8 GB eMMC flash memory? My use case of OpenWrt will not require more than a few hundred MB of system partition. To keep things sane, let's say 512 MB. I'd like to partition the remaining 7+ GB of the eMMC for data, formatted to ext4. How can I accomplish this?
If this were x86, I think setting the following in my .config would do it, but I want to be 100% certain:
CONFIG_TARGET_ROOTFS_PARTSIZE=512
I do not know if that is right since my x86 box uses the ext4 profile which might be different than the one for this device.
# fdisk -l
Disk /dev/loop0: 7.23 GiB, 7758151680 bytes, 15152640 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
The backup GPT table is not on the end of the device.
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: gpt
Disk identifier: 2BD17853-102B-4500-AA1A-8A21D4D7984D
Device Start End Sectors Size Type
/dev/mmcblk0p1 8192 9215 1024 512K Linux filesystem
/dev/mmcblk0p2 9216 13311 4096 2M Linux filesystem
/dev/mmcblk0p3 13312 17407 4096 2M Linux filesystem
/dev/mmcblk0p4 17408 21503 4096 2M Linux filesystem
/dev/mmcblk0p5 21504 25599 4096 2M Linux filesystem
/dev/mmcblk0p6 25600 91135 65536 32M Linux filesystem
/dev/mmcblk0p7 91136 15269887 15178752 7.2G Linux filesystem
Disk /dev/mmcblk0boot0: 4 MiB, 4194304 bytes, 8192 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
Disk /dev/mmcblk0boot1: 4 MiB, 4194304 bytes, 8192 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
Something is defining the partition scheme and to have p7 use 7.2G. I am wondering about modifying a hard-coded value somewhere to have it use only 0.5 G. Then I could manually partition the rest....
Question is what is defining that 7.2G p7 and can it be modified to a smaller value?
EDIT: was it set by the original GL.inet installer? If so, what is a safe method to resize it down to 0.5G and have that change remain as I flash new images moving forward?
That is a good question, I don't find lo_sizelimit anywhere in the fstools code itself. It all depends on how the code treats it, but even then, it won't be as bytes. C can read this as an integer, as hex, as octal e.g., but it has no data type for bytes.
Please delete F2FS from collective memory, it's crap in all capital letters - its filesystem overhead is massive.
# mount | grep loop.*overlay
/dev/loop0 on /overlay type f2fs (rw,lazytime,noatime,background_gc=on,nodiscard,no_heap,user_xattr,inline_xattr,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6,alloc_mode=reuse,checkpoint_merge,fsync_mode=posix,discard_unit=block,memory=normal)
# df -h /overlay/
Filesystem Size Used Available Use% Mounted on
/dev/loop0 891.3M 67.6M 823.7M 8% /overlay
# du -hs /overlay/
138.0K /overlay/
So 138 KB of files on the overlay, 67.6 MB lost to f2fs filesystem overhead (and that's in addition to the 29 MB f2fs already reserved for the fs structures ahead of time, the raw partition is 920 MB in size) - and yes, that isn't much less for the default 104 MB image sizes (leaving you with very little free flash to play with).