Choosing a Vagrant Synced Folder Type for Local Development
Match VirtualBox shared folders, NFS, or rsync to your workload and host OS before file sharing slows down your Vagrant VM.
30 Oct 2026, 16:08 UTC

You start a Vagrant VM, SSH in, and run npm install or composer install inside a directory shared from your host. The command finishes, but only after an uncomfortable wait. If your project contains thousands of small files, the synced folder is often the bottleneck, not the virtual machine.
Vagrant mounts host directories into guests using provider-specific mechanisms. The right choice depends on your host operating system, whether the guest needs to write files back to the host, and how many small files your workload touches. This post compares VirtualBox shared folders, NFS, and rsync, then shows how to verify which one is actually active.
VirtualBox shared folders: convenient but slow at scale
VirtualBox shared folders are the default mechanism for the VirtualBox provider and usually require Guest Additions inside the guest. They are bidirectional, so edits on either side appear on the other, which makes them a good general-purpose choice for application source code.
The limitation is scale: shared folders can become slow with large directories of small files, such as node_modules or vendor packages. If your guest performs many file creates, reads, or metadata operations, this default option may noticeably slow down provisioning, test runs, or dependency installation.
NFS: faster for small files, with host requirements
NFS synced folders generally outperform VirtualBox shared folders for workloads with many small files. They require host NFS server support. Native Windows NFS support is limited to certain editions, so most Windows hosts need WSL2 or a third-party NFS server to use type: "nfs" reliably.
Example Vagfile configuration:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/jammy64"
config.vm.synced_folder "./app", "/var/www/app",
type: "nfs",
nfs_version: 4,
nfs_udp: false
end
Run vagrant up from the directory containing the Vagfile. On macOS and Linux, Vagrant may prompt for your sudo password to configure host NFS exports. Mount options, permissions, and UID/GID mapping can differ from VirtualBox shared folders, so test file ownership after the first boot.
To verify the mount, run vagrant ssh, then inside the guest run:
mount | grep vagrant
You should see a mount line whose type is nfs for the synced path. A risk with NFS is that guest writes appear on the host immediately, which is useful, but a misconfigured host export can prevent the folder from mounting or delay VM startup.
rsync: one-way and cross-platform
An rsync synced folder copies files from host to guest and works without kernel modules on most platforms. It is useful for static assets or dependency directories that the guest reads but does not edit.
Run vagrant rsync-auto on the host to watch for changes and repeat synchronization automatically. This adds latency, so it is inappropriate for write-heavy guest workloads where the host needs immediate visibility into guest-side changes.
The key limitation is direction: rsync does not propagate guest-side changes back to the host by default. Bidirectional workflows require additional scripting or a different synced folder type.
Provider and portability caveats
Available synced folder types depend on the provider and installed plugins. A Vagfile validated with VirtualBox may fail or behave differently under libvirt, Docker, or Hyper-V. Before committing to a type, run vagrant plugin list and consult your provider’s documented synced folder support.
A practical check you can run yourself
Create 1,000 small files in the synced directory under each candidate type and time the operation. Compare results for your actual workload rather than adopting someone else’s benchmark. Your disk, host OS, and VM memory change the outcome, so treat published numbers as a starting point, not a guarantee.
Start with VirtualBox shared folders if you just need bidirectional file sharing. Switch to NFS when small-file operations drag and your host can run an NFS server. Use rsync for read-only assets or when you need something that works without provider-specific kernel modules. Confirm the active mount inside the guest before you optimize anything else.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.