2015-11-07 61 views
1

我想在我的windows10上使用virtualbox構建一個centos7虛擬機。我正在使用cento/7盒。 它默認使用rsync來同步文件夾,我不太喜歡它,因爲我不得不打開額外的cmd來運行vagrant rsync-auto進行常量同步。 我試圖使用nfs但不成功。 這是我的vagrantfile。流浪漢 - 不斷同步文件夾設置

Vagrant.configure(2) do |config| 
    config.vm.box = "centos/7" 
    config.vm.synced_folder ".", "/home/vagrant/sync", type: "nfs" 
end 

當我試圖運行它。它給了我這個。

Failed to mount folders in Linux guest. This is usually because 
the "vboxsf" file system is not available. Please verify that 
the guest additions are properly installed in the guest and 
can work properly. The command attempted was: 

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` home_vagrant_sync /home/vagrant/sync 
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` home_vagrant_sync /home/vagrant/sync 

The error output from the last command was: 

mount: unknown filesystem type 'vboxsf' 

我注意到,主機所做的更改將會同步到guest,但不會相反。我想讓文件夾像共享文件夾一樣,guest和host都可以對其進行更改。任何最好的方法來做到這一點? 謝謝。

回答

0

你得到的回覆是告訴你安裝Virtual Box guest添加。這是一個單獨的安裝操作,您必須在安裝Virtual Box之前執行此操作。你安裝了Virtual Box Guest Additions嗎?

+0

謝謝。安裝VBoxGuestAdditions後,它可以正常工作。我在這裏遵循手冊(https://www.virtualbox.org/manual/ch04.html),但我發現它有點過時。它應該是點擊「設備」中的「光驅」來掛載VBoxGuestAdditions.iso。然後,使用命令「mount/dev/cdrom/mnt」將iso掛載到guest虛擬機vm。隨後會更容易遵循手冊。我想無論如何要通過vagrantfile安裝Virtualbox guest添加件嗎? – wachiu

+0

是的,你可以使用這個Github Gist https://gist.github.com/fernandoaleman/5083680 –