NAS/NFS Mounts on Arch linux (Desktop re-install).

My desktop’s hard drive died. It was sad but not detrimental to production. The current setup in place protects from such failures. While it does require two boxes to function, I’ll trade convenience for peace of mind any day.

There are three main points to this setup; security, ease of use and availability.

The base for this build is Arch linux (you should know this by now). There is not too much required to get this to work.

Bit of advise, you should start by first eliminate bottle necks and finding the weakest link:

  • You will need a very fast network: You have to take into consideration how much you will be doing and noting that all of your activities will be occuring over the network. Since your /home folder will be mounted over the network, this is probably the most important device. If you router/switch can’t reach *Gb/s speeds, that should be the first thing you upgrade.

  • Cat-6 cable or better: Enough said.

  • Your nas box should be faster than your network: If you are trying to access a movie, over the network, this will cause a lot of reads and writes along with a lot of other overhead, the last thing you want is for your NAS box to be unable to keep up. The box I’m using for this setup has enough memory, SSD and caching to keep up.

This more of a concept that I haven’t had time to perfect:

  • Cross-over networking: In a perfect word, to get the grestest speed out of this setup as possible, I would directly connect the NAS box and the desktop via a crossover cable. That would cut out the router as the middle man and essentially improve throughput. If both your deskop and NAS box had two nics, I would strongly advise going this route (Ha, get it? Route? Alright, I’m done. Show me the door/gateway, *)

After re-installing the OS, it came time to mount /home again. These are general steps to mount any NAS point that should work for you with only a few modifications.

First (we’re assuming you’ve already set up a storage box) make sure your NAS box will allow your desktop to mount exports from it:

1
2
3
4
root@blackpool:~# grep '100(' /etc/exports
/mnt/trinity/beta 10.10.100.100(rw,no_root_squash,subtree_check)
/mnt/trinity/gamma 10.10.100.100(rw,no_root_squash,subtree_check)
/mnt/trinity/epsilon/whiteroom 10.10.100.100(rw,no_root_squash,subtree_check)

Now we get NFS working on the desktop. You’ll need to install ‘nfs-utils’ and ‘nfsidmap’. I already have these installed, but it should look something like this:

1
2
3
4
5
6
7
8
9
10
11
12
[root@whiteroom ~]# pacman -S nfs-utils nfsidmap
warning: nfs-utils-1.3.0-4 is up to date -- reinstalling
warning: nfsidmap-0.26-1 is up to date -- reinstalling
resolving dependencies...
looking for inter-conflicts...

Packages (2): nfs-utils-1.3.0-4 nfsidmap-0.26-1

Total Installed Size: 1.04 MiB
Net Upgrade Size: 0.00 MiB

:: Proceed with installation? [Y/n]

Once that is installed, enable and start the rpcbind service:

1
2
3
4
[root@whiteroom ~]# systemctl enable rpcbind
Created symlink from /etc/systemd/system/sockets.target.wants/rpcbind.socket to /usr/lib/systemd/system/rpcbind.socket.

[root@whiteroom ~]# systemctl start rpcbind

Create the mount points for the NFS folders, if you have not already done so and add entries for these folders in /etc/fstab:

1
2
3
4
5
# NAS MOUNTS

blackpool:/mnt/trinity/beta /home nfs nfsvers=3 0 0
blackpool:/mnt/trinity/gamma /mnt/data nfs nfsvers=3 0 0
blackpool:/mnt/trinity/epsilon/whiteroom /mnt/backups nfs nfsvers=3 0 0

I’ve added a few others. Backups on this machine are sent straight to the nas -> “/mnt/backups”. “/mnt/data” is required due to the way symlinking works: if I wanted to symlink ‘music’ to “/mnt/trinity/gamma/media-music” this symlink would not show up on the client side. Thus the correct way to do this is to mount the endpoint for the symlink and then create them on the client side as needed.

This took about 15-20 minutes to complete. I don’t think many people can go from ‘losing their main hard drive’ to ‘back up in running’ in less time.

This is why you run backups/keep a complex setup.