Setting up NFS Shares
NFS shares on our media station are the best solution in order to allow UNIX systems and particularly other GNU/Linux boxes, to access the files our media server is using. This way we not only have all our collection in a place where our media server can access it quickly and steadily (i.e. USB connection), but we can manipulate our collection from the comfort of our own PC. This becomes even more useful if there’s more than one PC in the house as not only can they always access the same files, but you’ll never have the situation where you can’t access your files because the PC connected to the external HDD is turned off.
While GNU/Linux systems can use Samba shares as well, my experience of trying to make them work with it has been littered with random errors and malfunctions causing continuous headaches. It’s unfortunate but it seems that windows systems are capable of connecting to samba shares with less hassle. I was fortunate enough to bump into this guide in the ubuntu fora while I was looking for solutions to my samba issues. The ease by which it functioned from the get-go convinced me to stick to NFS for now and in the future.
I don’t really have to put a lot of details as that guide gives a far better installation procedure than I could write here. Simply follow that guide and you’re set.
During the editing of your /etc/exports file, simply add the mount points of your external hard disks and/or the directories where you’re hosting your local files. Here’s what mind looks like at the moment for example:
This means that these four directories and their contents will be shared via NFS for all systems in my LAN (the 192.168.1.xxx IP range). With this file only, the nfs server will do the rest of sharing my files every time the PC starts.
On my GNU/Linux client PCs, I only needed to add a relevant section in my /etc/fstab file to let it know what to mount on boot time.
### NFS shares ###
nova:/media/store1 /media/Void nfs rsize=8192,wsize=8192,timeo=14,intr
nova:/media/store2 /media/ExpansionDrive nfs rsize=8192,wsize=8192,timeo=14,intr
nova:/mnt/localshare /media/NovaLocal nfs rsize=8192,wsize=8192,timeo=14,intr
nova:/media/vacuum /media/Vacuum nfs rsize=8192,wsize=8192,timeo=14,intr
The first column is the network share, the second is the local mount point, then the filesystem type and lastly the options. Note that “Nova” is the hostname of my own server. Simply replace that with the hostname you’ve given yours.
Now I can simply mount them all with a simple “sudo mount -a” and I can see and manipulate them from my own PC as if they were local hard disks.
db0@HomePC:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 26G 2.8G 22G 12% /
udev 977M 224K 976M 1% /dev
none 977M 12K 977M 1% /dev/shm
none 977M 212K 976M 1% /var/run
none 977M 0 977M 0% /var/lock
none 977M 0 977M 0% /lib/init/rw
/dev/sdb1 30G 13G 16G 45% /home
nova:/mnt/localshare 265G 231G 22G 92% /media/NovaLocal
nova:/media/store1 925G 595G 284G 68% /media/Void
nova:/media/vacuum 1.8T 217G 1.5T 13% /media/Vacuum
nova:/media/store2 932G 834G 99G 90% /media/ExpansionDrive
Share the xbmc plugins and skins directories (Optional)
In a similar way to the above, we can also share our xbmc’s plugin and skin directories to allow us to install more of them in the future without having to use a console and ssh connections.
Simply add the following lines to the end of your /etc/exports of your file server.
### XBMC Skinds & Plugin shares ###
And then restart the nfs server
$ sudo /etc/init.d/nfs-kernel-server restart
Once done, simply add the corresponding lines to your client PC’s /etc/fstab again:
### XBMC Skins & Plugins ###
nova:/home/xbmc/.xbmc/skin/ /media/XBMC-Skins nfs rsize=8192,wsize=8192,timeo=14,intr
nova:/home/xbmc/.xbmc/plugins/ /media/XBMC-Plugins nfs rsize=8192,wsize=8192,timeo=14,intr
Don’t forget to create the new mountpoint directories first.
$ sudo mkdir /media/XBMC-Plugins
$ sudo mkdir /media/XBMC-Skins
And then mount them
$ sudo mount -a
With our files now shared all over our local network, we can now proceed to setup our system as a central download server.