These are the UBI devices right after booting the device:
root@router:~# ls -l /dev/ubi*
crw------- 1 root root 250, 0 Jan 1 1970 /dev/ubi0
crw------- 1 root root 250, 1 Jan 1 1970 /dev/ubi0_0
crw------- 1 root root 250, 2 Jan 1 1970 /dev/ubi0_1
crw------- 1 root root 249, 0 Jan 1 1970 /dev/ubi1
crw------- 1 root root 249, 1 Jan 1 1970 /dev/ubi1_0
crw------- 1 root root 10, 59 Jan 1 1970 /dev/ubi_ctrl
brw------- 1 root root 254, 0 Jan 1 1970 /dev/ubiblock0_0
Following your advice, I ran the "ubiattach -m 8
" command, wich responded with "UBI device number 2, total 592 LEBs (75169792 bytes, 71.6 MiB), available 0 LEBs (0 bytes), LEB size 126976 bytes (124.0 KiB)
". And now, I have the following UBI devices:
root@router:~# ls -l /dev/ubi*
crw------- 1 root root 250, 0 Jan 1 1970 /dev/ubi0
crw------- 1 root root 250, 1 Jan 1 1970 /dev/ubi0_0
crw------- 1 root root 250, 2 Jan 1 1970 /dev/ubi0_1
crw------- 1 root root 249, 0 Jan 1 1970 /dev/ubi1
crw------- 1 root root 249, 1 Jan 1 1970 /dev/ubi1_0
crw------- 1 root root 247, 0 Mar 27 23:40 /dev/ubi2
crw------- 1 root root 247, 1 Mar 27 23:40 /dev/ubi2_0
crw------- 1 root root 247, 2 Mar 27 23:40 /dev/ubi2_1
crw------- 1 root root 10, 59 Jan 1 1970 /dev/ubi_ctrl
brw------- 1 root root 254, 0 Jan 1 1970 /dev/ubiblock0_0
Now I create the ROM device and mount it:
root@router:~# ubiblock --create /dev/ubi2_0
root@router:~# ls -l /dev/ubi*
crw------- 1 root root 250, 0 Jan 1 1970 /dev/ubi0
crw------- 1 root root 250, 1 Jan 1 1970 /dev/ubi0_0
crw------- 1 root root 250, 2 Jan 1 1970 /dev/ubi0_1
crw------- 1 root root 249, 0 Jan 1 1970 /dev/ubi1
crw------- 1 root root 249, 1 Jan 1 1970 /dev/ubi1_0
crw------- 1 root root 247, 0 Mar 27 23:51 /dev/ubi2
crw------- 1 root root 247, 1 Mar 27 23:51 /dev/ubi2_0
crw------- 1 root root 247, 2 Mar 27 23:51 /dev/ubi2_1
crw------- 1 root root 10, 59 Jan 1 1970 /dev/ubi_ctrl
brw------- 1 root root 254, 0 Jan 1 1970 /dev/ubiblock0_0
brw------- 1 root root 254, 1 Mar 27 23:51 /dev/ubiblock2_0
root@router:~# mount -t squashfs -o ro /dev/ubiblock2_0 mnt
And it effectively contains the ROM from my previous installation:
root@router:~# cat mnt/etc/banner
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
OpenWrt 18.06.1, r7258-5eb055306f
-----------------------------------------------------
So far so good... now lets go for the overlay:
root@router:~# umount mnt
root@router:~# mount -t ubifs /dev/ubi2_1 mnt
root@router:~# ls -l mnt/
drwxr-xr-x 11 root root 736 Aug 21 2018 upper
drwxr-xr-x 3 root root 224 Jan 1 1970 work
And, after inspecting it's contents, I can see that it is indeed my old overlay partition.
This is great news, now in case of a disastrous configuration, users could boot on the "alternate" partition, fix the configuration from there, then go back to the current "partition". Many thanks for your help!