Speed Up Vagrant File I/O with NFS Synced Folders
Learn how to configure Vagrant to use NFS for synced folders, verify the mount, and see when the performance boost matters.
07 Feb 2026, 15:14 UTC

Problem: Slow file operations in Vagrant
When you run commands like npm install or composer update inside a Vagrant VM, each file read or write goes through the default VirtualBox shared folder. This layer adds latency, especially when the operation touches thousands of small files, making the build feel sluggish.
Thesis: Use NFS synced folders for low‑latency host‑guest file access
Vagrant can delegate the synced folder to the host’s NFS server and the guest’s NFS client. The result is a direct mount that bypasses the VirtualBox abstraction, giving read/write speeds that are often 2‑5× faster for file‑heavy workloads.
How NFS synced folders work in Vagrant
When you set type: 'nfs' on a synced folder, Vagrant generates the appropriate exports line on the host, starts the NFS server (if not already running), and tells the guest to mount the exported directory via its NFS client. No manual mount command is needed; Vagrant handles it during vagrant up.
Worked example: Enabling NFS in a Vagrantfile
Vagrant.configure('2') do |config|
config.vm.box = 'ubuntu/focal64'
config.vm.synced_folder '.', '/vagrant', type: 'nfs'
end
Verifying the NFS mount
- Run
vagrant upon the host. - SSH into the VM:
vagrant ssh. - Check the mount:
mount | grep nfsordf -t nfs. You should see a line showing/vagrantmounted with type nfs.
Trade‑off and limitation
- Windows hosts lack a built‑in NFS server; you need third‑party NFS software or fall back to the slower default shared folder.
- Changing the synced folder path requires
vagrant reload(orvagrant up --provision) to refresh NFS exports; a mis‑export can prevent the VM from booting.
Actionable closing
If your project runs package managers, asset pipelines, or any workload that touches many small files, enable NFS synced folders and verify the mount as shown. On Windows, consider using SMB or an NFS wrapper to gain similar benefits.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.