[英]Vagrant shared folder without sync
How can I have a shared folder (access to the same folder from both host and guest machines) WITHOUT any syncing method running? 如何在不运行任何同步方法的情况下拥有共享文件夹(从主机和来宾计算机访问同一文件夹)? (I want to use my own rsync script which is exactly what I need without the Vagrant file sharing performance penalties).
(我想使用我自己的rsync脚本,这正是我所需要的,而没有Vagrant文件共享性能损失的情况)。
I have tried 我努力了
config.vm.synced_folder ".", "/vagrant", disabled: true
but it disables the entire share. 但会禁用整个共享。
I'm using Vagrant 1.8.1 on Windows 7 (host) with Virtualbox 5.0.12 and guest OS is Ubuntu 12.04. 我在带有Virtualbox 5.0.12的Windows 7(主机)上使用Vagrant 1.8.1,来宾操作系统为Ubuntu 12.04。
You can indeed share a folder simply using the VirtualBox Manager. 实际上,您只需使用VirtualBox Manager即可共享文件夹。
vagrantfile
): config.vm.synced_folder ".", "/vagrant", disabled: true
vagrantfile
): config.vm.synced_folder ".", "/vagrant", disabled: true
FolderName
) in "Folder Name:" FolderName
) /media/sf_FolderName
/media/sf_FolderName
的来宾Linux中 sudo adduser vagrant vboxsf
and sudo chmod 777 /media/sf_FolderName
and it DID NOT WORK for me - vagrant user still gets permission denied
. sudo adduser vagrant vboxsf
和sudo chmod 777 /media/sf_FolderName
,但对我而言它sudo chmod 777 /media/sf_FolderName
-流浪用户仍然获得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. 顺便说一句,这是我的rsync公式(带有每秒轮询的手表),对我来说真的很好。
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). 注意:仅当您在主机上进行更改时(例如,在Windows中使用编辑器进行开发),该方法才有效。 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.
如果您要在来宾上进行更改(例如git pull),您将要停止watch / rsync的运行,并手动朝另一个方向复制。 Not ideal, but at least developing with this setup is fast.
这并不理想,但是至少使用这种设置进行开发是很快的。
Thanks to Frederic Henri for nudging me in this direction. 感谢Frederic Henri在这个方向上推动我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.