LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-18-2015, 10:15 AM   #1
katto
Member
 
Registered: Nov 2010
Distribution: Kubuntu 10.4
Posts: 46

Rep: Reputation: 16
Trying to add a NAS box over NFS to fstab


I've got a D-link DNS-320LW that I'm trying to use as a remote backup box plus extra storage. The NAS box is connected to the wireless router with a standard ethernet cable and the connection of my pc to the router is over wifi. Its smb share function gets a bit complicated and seems to have issues with streaming so I'm looking into NFS. I can mount it fine with

Code:
sudo mount -t nfs 192.168.1.20:/mnt/HD/HD_a2 /mnt/NAS/
and it works perfectly with it. I tried to add it to fstab following the advice here since that guy seems to have a setup almost identical to mine. The fstab line I'm using is

Code:
192.168.1.20:/mnt/HD/HD_a2 /media/NAS nfs rw,hard,intr 0 0
but I don't see it mounted after a reboot. I've tried adding the _netdev option but I didn't see any improvements. Using showmount -e 192.168.1.20 when it's not mounted, I get

Code:
Export list for 192.168.1.20:
/mnt/HD/HD_a2 192.168.1.0/24
so it seems that it's at least visible after the boot. Any ideas on what I'm doing wrong?

(I'm also not sure intr is needed since the man page says it's deprecated. Seems proto=tcp should be added to ensure it uses TCP for transport and avoid data corruption during backups. I'd love to use NFSv4 with kerberos authentication but my experience with network shares is zero so I have no clue how to go about that.)
 
Old 04-18-2015, 03:16 PM   #2
katto
Member
 
Registered: Nov 2010
Distribution: Kubuntu 10.4
Posts: 46

Original Poster
Rep: Reputation: 16
Update

After searching more I found others who had the same mistake. It seems that at least on laptops, the ethernet adapters initialise connections after logging in so fstab has already finished by then and _netdev won't make it wait that long.

There was one solution with a script here but I found a similar solution with less steps in a comment here which I adapted.

I adapted his script to my situation like this

nasmount.sh

Code:
#!/bin/sh

while true;
do
ping -c1 192.168.1.20 > /dev/null &&
break;
done

mount -t nfs -o rw,hard,intr 192.168.1.20:/mnt/HD/HD_a2 /media/nas
made the file executable, moved it into /etc/init.d, changed the ownership and group to root and run
Code:
sudo update-rc.d nasmount.sh 99 2 3 4 5
it gave me a warning

Code:
update-rc.d: warning: /etc/init.d/nasmount.sh missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
usage: update-rc.d [-n] [-f] <basename> remove
       update-rc.d [-n] <basename> defaults [NN | SS KK]
       update-rc.d [-n] <basename> start|stop NN runlvl [runlvl] [...] .
       update-rc.d [-n] <basename> disable|enable [S|2|3|4|5]
                -n: not really
                -f: force

The disable|enable API is not stable and might change in the future.
After rebooting, this still didn't work even though the script worked when I ran it as root. This is probably going to work eventually but it feels very clunky. Is there any other way to delay the nfs mounting in fstab until after the wireless adapter has connected to the router or maybe make the wireless adapter connect to the router before finishing the mount process?
 
Old 04-18-2015, 06:11 PM   #3
katto
Member
 
Registered: Nov 2010
Distribution: Kubuntu 10.4
Posts: 46

Original Poster
Rep: Reputation: 16
Update 2 and solution

There are ways to allow the network manager to start a wifi connection before log in and let fstab properly mount the remote filesystems. There is a feature in the gnome network manager applet to "allow all users" to share the default connection. Unfortunately, whatever geniuses maintain the KDE network manager applet haven't included that feature in the gui in the last five years.

Whoever else is having the same problem and you're not running a multi-user system (i.e. you've got a computer with only one user or you don't mind sharing your default connection with multiple users on the same machine) just ditch the KDE network manager applet, WICD or whatever else you're using, install the gnome network manager applet, add it to autostart through system settings (if you're running KDE) and check the option to allow other users to share the connection and reboot.

Only problem with this method is that the wifi password will be stored in clear text. I'm not sure there's a workaround for that.
 
  


Reply

Tags
dlink, fstab, nas, nfs



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using NAS box for NFS server? (i.e. not RAID) Quakeboy02 Linux - Hardware 8 05-08-2014 09:27 AM
Dlink NAS not connected even thou FSTAB listed. utanja Debian 3 05-07-2013 09:43 PM
Issue to access NFS share which is shared on HP NAS box chirag_linuxforum Linux - Networking 3 08-06-2010 05:48 PM
NAS mounts with fstab but hangs on shutdown zuser Linux - Newbie 4 04-07-2009 02:07 PM
What's package daemon that add to /etc/fstab when you add USB sticks frenchn00b Linux - General 3 01-20-2008 08:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration