OpenWrt Forum Archive

Topic: solved: block mount ignores /etc/config/fstab

The content of this topic has been archived on 13 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello forum,

I try to mount a USB storage attached to my router. I would like to have access to the storage via sftp from other Linux-Clients. I have a working sftp server and I have added a user.
I can read from my Linux-Clients logged in as user (not root), but I can not write.
But I can read and write when I log in as root like (in Nautilus)

sftp://root@192.168.1.1/mnt/share

What I do:

 root@OpenWrt:~# mount -t ext4 /dev/sda1 /mnt/share -o rw,sync
root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/mtdblock3 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlayfs (rw,noatime,lowerdir=/,upperdir=/overlay)
tmpfs on /dev type tmpfs (rw,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
/dev/sda1 on /mnt/share type ext4 (rw,sync,relatime,data=ordered)
 

It mounts and I can read(write) from Linux client

The dir looks like this:

root@OpenWrt:~# cd /mnt/
root@OpenWrt:/mnt# ls -l
drwxr-xr-x    3 root     root          4096 Feb 17 22:27 share


But it does not mount when I do

root@OpenWrt:~# block mount
block: /dev/mtdblock3 is already mounted
root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/mtdblock3 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlayfs (rw,noatime,lowerdir=/,upperdir=/overlay)
tmpfs on /dev type tmpfs (rw,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)

[nothing mounted at /mnt/share/] -> so it will not mount at boot time either, I presume.


My /etc/config/fstab looks like this:

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    '/mnt/share'
    option    uuid    '0ab082bd-7b6a-4c04-9ccb-3afd8fe9afca'
        option  fstype  'ext4'
    option    enabled    '0'
        option  options 'rw, sync'
        option  enabled '0'
        option  enable_fsck '0'

I have followed the instructions and examples here http://wiki.openwrt.org/doc/uci/fstab but I did not succeed

My question:

What do I have to do to get my USB hardrive mounted at boot time?
How do I have to configure fstab to have write access for users to the mounted storage?

Thanks for helping me over this problem and lots of regards

Ruuter

here some system informations:

Hostname    OpenWrt
Model    TP-Link TL-WDR4300 v1
Firmware Version    OpenWrt Barrier Breaker 14.07 / LuCI Trunk (0.12+svn-r10530)
Kernel Version    3.10.49

(Last edited by ruuter on 18 Feb 2015, 21:27)

what happens if you remove the double

option    enabled    '0'

and set the remaining one to '1'

option    enabled    '1'

?

And while you're at it: post the output of

blkid

remove the double
option    enabled    '0'
and set the remaining one to '1'

done!
But still:

root@OpenWrt:~# block mount
block: /dev/mtdblock3 is already mounted
block: mounting /dev/sda1 (ext4) as /mnt/share failed (-1) - Unknown error -1

Then I removed one line after the other until the error message was gone.
Now /etc/config/fstab is working with these lines:

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    '/mnt/share'
    option    uuid    '0ab082bd-7b6a-4c04-9ccb-3afd8fe9afca'
        option  fstype  'ext4'
        option  enabled '1'
        option  enable_fsck '0'

(I removed  "option  options 'rw, sync'")

And the drive is also mounted after reboot :-)

root@OpenWrt:~# mount
[...]
/dev/sda1 on /mnt/share type ext4 (rw,relatime,data=ordered)
[...]

even user rights look OK now:

root@OpenWrt:/# ls -l /mnt/
drwxrwxrwx    3 root     root          4096 Feb 18 21:16 share

Now I have write access from my client as expected (non-root user)

So everything seems to be fine now - or will my system miss "option  options 'rw, sync'"?

Great thanks for your help!

Ruuter

Remove the space in "rw, sync"

The discussion might have continued from here.