Preferred Settings[-][--][++]

Server Exports[-][--][++]

Overview of the nfs server options I choose

See man exportfs and http://www.troubleshooters.com/linux/nfs.htm for NFS server option details. Also CentOS docs are great for NFS client/serve details http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-nfs.html

  • secure server must be started by root because it will use ports lower than 1024
  • rw enable read and write
  • sync data must be fully synced to disk, this prevents corruption if a server crashes
  • no_wdelay I use this because my nfs requests are generally small and unrelated
  • nohide if server export has other filesystems mounted inside it, show them too, or else you get empty directories over nfs
  • no_subtree_check I disabled subtree checking because I have thousands of files being written and renamed all the time
  • no_root_squash means files owned by root on the server will be owned by root on the client too, instead of being see as the nobody user on the client.

Client Mounts[-][--][++]

/etc/fstab
xenstore:/store /tron/xenstore nfs4 defaults,hard,intr 0 0

Export NFS folder with other mounts in it[-][--][++]

This describes the nohide server option

Best described with an example. I have 2 hard drives. One is a 1.5TB main drive (actually 3x750GB raid5), the other is a single 2TB drive which holds downloads, movies and backups. I want everything to show up in /nwq. The main drive is mounted to /nwq. Inside nwq I have blank folders /nwq/admin/mnt/deezteez, /nwq/pub/downloads, /nwq/pub/movies. I mount the 2TB drive to /nwq/admin/mnt/deezteez. Now instead of making a symbolic soft link from /nwq/admin/mnt/deezteez/pub/movies to /nwq/pub/movies (because links are not accepted everywhere), I use bind mounts. So I mount --bind /nwq/admin/mnt/deezteez/pub/movies to /nwq/pub/movies and same with downloads. So now /nwq/pub/movies and /nwq/pub/downloads seem like regular folders in /nwq. Which is absolutely perfect, just what I want, no links.

Now I want to have a single NFS export of /nwq and everything in it, including the bound folder mounts. By default NFS will not export mounted folders. So when I mount the /nwq over NFS from the client computer, /nwq/pub/movies and downloads are empty and so is /nwq/admin/mnt/deezteez. To solve this problem, you need to export each mounted folder with the nohide option.
Notice what I call /nwq above is actually /home, /nwq is just a link to /home for legacy and shorthand purposes

/etc/exports on NFS Server
#mReschke
#Found nohide is what I want to show folders of mounted drives, like deezteez
/home                   192.168.12.0/255.255.255.0(sync,no_subtree_check,no_root_squash,rw,insecure)
/home/admin/mnt/deezteez 192.168.12.0/255.255.255.0(sync,no_subtree_check,no_root_squash,rw,insecure,nohide)
/home/pub/downloads 192.168.12.0/255.255.255.0(sync,no_subtree_check,no_root_squash,rw,insecure,nohide)
/home/pub/movies 192.168.12.0/255.255.255.0(sync,no_subtree_check,no_root_squash,rw,insecure,nohide)
/home/admin/bak/systems 192.168.12.0/255.255.255.0(sync,no_subtree_check,no_root_squash,rw,insecure,nohide)

/etc/fstab on NFS Server
# /nwq was on /dev/md1 during installation
UUID=e30921a3-6d0a-4d2e-b7c2-c497a85b8514 /home           ext4    defaults,acl    0       2
# deezteez 2TB drive (no raid)
UUID=e267bbde-eebe-4b09-958f-b4f9258de937 /home/admin/mnt/deezteez ext4    defaults,acl    0       3
/home/admin/mnt/deezteez/pub/downloads /home/pub/downloads bind defaults,bind 0 0
/home/admin/mnt/deezteez/pub/movies /home/pub/movies bind defaults,bind 0 0
/home/admin/mnt/deezteez/admin/bak/systems /home/admin/bak/systems bind defaults,bind 0 0
/etc/fstab on NFS Client
#Mount qserver
qserver:/home /nwq nfs nolock,defaults 0 0