Skip to content

Instantly share code, notes, and snippets.

Created June 28, 2010 23:31
Show Gist options
  • Save anonymous/456543 to your computer and use it in GitHub Desktop.
Save anonymous/456543 to your computer and use it in GitHub Desktop.
## NFS host machine (assuming OSX)
$ cat /etc/exports
# these network and mask options work with default host-only vagrant networking
# 501:20 should be the uid/gid of whoever owns the actual shared directory on the host
# so when files are created they are by the same user as if the files were created
# locally
/absolute/path/to/directory/to/share -mapall=501:20 -network 192.168.10.0 -mask 255.255.255.0
$ sudo nfsd update
(if nfsd update doesnt work try restart or start)
$ showmount -e
(you should see the export listed)
## NFS client machine
$ cat vagrant_main/recipes/default.rb
# mount nfs
# node[:nfs][:server] is the IP of the server hosting the nfs share with /etc/exports
# node[:nfs][:path] is the same path that the nfs server has listed in /etc/exports
# /app would be whatever you wanted your mount location to be
# :enable puts the mount into fstab as well as mounting immediately
# options: these have worked well for me so far, however i dont know all the low-level details
package "nfs-common"
directory "/app" do
owner "root"
group "root"
mode 0700
action :create
not_if "test -e /app"
end
mount "/app" do
device "#{@node[:nfs][:server]}:#{@node[:nfs][:path]}"
fstype "nfs"
options "rw,nodev,nosuid,sync,resvport,intr"
action [:mount, :enable]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment