Monday, March 1, 2010

NFS Made Easier

Automounting disks is magic. Autodetecting what to automount is magic-er.

Last weekend I set up my pogoplug as an NFS server, and installed and configured autofs to look for specific directories on the pogoplug. This weekend, I revisited that configuration and learned I was working too hard.

In /etc/auto.master, the entry "/net -hosts" says, "When I type 'ls /net/foo', do these steps:"
  1. look for a host named '' ,
  2. ask what filesystems it's exporting
  3. mount them under /net/
  4. now do the 'ls'
No modifying /etc/auto.misc every time you want to automount a new machine: the machine just appears. There is an /etc/, but it's a script that autofs uses to ask a remote host what it's exporting.

Using remote filesystems could be even easier and more transparent (I could, for example, imagine having upstart manage the whole process, and having autofs be installed by default) but not much.