Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant shared folder. Symlinks

I am trying to figure out If I am capable of having symlinks in my shared folder when booting up a vm.

I currently have a project with a few symlinks in the library directory which I would like to edit on the fly and see the changes on the vm.

I can't seem to figure this out. I have a feeling it's not possible. The symlinks do not exist.

config.vm.share_folder "k5", "/projects", "/Users/slik/projects"
config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
like image 968
slik Avatar asked Dec 05 '12 03:12

slik


People also ask

What are the synced folders in Vagrant?

If you are using the Vagrant VirtualBox provider, then VirtualBox shared folders are the default synced folder type. These synced folders use the VirtualBox shared folder system to sync file changes from the guest to the host and vice versa.

Why can't I create symlinks in a shared/sync'd folder?

Another issue is the lack of support for proper symlinks in Windows, and a default Vagrant setup won't allow you to create symlinks in shared/sync'd folders when running on a Windows host. Thankfully, we've found a way aroundthese issues.

What is the difference between V-root and V-vagrant symlinks?

To my knowledge /vagrant in "VBoxInternal2/SharedFoldersEnableSymlinksCreate//vagrant" specifies the shared folder in which symlinks are allowed. v-root specifies the root of the vm. Furthermore symlinks are activated by default for v-root.

How to create a symlink in gitbash?

You MUST run the GitBash as "Admin" user because it seems that Usermanagement in Windows just allows the symlink creation for "Admin" users *2) Afterwards you should be able to log into the vagrant box and create symlinks inside shared folders which showup in Windows explorer as .symlink files.


2 Answers

You just have to add the setextradata parameter for every shared folder mount.

config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/k5", "1"]
like image 92
StephenKing Avatar answered Oct 21 '22 22:10

StephenKing


Or from the command line

VBoxManage setextradata <VM Name> VBoxInternal2/SharedFoldersEnableSymlinksCreate/<volume> 1
like image 39
OrangeDog Avatar answered Oct 21 '22 21:10

OrangeDog