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?


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.

  • Nice idea. I must give this a test tonight and see if it will work in my scenario. I am mounting at startup but the mounts are not required all the time.
    – Diago
    Oct 12 '10 at 9:45
  • I 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
    – Marco Ceppi
    Oct 12 '10 at 14:04

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.

  • 1
    You 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. Oct 12 '10 at 8:40
  • That 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.
    – evgeny
    Oct 12 '10 at 8:49
  • Actually 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. Oct 13 '10 at 16:45

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.

  • I 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.
    – jfmessier
    Oct 12 '10 at 12:15

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.


Judging by the tags you need to mount Samba. For that matter look here:

Samba Client Configuration Guide on Ubuntu Wiki

A good resource to look for answers about Ubuntu is http://wiki.ubuntu.com since many questions are answered there in greater detail. :)

  • 2
    Google 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.
    – Diago
    Oct 12 '10 at 7:28
  • While this kind of response "RTFM" is typical on Forums and Discussion Boards - it isn't valid or welcome here - as Diago has pointed out.
    – Marco Ceppi
    Oct 12 '10 at 7:51
  • An "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? Oct 12 '10 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.