knite
knite

Reputation: 6171

Vagrant synced_folder id option

The syntax for enabling an NFS folder share in Vagrant is commonly posted as:

config.vm.synced_folder "<HOST_DIR>", "<VM_DIR>", id: "???", type: "nfs", mount_options: ["nolock", "vers=3", "udp"]

Note the id argument. I've read the Vagrant docs at https://docs.vagrantup.com/v2/synced-folders/basic_usage.html, but this option isn't mentioned.

Given its frequent use in Vagrantfiles, I assume this option is relevant, if not mandatory. What exactly does it do?

Upvotes: 4

Views: 768

Answers (1)

BHSPitMonkey
BHSPitMonkey

Reputation: 655

When using the default VirtualBox shared folder mechanism, the id option will be what appears when you list your mount points in the guest OS using mount. For example:

Vagrantfile

config.vm.synced_folder "<HOST_DIR>", "/opt/bar", id: "foo"

Guest OS via SSH

$ mount
...
foo on /opt/bar type vboxsf (uid=1000,gid=1000,rw)

I have not tested whether the id option is used for nfs synced folders, but I can confirm that it has no bearing on rsync synced folders.

Upvotes: 1

Related Questions