New USB drive automounts to wrong directory


#1

Just got a new 8TB USB drive which I intend to use (eventually) with miniDLNA as a media repository and (perhaps) as a backup target for my Windows laptop.

I’ve read a number of help postings, but things aren’t making sense enough for me to do what I want it to do.

The automount on my Omnia is working. It sees the device at /dev/sda2 and mounts it to /tmp/run/mountd/dsa2.

I WANT it to mount to a directory I created: /share.

I’ve been using the Luci interface as well as a ssh session as root.

I figure the FIRST step is to configure things so that it mounts to /share, but I can’t seem to accomplish that!

Heres the current blkid output after the router automounted the drive:

/dev/sda1: PARTLABEL="Microsoft reserved partition" PARTUUID="ca7138a3-f84f-40cc-a17a-b2c961e719aa" /dev/sda2: LABEL="Seagate Expansion Drive" UUID="7ACCE961CCE917E1" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="ebf1f6b3-1043-4425-8ab1-698370fd1b57"

Any help would be much appreciated!


#2

To be clear, you would like to create a /share and mount these partitions under that?

I think you’re on the right track in using UUIDs since Linux in general does a first seen first given for /dev/sdX. Within LuCI on my machine I go to System|Mount Points, then click on the Add button.

Check Enable this mount, and pick by UUID. Then under Mount point pick -- custom --.

That will let you type in the path you would like. Don’t forget you need to have actual directories wherever you need to mount something.

If this is what you’re doing, is it not working right?

[edits for completeness and typos]


#3

Correct at the time! Since then, I decided to use /mnt/share instead - (not sure why!)

I’ve already tried what you suggested in various combinations:

  • Used custom UUID of “7ACCE961CCE917E1” per the UUID from the blkid output above
  • Used custom UUID of “ebf1f6b3-1043-4425-8ab1-698370fd1b57” (PARTID from above)
  • Used custom Label of “Seagate Expansion Drive” (from above)
  • Used custom label of “Basic data partition” (from PARTLABEL)
    Note that I did NOT include the quotation marks in what I entered in the LUCI interface!

In ALL cases, I first unmounted (using the unmount button) what the automount system mounted:


before trying the various forms of ADD. In all cases the result is something like:

The critical part in the above picture is "(not present)" - it appears on all of the configurations I’ve tried.

I’ve also tried specifying ntfs in the “advanced” tab over the 4 different identification options - same result except that the “Filesystem” field shows “ntfs” instead of “?”.

Here are (I think) all the related lines in the system log:

    2017-12-18T17:33:10-08:00 crit mountd[2390]: new mount : Disc-A2 -> sda2 (NTFS)
    2017-12-18T17:33:10-08:00 crit mountd[2390]: mounting /tmp/run/mountd/sda2
    2017-12-18T17:33:10-08:00 crit mountd[2595]: ntfs-3g /dev/sda2 /tmp/run/mountd/sda2 -o force
    2017-12-18T17:33:10-08:00 err ntpdate[2168]: name server cannot be used: Try again (-3)
    ...
    2017-12-18T17:33:13-08:00 crit mountd[2390]: ----------> mount ret = 0
    2017-12-18T17:33:13-08:00 notice ntfs-3g[2676]: Version 2015.3.14 integrated FUSE 27
    2017-12-18T17:33:13-08:00 notice ntfs-3g[2676]: Mounted /dev/sda2 (Read-Write, label "Seagate Expansion Drive", NTFS 3.1)
    2017-12-18T17:33:13-08:00 notice ntfs-3g[2676]: Cmdline options: force
    2017-12-18T17:33:13-08:00 notice ntfs-3g[2676]: Mount options: force,allow_other,nonempty,relatime,fsname=/dev/sda2,blkdev,blksize=4096
    2017-12-18T17:33:13-08:00 notice ntfs-3g[2676]: Ownership and permissions disabled, configuration type 1
    ...
    2017-12-18T17:50:01-08:00 notice ntfs-3g[2676]: Unmounting /dev/sda2 (Seagate Expansion Drive)

All lines above except the last were the automount system (I think) after my most recent reboot.
The last line is me clicking the “Unmount” button
All attempts at mounting with the “Add” button - including finishing with “Save and Exit” resulted in no entries in the syslog (that I can find!)

Just for grins and giggles, I tried doing a simple mount command from the SSH interface:

root@turris:/#
root@turris:/#
root@turris:/# blkid
/dev/mmcblk0: PTUUID="8c1fe33f" PTTYPE="dos"
/dev/mmcblk0p1: UUID="0aa0df20-0f06-4cba-944d-50bd9db9262c" UUID_SUB="e8357d8b-5424-4f78-ae37-747d3ca3c088" TYPE="btrfs" PARTUUID="8c1fe33f-01"
/dev/sda1: PARTLABEL="Microsoft reserved partition" PARTUUID="ca7138a3-f84f-40cc-a17a-b2c961e719aa"
/dev/sda2: LABEL="Seagate Expansion Drive" UUID="7ACCE961CCE917E1" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="ebf1f6b3-1043-4425-8ab1-698370fd1b57"
root@turris:/#
root@turris:/#
root@turris:/#
root@turris:/# mount /dev/sda2 /mnt/share
mount: wrong fs type, bad option, bad superblock on /dev/sda2,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
root@turris:/#
root@turris:/# dmesg | tail
[   28.500638] br-lan: port 2(eth2) entered forwarding state
[   28.500668] br-lan: port 1(eth0) entered forwarding state
[   28.781039] mvneta f1034000.ethernet eth1: Link is Up - 1Gbps/Full - flow control off
[   28.781056] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[   28.850615] br-lan: port 4(wlan0) entered forwarding state
[ 1151.193662] nf_conntrack: automatic helper assignment is deprecated and it will be removed soon. Use the iptables CT target to attach helpers instead.
[ 2239.425818] ntfs: (device sda2): parse_ntfs_boot_sector(): Volume size (7TiB) is too large for this architecture.  Maximum supported is 2TiB.  Sorry.
[ 2239.439287] ntfs: (device sda2): ntfs_fill_super(): Unsupported NTFS filesystem.
[ 2290.361509] ntfs: (device sda2): parse_ntfs_boot_sector(): Volume size (7TiB) is too large for this architecture.  Maximum supported is 2TiB.  Sorry.
[ 2290.374970] ntfs: (device sda2): ntfs_fill_super(): Unsupported NTFS filesystem.
root@turris:/#

This last bit really puzzles me as the automount system successfully mounted it!

Next things to try? Anybody?


#4

I don 't use NTFS so I won’t give you advice, but try to use EXT4 if you don 't need the drive to transfer between devices. Have you tried the official documentation?
https://doc.turris.cz/doc/en/howto/nas
or https://doc.turris.cz/doc/en/start


#5

Of the options from the 2nd link, only your first link seems appropriate to my options. I just took a closer look and realized that I probably need to use the special instructions for ntfs file systems. I’ve got to go do some errands, so I’ll try when I return. However, if that doesn’t work, and since this is a brand new drive intended for only this purpose, I’m open to repartitioning and formatting the drive to have a single EXT4 filesystem. I just don’t know how!

If the instructions are simple, then I’d love to find them here when I return from my errands, in case the special instructions (to create a nas service using ntfs-3g) don’t work. But if it’s complex, I don’t want to take your time to instruct me until I post here that the special instructions didn’t work!

Thanks for the help so far, and for any further help in advance.


#6

I know, the second link I gave only to make it clear that there is also some documentation from the community. And because the link from the www.turris.cz page goes somewhere behind this page. I found this manual that looks simple: https://www.howtogeek.com/106873/how-to-use-fdisk-to-manage-partitions-on-linux/ sudo in ssh you do not need to write because you are already logged in as root.


#7

Tagging @Perry @jklaas

Thanks to you both! The special ntfs instructions worked beautifully - but only after I struggled for a few HOURS/reboots before I noticed that the first line of my /etc/init.d/nas file started “#1” instead of “#!”. Once I fixed that type, all the instructions worked perfectly. The data partition of my external hard drive (/dev/sda2) is now part of my directory structure at /mnt/share - and this configuration survives reboots! Step 1 of my quest is done. Now on to trying the DLNA server. Whoops! Spoke too soon! See: below

Please don’t reply here about how I made the typo - it’s a problem I’m going to address in a separate post in “General”

Again, my thanks!


#8

I just gave @Perry the “solution” checkmark. But it hides one additional lesson:

While I’m a firm believer in RTFM, and I’d ALREADY checked the documentation @Perry referenced, it was Perry’s suggestion that caused me to look at it again, and I’ve revised my internal “RTFM” to “RTFM Carefully!”


#9

Actually, I spoke too soon! Configuration describes fails on reboot - partition still is automounted to /tmp/run/mountd/sda2 and NOT to my preferred /mnt/share!

I can manually get it where I want it by unmounting the wrong mount point then restarting the nas service under Luci System -> Startup screen. But I want it automatically.

My first “fix” attempt was simply to disable the mountd service (System --> Startup). Rebooting resulted in the partition where I wanted it - but now hot plugging a USB device into my other USB port won’t automount. Not optimal.

Then I found:
https://wiki.openwrt.org/doc/howto/writable_ntfs
which suggested an addition to the /etc/rc.local file to run an appropriate ntfs-3g command. I added it (modified to reflect my locations - /dev/sda2 and /mnt/share), rebooted - and it worked! Next, I re-enabled mountd, rebooted and tried again - Yay! It’s mounted where I want it and mountd is running so, presumably, it will hot plug a 2nd usb device appropriately (I haven’t tried this yet!)

So for now, it appears things are looking good - time to go on to getting samba access to this to move media files from my computer, then work on getting minidlna to work.


Po aktualizaci - restartu, se odpojí NTFS NAS
#10

There is a “nice” solution for this problem which doesn’t require disabling mountd, any black magic, and even allows you to mount the drive by UUID, which you really should want.

It is an improved “nas” service file from the howto: https://gist.github.com/peci1/443062022352a3adc0df574584c9af44 . It’s just a basic idea, it could be improved to support multiple drives mounting, an entry in /etc/config etc.

The main change compared to the howto file is changing the START order from 99 to 79 (mountd has 80). After you do that, your script will be run before mountd, and when mountd is called, your NTFS drive will already be mounted, so it won’t touch it.

BONUS: my reasoning for why is the howto broken. The howto was written some time ago, when mountd was not a part of Turris OS (I think it’s there from 3.3). Then mountd came into play but nobody has revised the howto since.


Po aktualizaci - restartu, se odpojí NTFS NAS
Catastrophic disk failure - discovered after an update
#11

This also probably solves How to mount USB drive? and Správný mount NTFS disku po startu routeru? . The topics are locked, so I’m referencing them from here hoping at least a link here would pop up there.


#12

What I don’t entirely understand here is why this is needed at all.

It seems common sense to me that mountd should not be mounting any already mounted filesystems.

Since this is the order of the scripts:

/etc/rc.d/S40fstab
/etc/rc.d/S80mountd

Any fstab mounted filesystems should not also be mounted by mountd.