Block devices on UniFi AP AC PRO

I managed to install Lede 17.01.4 on my UniFi AP AC PRO. In principle everything works fine. Now, I would like to install some VPN Server packages but unfortunately the /overlay partition is rather small:

root@lede:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.5M      2.5M         0 100% /rom
tmpfs                    61.3M    852.0K     60.5M   1% /tmp
/dev/mtdblock5            3.8M      3.3M    528.0K  86% /overlay
overlayfs:/overlay        3.8M      3.3M    528.0K  86% /
tmpfs                   512.0K         0    512.0K   0% /dev

Now I'm wondering if I can extend the /overlay partition using the other block devices:

root@lede:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00060000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00790000 00010000 "firmware"
mtd3: 00140000 00010000 "kernel"
mtd4: 00650000 00010000 "rootfs"
mtd5: 003d0000 00010000 "rootfs_data"
mtd6: 00790000 00010000 "ubnt-airos"
mtd7: 00020000 00010000 "bs"
mtd8: 00040000 00010000 "cfg"
mtd9: 00010000 00010000 "EEPROM"

For example ubnt-airos or firmware seem to provide another 8MB of memory. Are those partition currently used? Can I use those to extend overlayfs?

You'll want to configure extroot on a USB drive

I'm aware of this, I just thought there is another possibility.

You can combine the "ubnt-airos" and "firmware" partitions into one big "firmware" partition, assuming you don't want to keep the airos as a backup. OpenWrt does not support the dual firmware partition on ths device anyway, so there is really no point in this split unless you use it to toggle between OpenWrt and Airos without a reinstall. Not that there would be much point in that either...

You should probably verify that you are booting from the "firmware" partition before making the change. If you flashed OpenWrt twice from Airos, like most installation guides tell you too, then you might actually load the kernel from the "ubnt-airos" partition. This will not work well with combined partitions.

The "bs" partition contains the flag used by the bootloader to select which of the two firmware partitions to boot. It should look like this when from "firmware" is the preferred:

root@unifiac:~# hexdump -C /dev/mtd7
00000000  00 00 00 00 a3 4d e8 2b  00 00 00 00 00 00 00 00  |.....M.+........|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00020000

There is still an unfortunate lack of tools to manage this dual image scheme..

If you know both valid states and can reliably deduce the bootflag from there, it shouldn't be difficult to write a small script using dd, hexdump and /dev/mtdblock7.

I flashed OpenWrt only once and the output of hexdump -C /dev/mtd7 looks exactly as you say. Can you point me to a tutorial or something on how to combine both partitions? Thanks a lot!

You can find both variants here:

It's simply single bit flag. Writing a utility (or as part of the mtd tool) is easy. But the main issue is to enable OpenWrt to actuall run from the second partition. The bootloader will of course happily load the OpenWrt kernel from the second, but the rootfs partition will still be split out from the first. You'd need some extra driver magic around the mtd partition splitting to run the rootfs split on the second instead. Probably not much point, but I wonder what the benefit is? Might be better to just say that the OpenWrt partition scheme is different from the OEM firmware, and have twice as much space.

No tutorial, and I can be wrong here. Haven't tried myself. But I believe you just have to change the MTDPARTS variable which goes into the command line:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ar71xx/image/generic-ubnt.mk#l117

There are a few devices which support dualboot in OpenWrt, see this as an example

which depends on

https://github.com/openwrt/openwrt/blob/master/target/linux/ipq806x/patches-4.14/0067-generic-Mangle-bootloader-s-kernel-arguments.patch

(an equivalent patch seems to be present in the oxnas target as well).

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.