How To Auto Mount a Network Share (Drobo 5N) on Ubuntu

January 24, 2015

Fed up with the performance limitations of running Plex Media Server, or PMS, (which I really love) on our Drobo 5N, I decided (with my wife’s scrupulous approval) to build a dedicated PMS box to handle future 1080p streams. Being that the Drobo is still highly capable as a media server in general, I’m keeping all of our media there and will just use that to serve content to the new PMS box. I have a small amount of experience with Linux, but this gave me an opportunity to dive into it a bit more, while being able to enjoy movies on the big screen.

The main hurdle I ran into is mounting a network share. Mac OSX and Windows really makes this stupid easy, but in Ubuntu, there is some config needed to have the server ready to serve (forgive the pun) when the computer boots up.

Note: Some of this may pertain to just Plex configuration, but I believe it’s helpful in general

After installing Plex (not the client, the media server), make sure to install two Linux utilities:

  • cifs-utils (Allows for the use of CIFS, a sort of newer replacement for Samba (or SMB. The details of different file systems are out of scope for this post)
  • avahi (Allows us to grab our local server by its hostname (friendly name) rather than specifying the IP address of the device. Think of it as a local DNS)

With that out of the way, let’s get the mount point ready.

$ sudo mkdir /mnt/shares/server

Feel free to replace server with whatever name you want. Our server is named R2 after an obscure science-fiction universe from the mind of George Lucas. 😉

Next, we need to edit a configuration file known as fstab, which will handle auto mounting the share for us when the pc restarts.

Use whatever editor you are comfortable with (vi, nano, or Gedit). I used Gedit since my keyboard was mapped in a weird way with vi.

$ sudo gedit /etc/fstab

This opens the file for editing. Follow this pattern to get the server setup:

$ //server.local/directory /mnt/shares/server cifs username=user,password=pass,iocharset=utf8,sec=ntlm 0 0

Of course, replace the server, username and password with whatever you are using. Some shares won’t require them, so they can be omitted. Look here for further detail. Also, some servers may prefer NFS, NTFS or SMB, so read up on their native file system. The sec=ntlm bit specifies the security protocol for the passwords, though some users reported this option ensuring that the mount does not happen until networking is ready.

UPDATE

I went through this process a second time with my hardware and kept getting a mount.cifs(8) error. I read through the documentation thinking the API changed, but eventually found out through dmesg logs that I had in invalided devname (or host server name). I was trying to mount the root of the drive, but that was a networking faux pas for my setup. Instead, I had to mount a top-level directory.

Now, to mount the share type:

$ sudo mount -a

and your share should be visible in the file manager.

Now, go forth and add some libraries to your PMS and watch away!