[Solved] Where is and how to change external root mounting options

Hi guys.

I'm useing OpenWrt SNAPSHOT r12138-1e3bfbafd3 for my tp-link c59v2 router.
I implemented successfullu ext-root to external USB. I see flash drive has been mounted with realtime option.

root@a81m3:/home/sam# mount | grep sd
/dev/sda1 on / type ext4 (rw,sync,relatime)
root@a81m3:/home/sam#

How to force /dev/sda1 mount on / only with rw,noatime,nodiratime?

/etc/fstab is empty:

root@a81m3:/home/sam# cat /etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
root@a81m3:/home/sam#

my /etc/config/fstab has folllowing:

root@a81m3:/home/sam# cat /etc/config/fstab
config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

config 'mount'
        option target        '/'
        option device        '/dev/sda1'
#       option uuid          '8675fb22-cd89-4fcd-839d-cebe2ac94f1b'
        option fstype        'ext4'
        option options       'rw,noatime,nodiratime'
#,sync,user_xattr,barrier=1,data=ordered'
        option enabled       '1'
        option enabled_fsck  '0'

root@a81m3:/home/sam#

but after reboot I see sda1 mounted again on / with "rw,sync,relatime" options.

fstab has been enabled:

root@a81m3:/home/sam# ls -l /etc/rc.d/ | grep fsta
lrwxrwxrwx    1 root     root            15 Jan 28 09:21 S40fstab -> ../init.d/fstab
root@a81m3:/home/sam#

p.s. I'd like to decrease write circles to flash drive.

Thank you.

The /etc/config/fstab you are seeing is probably the one from your extroot-drive.

You need to edit the /etc/config/fstab on the original flash (i.e. without extroot) to make it work.

1 Like

Do you mean restart router w/o connected USB flash and edit fstab?

Yes that would be the case but you can also mount your flash manually and then edit the config there.

ok I got it working by removing drive and edit raw fstab. After reboot sda1 was mounted with correct options:

root@a81m3:/home/sam# mount | grep sd
/dev/sda1 on / type ext4 (rw,noatime,nodiratime)
root@a81m3:/home/sam#

Thank you guys!

by the way. Could you briefly explain how to access device flash (for edit device /etc/config/fstab) whenever external root mounted?
You right sometimes it not quick fix manually unplug flash and access device flash.

Look it up in documentation. You need to mount /dev/mtd* (3 or 4, depending on your device) device with some options that I dont remember right now.

it doesn't work:

root@a81m3:/home/sam# mount /dev/mtd3 /mnt/
mount: mounting /dev/mtd3 on /mnt/ failed: Block device required
root@a81m3:/home/sam# mount /dev/mtd4 /mnt/
mount: mounting /dev/mtd4 on /mnt/ failed: Block device required
root@a81m3:/home/sam# mount -t jffs2 /dev/mtd4 /mnt/
mount: mounting /dev/mtd4 on /mnt/ failed: Block device required
root@a81m3:/home/sam# mount -t jffs2 /dev/mtd3 /mnt/
mount: mounting /dev/mtd3 on /mnt/ failed: Block device required
root@a81m3:/home/sam#

actually I just remove usb flash whenever I need access to device usb, but this is not good solution especially whenever router far away from me.

Please always try to look up before you ask something. Everything is almost always available in the documentation.

Look here and see the section '2. Configuring rootfs_data'.

Ahmar16.

Please always try to read posts carefully before blaming somebody. My original question was: I successfully implemented ext-root and i'd like to change mount options w/o removing flash as per router most of the times at remote location far away from me.
of course I read this (not only you can read...) openwrt ext-root howto has following:

https://openwrt.org/docs/guide-user/additional-software/extroot_configuration

...The directory /rwm will contain the original root overlay, which is used as the main root overlay until the extroot is up and running...

it means /rwm can be seen as before system switched to ext-root.
see bellow:

root@a81m3:/home/sam# ls / | grep r
overlay
proc
rom
root
usr
var
root@a81m3:/home/sam# ls /tmp | grep r
board.json
resolv.conf
resolv.conf.auto
run
syslog-ng.persist
usr
root@a81m3:/home/sam#

There's no such /rwm anywhere in OpenWrt because it is just a self created directory to mount the original flash space. Firs you need to identify your rootfs_data. It could be done through cat /proc/mtd and then you can create a mount point in the fstab after the ExtRoot has booted up. If you use the original fstab before ExtRoot then you won't be able to access it under ExtRoot.

I am not blaming anyone for anything

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