Posted: Thu Sep 03, 2020 21:55 Post subject: SOLVED: Issue accessing USB Drive attached to router w/Linux
Hello,
First off I would like to say that I am not a programmer or a Linux expert by any means. I am only recently getting my feet wet setting up a Linux Server (Ubuntu Server 20.04 LTS) at home.
I have been using DD-WRT on my Linksys WRT3200ACM for quite some time now and it works well. I have had no issues. I am running DD-WRT v3.0-r39144 std.
I have an external hard drive attached to the USB port on the router and i am using Samba to share the drive. I have been using it as a NAS drive for months. I can connect to it and share files from all of my computers running windows and all of my android devices like tablets and cell phones. I mounted it as a network drive on my windows computers at \\dd-wrt\MyShared
Now, I have installed Ubuntu Server 20.04 on an old HP desktop that I had laying around and I am playing with it as a server for media files, and I will also run some ERP enterprise software on it as well. I have installed Docker and have also installed Plex in a container as well as Subsonic in a container also. Everything runs well.
What I would like to do now is to access the USB hard drive on the router from the Linux machine so that I can include the files on that drive in the Plex and Subsonic libraries. I am trying to mount it to my /mnt/share folder that I created with the command:
Code:
sudo mount.cifs //MY_ROUTER_IP/MyShare mnt/share
I get the error that "mount error(2): No such file or directory
I should say that the location in the dd-wrt firmware for the Samba share is /dev/sda1 and is labeled "Drive". The path is /mnt/sda1 and is labeled MyShared. When I SSH into the router, I can see the /mnt directory is cyan color indicating that it is a shared folder.
I've been racking by brain for days on this. Any help is appreciated. Thanks in advance.
Last edited by Farizno on Tue Sep 08, 2020 18:21; edited 2 times in total
There may be other errors, but at the moment, the following is what's causing the immediate problem; it's not mnt/share, it's /mnt/share. And that assumes the directory /mnt/share exists.
FWIW, here's a couple of scripts I use to mount and unmount a USB share called "dropbox" from my tomato router, to an Ubuntu desktop (20.04).
Thanks. It was just a typo. I did use the "/" before "mnt". Just for good measure I tried it again and got the same error.
Its probably easier if I take the USB with all my media off the router and connect it directly to the server, but I'm really just playing around until I get some better hardware so I dont want to move the USB drive yet.
Joined: 04 Aug 2018 Posts: 1447 Location: Appalachian mountains, USA
Posted: Mon Sep 07, 2020 19:32 Post subject:
Here I do
mount -t cifs \
-o username=TheShareUsername,password=TheSharePassword,uid=linuxUsername,gid=linuxGroupName,file_mode=0660,dir_mode=0770,rw \
//192.168.1.1/shareName /mnt/mountDirectory
With all the italicized bits (and the router IP) here tailored as appropriate. The mount directory must already exist on your linux system. Note that -o is followed by a loooooong argument containing no spaces and including various items separated by commas.
Also take note of the min and max SMB protocol versions on your dd-wrt NAS page. I'm running BS build 44048 on a Linksys WRT1900ACSv2, and I have min and max set to 2.10 and 3.11 respectively. For a reasonably current linux system, you will need dd-wrt to be OK with version 3.x SMB protocols. If for some reason you need to use the 2.x protocols, you can add vers=2.0 to the long -o string, separated from the rest by a comma.
Here I run Fedora (fc29) linux, but I expect Ubuntu will be exactly the same for something like this. _________________ 2x Netgear XR500 and 3x Linksys WRT1900ACSv2 on 53544: VLANs, VAPs, NAS, station mode, OpenVPN client (AirVPN), wireguard server (AirVPN port forward) and clients (AzireVPN, AirVPN, private), 3 DNSCrypt providers via VPN.
Thank you so much for that answer @SurprisedItWorks! Those 3 lines were exactly what I needed. I am now able to mount my USB hard drive that is attached to my DD-WRT router to my Linux server and use it in the Subsonic media server running on the server.
By the way, thanks for also including that bit about the SMB version. I had to add the 'vers=2.0' designation to the end of the string to get it to work.
mount -t cifs \
-o username=TheShareUsername,password=TheSharePassword,uid=linuxUsername,gid=linuxGroupName,file_mode=0660,dir_mode=0770,rw \
//192.168.1.1/shareName /mnt/mountDirectory
With all the italicized bits (and the router IP) here tailored as appropriate. The mount directory must already exist on your linux system. Note that -o is followed by a loooooong argument containing no spaces and including various items separated by commas.
Also take note of the min and max SMB protocol versions on your dd-wrt NAS page. I'm running BS build 44048 on a Linksys WRT1900ACSv2, and I have min and max set to 2.10 and 3.11 respectively. For a reasonably current linux system, you will need dd-wrt to be OK with version 3.x SMB protocols. If for some reason you need to use the 2.x protocols, you can add vers=2.0 to the long -o string, separated from the rest by a comma.
Here I run Fedora (fc29) linux, but I expect Ubuntu will be exactly the same for something like this.
For some reason, I am now having difficulty getting this to mount automatically when the server reboots. How can I make this automatically mount every time the system reboots? I tried adding this in crontab as one line with && instead of the \ at the end of each line but it didnt work.
Joined: 04 Aug 2018 Posts: 1447 Location: Appalachian mountains, USA
Posted: Fri Sep 11, 2020 19:58 Post subject:
Farizno wrote:
For some reason, I am now having difficulty getting this to mount automatically when the server reboots. How can I make this automatically mount every time the system reboots? I tried adding this in crontab as one line with && instead of the \ at the end of each line but it didnt work.
The \ just means to ignore (it and) the newline character that follows. So
a \
b
can be replaced with just a b at any time. I only wrote it with these "continuation lines" to keep the single-line version from being too wide to read in the forum. You can use a one-line version if you wish. No && chars though!
Quote:
Can I add those 3 lines to /etc/fstab ?
I think you are on the right general track here, but the details will need some work, as the fstab lines are not simply mount commands. Maybe you can figure it out from the man page (try man fstab in your linux system). There is no doubt a lot online about setting up fstab also. Or maybe someone here with more recent experience than I have will step in and point the way. It's actually been nearly two decades since I last edited fstab, and I'm a little rusty!
_________________ 2x Netgear XR500 and 3x Linksys WRT1900ACSv2 on 53544: VLANs, VAPs, NAS, station mode, OpenVPN client (AirVPN), wireguard server (AirVPN port forward) and clients (AzireVPN, AirVPN, private), 3 DNSCrypt providers via VPN.
Thanks again for the assistance. I have been plating around with different lines in fstab, some with very bad results. Currently I have something like:
This seems to work.....for a while. When I reboot the share is mounted and I can access it on my linux machine. However, after a few minutes, i get a recurring error message that just keeps scrolling over and over that reads:
Code:
CIFS VFS: No task to wake, unknown frame received!numMids 2
I have no idea what this means, but I will keep looking. Thanks again for your help and if anyone else here knows I appreciate the assistance.