How to mount FreeNAS network share persistently
Solution 1
Set up your server to provide the share as NFS (assuming it hasn't already). Then follow the guide here: http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-nfs-fstab.html
Also, you might have to install nfs-common
package for it to work.
Solution 2
If you're looking to have a persistent mount that is stale-proof (outside of the networking being down, or the remote machine being off) I would recommend using AutoFS
In short Autofs (also know as Automount) will only mount a directory when it is needed or accessed and after a few moments of inactivity will unmount itself. By doing so you can setup a persistent network location like you NAS and have it always accessible on your machine in the same mount point without having to worry about the mount going stale when networking drops or if you suspend your computer.
Solution 3
You need to add an entry in the /etc/fstab
for this. See this question for a sample entry. As the answerer explains, smbfs package may be required. This post gives more detailed instructions on the /etc/fstab entry to be added.
You would have to use gksudo gedit /etc/fstab
to edit the file as root.
Solution 4
Further to Marco Ceppi's answer (I'd have posted this as a comment if I had the necessary reputation):
When you want to use autofs
for the job, have a look at autosshfs, which allows mounting an sshfs (fuse) filesystem with a user's ssh-agent
. That solves the usual authentication issue with autofs: since it runs as root it is tricky to set up to authenticate as a user without having to type a passphrase every time or use an unprotected SSH key.
Related videos on Youtube
Pieter Breed
Will code even if it is illegal. Sense of humour non-optional.
Updated on September 17, 2022Comments
-
Pieter Breed over 1 year
I have a FreeNAS server in the house on which we keep our media. I would like to be able to automount this share in a persistent location when the machine is turned on so that the music players can index the music and we can conveniently browse through the folders etc.
How will I accomplish this?
-
Admin over 13 yearsGoogle it, read the wiki, or search first is NOT valid SE answers. Google is any SE site's home page, and therefore no question is to easy or simple. The ideal is for all searches on questions to end up here.
-
Michael Gundlach over 13 yearsWhile this kind of response "RTFM" is typical on Forums and Discussion Boards - it isn't valid or welcome here - as Diago has pointed out.
-
LassePoulsen over 13 yearsYou might need to take into account who your network connections is started, if you use network-manager your connections doesn't get initialized until you have logged in. Now i don't know if the nfs-mounter will just wait until a connection becomes available, but it's something to take into consideration.
-
evgeny over 13 yearsThat is a fair point. In case the connections are started at log-on only, you mught need to run
sudo mount -a
to automount your NFS partitions. -
jfmessier over 13 yearsI like the idea of a mount point specified in fstab. However, I would like to avoid error messages when my laptop is outisde of the home network, and it cannot reach the internal FreeNAS server.
-
Michael Gundlach over 13 yearsI use it mostly for backup scripts on CentOS servers or when connecting to my own NAS at home which has all my music on it
-
Nicolay Doytchev over 13 yearsAn "RTFM" kind of response is "RTFM". The issue at hand is too complex for a simple answer with a paragraph. Therefore I have pointed the user to a resource which contains elaborate information answering his question. Furthermore I haven't responded as "Google it" or "Read the wiki" - I have given the precise location of the resource answering the exact question. Also if the purpose of this website is to answer people's questions why is it invalid or "unwelcome" answer to give an advice of where or how to get a better answer of a question?
-
Pieter Breed over 13 yearsActually in 10.10 this is not an issue. As soon as I am logged in (on both of my machines) the mount points are available.