symlinks and nfs

I recently discovered an interesting “feature” of symbolic links in conjunction with NFS mounts: they don’t work!

For example, let’s say you have the following NFS export:


Inside of that export, you have the following path:


In *this* directory, you have a symlink called ‘current‘, which points to a different location:

current -> /media/osmedia/linux/ubuntu/11.10

Here’s the rub: if anyone tries to mount the root (or sub path) of that NFS export (say /media/files/isos/osmedia) at a local point (say, /mnt/osmedia), the symlink will fail to work correctly¬†because there is no path /media/osmedia/linux/ubuntu/11.10 on the local machine!

That’s not cool.

Here is another case where bind mounts will save your bacon!

Instead of using symlinks on the NFS host, use bind mounts Рthat way the path will still work when exported.