While going through Vagrant tutorials, I have seen two options for sharing folders between host and guest machines - shared folders and synced folders. What are the difference between them?
Or, is synced folder the new name for shared folder, in Vagrant 2?
By default, Vagrant shares your project directory (the one containing the Vagrantfile) to the /vagrant directory in your guest machine.
vagrant on the other hand is in you environment/project directory and holds individual projects settings i.e. your current VM settings. Whenever you create and execute a vagrantfile, a . vagrant directory is created with VM specific data.
A Basic Vagrantfile A Vagrantfile is a Ruby file that instructs Vagrant to create, depending on how it is executed, new Vagrant machines or boxes. You can see a box as a compiled Vagrantfile. It describes a type of Vagrant machines. From a box, we can create new Vagrant machines.
NFS is a faster way of sharing your project's files between host and guests that sync the files instantly. To use NFS with Vagrant, nfs-utils package needs to be installed and nfs-server needs to be running. If it is not, run: $ sudo dnf install nfs-utils && sudo systemctl enable nfs-server.
Shared Folders
is more VirtualBox specific (vboxsf
) and have known performance issues as number of files grows.
Vagrant v2 (For vagrant 1.1.x and 1.2.x) docs use a more generic name Synced Folder, which includes the default vboxsf
and NFS.
In addition to vboxsf
and NFS, sshfs
is also worth looking into if your host is running Linux.
As you guessed, synced folder is the new, more generic name for a feature that is not only VirtualBox specific anymore as of Vagrant 1.1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With