SOLVED: Issue accessing USB Drive attached to router w/Linux

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
Farizno
DD-WRT Novice


Joined: 19 Apr 2017
Posts: 20

PostPosted: Thu Sep 03, 2020 21:55    Post subject: SOLVED: Issue accessing USB Drive attached to router w/Linux Reply with quote
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
Sponsor
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 9157

PostPosted: Thu Sep 03, 2020 23:31    Post subject: Reply with quote
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).

~/scripts/dropbox-mount.sh
Code:
#!/bin/bash

DROPBOX_DIR=~/dropbox

mountpoint -q $DROPBOX_DIR && exit 0

[ -d $DROPBOX_DIR ] || mkdir -p $DROPBOX_DIR

sudo mount.cifs //router/dropbox $DROPBOX_DIR \
    -o vers=1.0,rw,user=xxxxxxxx,pass=yyyyyyyy


~/scripts/dropbox-unmount.sh
Code:
#!/bin/bash

DROPBOX_DIR=~/dropbox

mountpoint -q $DROPBOX_DIR || exit 0

sudo umount $DROPBOX_DIR && sleep 3 && rmdir $DROPBOX_DIR 2> /dev/null


As a convenience, I mount it to my home directory. The scripts are smart enough to NOT attempt to mount an already mounted share, nor unmount an already unmounted share.

_________________
ddwrt-ovpn-split-basic.sh (UPDATED!) * ddwrt-ovpn-split-advanced.sh (UPDATED!) * ddwrt-ovpn-client-killswitch.sh * ddwrt-ovpn-client-watchdog.sh * ddwrt-ovpn-remote-access.sh * ddwrt-ovpn-client-backup.sh * ddwrt-mount-usb-drives.sh * ddwrt-blacklist-domains.sh * ddwrt-wol-port-forward.sh * ddwrt-dns-monitor.sh (NEW!)
Farizno
DD-WRT Novice


Joined: 19 Apr 2017
Posts: 20

PostPosted: Thu Sep 03, 2020 23:42    Post subject: Reply with quote
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.
SurprisedItWorks
DD-WRT Guru


Joined: 04 Aug 2018
Posts: 1444
Location: Appalachian mountains, USA

PostPosted: Mon Sep 07, 2020 19:32    Post subject: Reply with quote
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.
Farizno
DD-WRT Novice


Joined: 19 Apr 2017
Posts: 20

PostPosted: Tue Sep 08, 2020 16:15    Post subject: Reply with quote
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.

Thanks again so much!!
Farizno
DD-WRT Novice


Joined: 19 Apr 2017
Posts: 20

PostPosted: Fri Sep 11, 2020 17:06    Post subject: Reply with quote
SurprisedItWorks wrote:
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.



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.

Can I add those 3 lines to /etc/fstab ?
SurprisedItWorks
DD-WRT Guru


Joined: 04 Aug 2018
Posts: 1444
Location: Appalachian mountains, USA

PostPosted: Fri Sep 11, 2020 19:58    Post subject: Reply with quote
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!
Shocked

_________________
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.
Farizno
DD-WRT Novice


Joined: 19 Apr 2017
Posts: 20

PostPosted: Fri Sep 11, 2020 20:11    Post subject: Reply with quote
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:
Code:
//192.168.111.1/MyShared /media/ddwrt cifs username=username,password=password,uid=1000,gid=1000,file_mode=0660,dir_mode=0770,rw,iocharset=utf8,vers=2.0


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.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum