You can indeed share a folder simply using the VirtualBox Manager.
- Disable the Vagrant synced folder (in the
vagrantfile
):
config.vm.synced_folder ".", "/vagrant", disabled: true
- Install Guest Additions to VirtualBox
- Open VirtualBox Manager and select Settings > Shared Folders > Adds new shared folder (sic)
- Add your host path in "Folder Path:" and your guest name (eg
FolderName
) in "Folder Name:"
- Your guest name will appear in the guest linux in
/media/sf_FolderName
- Give your preferred guest user access to the folder. I did
sudo adduser vagrant vboxsf
and sudo chmod 777 /media/sf_FolderName
and it DID NOT WORK for me - vagrant user still gets permission denied
. Those commands seem to have worked for others, but I have ended up just working as root, which does have access.
Incidentally, here's my rsync formula (with a watch that polls every second) which works really well for me.
sudo watch -n 1 rsync -avh --delete --exclude-from=/media/sf_FolderName/FOLDERTOCOPY/rsync-exclude.txt /media/sf_FolderName/FOLDERTOCOPY /path/to/destination
NOTE: It works only if you're making changes on the host (eg developing using editor in Windows in my case). If you're making changes on the guest (eg git pull) you're gonna wanna stop this the watch/rsync from running and manually copy back in the other direction. Not ideal, but at least developing with this setup is fast.
Thanks to Frederic Henri for nudging me in this direction.