Mount on Boot in Linux

Status
Not open for further replies.

ss4johnny

Explorer
Joined
Nov 15, 2013
Messages
55
I have a Windows 7/Linux Mint dual-boot configuration. I had originally set up FreeNAS with Windows 7 (works fine). I think I have the configurations correct on Linux, with the exception that I can only mount the FreeNAS manually. I can't get it to mount at boot properly.

I can type
Code:
sudo mount -t nfs 192.168.0.xxx:/mnt/location /mnt

in the terminal to mount with settings I want (I have read/write access to /mnt/location). However, this has to be done every time you restart.

I saw somewhere that one solution is to add a line to /etc/fstab/ (which you have to have a sudo text editor of some kind to do) like
Code:
192.168.0.xxx:/mnt/location /mnt nfs auto 0 0

But this doesn't seem to work for me.

I'm not really sure what is needed to get it to mount properly at boot.
 
Last edited:

Fraoch

Patron
Joined
Aug 14, 2014
Messages
395
Yup. My fstab line:

Code:
192.168.1.XX:/mnt/volume1  /home/FreeNAS  nfs  defaults,noatime,nodiratime 0 0


You can skip the 'noatime' and 'nodiratime' options, but defaults is required.

Note that if the FreeNAS server is not up when the Linux machine boots up, this will silently fail. Resolved manually by:

Code:
sudo mount -a


Also a nice text editor is nano. I learned vi way back when, but nano is my go-to choice now. Plus it works well in FreeBSD/FreeNAS too.
 

ss4johnny

Explorer
Joined
Nov 15, 2013
Messages
55
Thanks to you both. I had also seen some people put in default there, but I guess I didn't realize how important it was (there isn't much in the way of tutorials for novices on these subjects).

The first time I re-booted after I made the change it worked perfectly. Through some testing, I noticed that it only works properly (so I don't have to sudo mount -a) when the password of the user on the linux machine matches the password on the FreeNAS user that owns the volume. Ideally, I'd like to be able to have a password for the linux computer that does not need to match the password on a FreeNAS user. Is this possible? Alternately, it does not seem the password matters for the mapall user I created.

On text editors, I used sudo nano /etc/fstab to change the file. I'd probably want to focus more on learning emacs though.
 
Joined
Mar 6, 2014
Messages
686
That makes no sense. Your client's password has nothing to do with the NFS share. The User/Group ID has to match. If you want to password protect, use CIFS. Without some authentication method like Kerberos, NFS on its own has little access control.
 

ss4johnny

Explorer
Joined
Nov 15, 2013
Messages
55
That makes no sense. Your client's password has nothing to do with the NFS share. The User/Group ID has to match. If you want to password protect, use CIFS. Without some authentication method like Kerberos, NFS on its own has little access control.

You might be right that it doesn't make sense. I did some checking and you're right about not being able to password protect a NFS share. It seems though that the mix of different passwords has been the only way I can explain it not booting. I could be wrong; I just assumed it was the case because having the password of the FreeNAS volume owner and the Windows user be the same makes managing a CIFS share a bit easier.

There are a few combinations I haven't tried yet. Perhaps if it boots without mounting I run sudo mount -a and then restart, maybe it will boot properly from then on.

When you say the User/Group ID has to match, I think I've got it right, but I'm not 100% sure of what you're saying. I have a volume owned by user 1 with a group, the CIFS share uses these fine. I created a separate user 2 for the NFS share mapall user (though I might delete to simplify things if passwords don't matter) and the original group for mapall group. The name of the user on the Linux and Windows matches the name of user 1.
 

Fraoch

Patron
Joined
Aug 14, 2014
Messages
395
You can specify a user and password in fstab for a CIFS share, but not NFS.
 
Joined
Mar 6, 2014
Messages
686
Are you trying to use both NFS and CIFS on the same share? Why? You can use CIFS for both Windows and Linux.
 
Status
Not open for further replies.
Top