My Archer C7 v1.1 looks like it has 2-4MB flash mem instead of 8MB

Hi, I'm having trouble with my TP-Link Archer C7 AC1750 v1.1, it looks like it only has 2-4MB flash memory left:

root@OpenWrt:~# df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/root                    4         4         0 100% /rom
tmpfs                       60         0        60   0% /tmp
/dev/mtdblock4               2         0         2  11% /overlay
overlayfs:/overlay           2         0         2  11% /
tmpfs                        1         0         1   0% /dev

(That output is directly after firstboot -y && reboot running on 23.05.2)
/rom says size=4MB, /overlay only has 2MB. I don't know if this is expected, the hardware description here says flash memory = 8MB, but I'm not sure if the full 8MB is supposed to show up above.

The Luci interface under Status -> Storage -> Disk space says 2.06MB

root@OpenWrt:~# dmesg | egrep "jffs|overlay"
[    0.000000] Kernel command line: console=ttyS0,115200n8 rootfstype=squashfs,jffs2
[    0.261858] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    9.728600] jffs2: notice: (437) jffs2_build_xattr_subsystem: complete building xattr subsystem, 13 of xdatum (0 unchecked, 4 orphan) and 17 of xref $
[    9.746103] mount_root: switching to jffs2 overlay
[    9.756891] overlayfs: upper fs does not support tmpfile.

I can't install the package I want:

Installing openssl-util (3.0.13-1) to root...
Collected errors:
 * verify_pkg_installable: Only have 1344kb available on filesystem /overlay, pkg libopenssl3 needs 1411
 * opkg_install_cmd: Cannot install package openssl-util.

Is there hope for installing that package or is it time to buy a new device?

https://openwrt.org/faq/no_space_left_on_device

Hi, thanks for the link, the extroot suggestion seems to require 8MB flash. Do you know how I can check whether the device is functioning correctly, i.e. what command should show the documented 8MB instead of the 2&4 that I see in df ?

I prefer using df -h as it gives. bit more resolution into the actual usage, while also making it human readable (that's the -h argument).

root@OpenWrt:~# df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/root                    4         4         0 100% /rom
tmpfs                       28         0        28   0% /tmp
/dev/mtdblock5               2         0         2  13% /overlay
overlayfs:/overlay           2         0         2  13% /
tmpfs                        1         0         1   0% /dev
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.8M      3.8M         0 100% /rom
tmpfs                    28.0M     64.0K     28.0M   0% /tmp
/dev/mtdblock5            1.9M    240.0K      1.6M  13% /overlay
overlayfs:/overlay        1.9M    240.0K      1.6M  13% /
tmpfs                   512.0K         0    512.0K   0% /dev

You should be able to install the required extroot packages within the 8MB total footprint. I've done it many times. Alternatively, you can use the image builder to pre-install them, saving some space in the process.

Nothing is wrong with your device -- the above is from another 8M device (Linksys E3000)

There is one very simple -approximate- way to check this, take a look at the size of the provided sysupgrade image.

In this case, the archer c7-v1 sysupgrade image for 23.05.2 weighs 5888.3 KB, keep in mind that bootloader+bootloader_env and ART weigh another 196 KB (or more on other devices), now how much free space can you expect after installing OpenWrt on a 8 MB flash device?

--
Yes, some vendors come with a rather wasteful flash partitioning and/ or dual-firmware setups, but a) neither is the case here, b) it still gives you an upper ceiling to refine your calculations.

Another option is to skip the webui in the main image, establish extroot, then install it once it's working.

Thanks! I saw this page on flash layouts, and executed some commands on my device that indeed seem to confirm the 8MiB flash presence:

root@OpenWrt:~# opkg install fdisk lsblk
...
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.8M      3.8M         0 100% /rom
tmpfs                    59.6M   1008.0K     58.6M   2% /tmp
/dev/mtdblock4            2.1M   1020.0K      1.1M  48% /overlay
overlayfs:/overlay        2.1M   1020.0K      1.1M  48% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:~# fdisk -l | grep Disk
Disk /dev/mtdblock0: 128 KiB, 131072 bytes, 256 sectors
Disk /dev/mtdblock1: 7.81 MiB, 8192000 bytes, 16000 sectors
Disk /dev/mtdblock2: 2.22 MiB, 2330112 bytes, 4551 sectors
Disk /dev/mtdblock3: 5.59 MiB, 5861376 bytes, 11448 sectors
Disk /dev/mtdblock4: 2.06 MiB, 2162688 bytes, 4224 sectors
Disk /dev/mtdblock5: 64 KiB, 65536 bytes, 128 sectors
root@OpenWrt:~# lsblk
NAME      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
mtdblock0  31:0    0  128K  1 disk
mtdblock1  31:1    0  7.8M  0 disk
mtdblock2  31:2    0  2.2M  1 disk
mtdblock3  31:3    0  5.6M  1 disk /rom
mtdblock4  31:4    0  2.1M  0 disk /overlay
mtdblock5  31:5    0   64K  1 disk
root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00020000 00010000 "u-boot"
mtd1: 007d0000 00010000 "firmware"
mtd2: 00238ed3 00010000 "kernel"
mtd3: 0059712c 00010000 "rootfs"
mtd4: 00210000 00010000 "rootfs_data"
mtd5: 00010000 00010000 "art"
root@OpenWrt:~# dmesg | grep '0\.4[1-9]'
[    0.411683] Creating 3 MTD partitions on "spi0.0":
[    0.416559] 0x000000000000-0x000000020000 : "u-boot"
[    0.427086] 0x000000020000-0x0000007f0000 : "firmware"
[    0.433639] 2 tplink-fw partitions found on MTD device firmware
[    0.439713] Creating 2 MTD partitions on "firmware":
[    0.444753] 0x000000000000-0x000000238ed3 : "kernel"
[    0.449803] mtd: partition "kernel" doesn't end on an erase/write block -- force read-only
[    0.460548] 0x000000238ed4-0x0000007d0000 : "rootfs"
[    0.465605] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
[    0.475856] mtd: setting mtd3 (rootfs) as root device
[    0.481866] 1 squashfs-split partitions found on MTD device rootfs
[    0.488167] 0x0000005c0000-0x0000007d0000 : "rootfs_data"
[    0.494586] 0x0000007f0000-0x000000800000 : "art"

This leads me to speculate that the 8MiB = 8192 KiB flash of the device is divided as follows:

 8192
 ├── 128          u-boot      mtd0
 ├── 8000         firmware    mtd1
 │   ├── 2275.5   kernel      mtd2
 │   └── 5724     rootfs      mtd3
 │       ├── 2112 rootfs_data mtd4 /overlay, /
 │       └── 3612 -           -    /rom
 └── 64           art         mtd5

I'm not sure about the interpretation of the /rom mount mentioned in df -h, as corresponding to mtd3 minus mtd4, is that the way I should read it? 3612 KiB = 3698688 bytes = 3.7M. That doesn't exactly match the 3.8M that df -h displays, but seems to be the best guess for now. Is that how the /rom mount of /dev/root should be seen as part of flash memory?

It's all part of the flash memory.

Yes that's clear, I'm just wondering if /rom = mtd3 minus mtd4, and if so where the difference of 3.8M with 3.7M comes from.

https://openwrt.org/toh/tp-link/archer_c7#hardware_highlights

Device has 8MB flash, zero if you round to closest terabyte