How to access device flash (for edit file /etc/config/fstab) whenever external (USB) root mounted

hi guys.

Could someone briefly explain how to access device flash (for edit file /etc/config/fstab) whenever external (USB) root mounted?
Sometimes it not quick fix manually unplug usb flash and access device flash.

Thank you

as per Flash Layout I tried to mount mtd2&3

|mtd2 - rootfs|
|mtd3 - rootfs_data|

but got error:

root@a81m3:/home/sam# mount /dev/mtd3 /tmp/mtd3
mount: mounting /dev/mtd3 on /tmp/mtd3 failed: Block device required
root@a81m3:/home/sam# mount /dev/mtd2 /tmp/mtd3
mount: mounting /dev/mtd2 on /tmp/mtd3 failed: Block device required

Thank you.

Use /dev/mtdblock3 instead of /dev/mtd3.

This is the overlay filesystem so you will not see files that exist only in the ROM. But /etc/fstab is not a ROM file, so it will be at upper/etc/fstab.

The pre-made empty directory /mnt is planned for temporary mounting of a single filesystem. In order to mount at another point, the directory has to exist.

ok. jot it but whenever I've attempted to mount /dev/mtdblock3 I got error bellow

root@a81m3:/home/sam# mount /dev/mtdblock3 /mnt/mtdblock3/
mount: mounting /dev/mtdblock3 on /mnt/mtdblock3/ failed: Invalid argument
root@a81m3:/home/sam#

Any idea what's wrong?

Thank you mk24

maybe mount expects the filesystem type to come after -t, but I don't know the filesystem type... how to find it out?

Try mounting it directly on /mnt. A mount point must exist, so if you want to mount to /mnt/mtdblock3 you need to mkdir /mnt/mtdblock3 first.

Filesystem type is usually auto-detected. If the router has NOR flash, the overlay filesystem is jffs2.

unfortunately it doesn't work:

root@a81m3:/home/sam# ls -l / | grep mnt
drwxr-xr-x    2 root     root          4096 Mar  5 14:40 mnt
root@a81m3:/home/sam#
root@a81m3:/home/sam#
root@a81m3:/home/sam#
root@a81m3:/home/sam# mount /dev/mtdblock3 /mnt/
mount: mounting /dev/mtdblock3 on /mnt/ failed: Invalid argument
root@a81m3:/home/sam#
root@a81m3:/home/sam# mount -t jffs2 /dev/mtdblock3 /mnt/
mount: mounting /dev/mtdblock3 on /mnt/ failed: Invalid argument
root@a81m3:/home/sam#

I'm not sure what to say here since that works for me (-t jffs2 must be explicitly set). The partition is not still mounted somewhere else is it?

partition is not mounted:

root@a81m3:/home/sam# mount
/dev/root on /rom type squashfs (ro,noatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/sda1 on / type ext4 (rw,noatime,nodiratime,data=ordered)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
root@a81m3:/home/sam#

maybe router mounted it before switching to extroot?

root@a81m3:/home/sam# dmesg | grep mount_root
[   10.214338] mount_root: loading kmods from internal overlay
[   26.723079] mount_root: switched to extroot
root@a81m3:/home/sam#

in this case partition mounted but I don't see it whenever root switched to extroot.

What do you think?

Thank you Mike.

Initially during boot it mounts a standard root/overlay on internal flash then those are unmounted when switching to extroot. The entire / tree (other than psuedo-filesystems like /dev) is then on the external drive.

If you have physical access and can take some downtime you could try booting into failsafe mode then mount_root, or reboot without the external drive, which will make it stay internal as extroot fails.

I can remove usb drive and get access directly to device flash. I just configure it for remote location. I'd like to have some kind of "back door" if I need access to device flash, but router physically is far away...

Anyway Thanks for "brain storm"...