in Developer Experience

Vagrant NFS exports on Fedora 21

If you are using Vagrant chances are you would like to use NFS instead of rsync to speed up shared folders and avoid annoying vagrant rsync-auto command. But what to do when Vagrant just hang on Mounting NFS shared folders in Fedora?

First, if you haven’t already, switch to NFS in Vagrantfile.

config.vm.synced_folder "./", "/home/vagrant", type: "nfs"

Note: NFS can be the default depending on your provider.

It is also important to know that your guest has to support NFS as client and that your
host have NFS server installed and running (if it’s Fedora, then nfs-utils package should be installed on both).

If you have all that in place, the last pitfall is to configure the firewall. On my Fedora 21, interfaces virbr0 and virbr1 created by libvirt shows up in
FedoraWorkstation zone which is the default on Fedora Workstation.

$ firewall-cmd --list-all 
FedoraWorkstation (default, active)
  interfaces: docker0 em1 virbr0 virbr1 vnet0
  sources: 
  services: dhcpv6-client samba-client ssh
  ports: 1025-65535/udp 1025-65535/tcp
  masquerade: no
  forward-ports: 
  icmp-blocks: 
  rich rules: 

The following command will enable the missing services:

sudo firewall-cmd --permanent --add-service=nfs &&
sudo firewall-cmd --permanent --add-service=rpc-bind &&
sudo firewall-cmd --permanent --add-service=mountd &&
sudo firewall-cmd --reload
$ firewall-cmd --list-all 
FedoraWorkstation (default, active)
  interfaces: docker0 em1 virbr0 virbr1 vnet0
  sources: 
  services: dhcpv6-client mountd nfs rpc-bind samba-client ssh
  ports: 1025-65535/udp 1025-65535/tcp
  masquerade: no
  forward-ports: 
  icmp-blocks: 
  rich rules: 

Finally my NFS shares work!

Write a Comment

Comment