流浪者同步的文件夹无法在VirtualBox上实时工作 [英] vagrant synced folders not working real-time on virtualbox

查看:111
本文介绍了流浪者同步的文件夹无法在VirtualBox上实时工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已同步的文件夹无法正常工作,它们在启动时已被一次性同步,但是当我在主机上进行更改时,vagrant无法实时同步它.

my synced folders are not working properly, they are synced one-time at start but when I make changes on the host machine, vagrant is not syncing it real-time.

首先,我的系统上有一些细节:

First some details on my system:

  • 操作系统:Linux Mint 18 Sarah
  • Virtualbox版本:5.0.24-dfsg-0ubuntu1.16.04.1
  • 流浪版本:1.9.0
  • vagrant-hostmanager(1.8.5)
  • 无用份额(1.1.6)
  • vagrant-vbguest(0.13.0)

在我们开始讨论之前,我没有使用Virtualbox的最新版本,因为它不在存储库中,并且简单的vagrant up失败.

Before we start discussing, I am not using newest version of Virtualbox since it is not in the repository and a simple vagrant up fails.

我的Vagrantfile:

My Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.vm.network "private_network", ip: "192.168.88.88"
  config.vm.hostname = "my.centos.dev"
end

vagrant up给我.

现在,当我在主机上创建文件时:

Now when I create a file on the host machine:

falnyr@mint:~/centos-vagrant $ ls
ansible  Vagrantfile
falnyr@mint:~/centos-vagrant $ touch file.txt
falnyr@mint:~/centos-vagrant $ ls
ansible  file.txt  Vagrantfile

然后SSH到访客机:

falnyr@mint:~/centos-vagrant $ vagrant ssh
[vagrant@my ~]$ ls /vagrant/
ansible  Vagrantfile

如您所见,该文件未创建.当我执行vagrant reload时,同步将在计算机启动期间再次执行.

As you can see, the file is not created. When I perform vagrant reload the sync is executed again during machine boot.

注意:由于我需要跨平台的环境,因此我无法使用NFS同步.

Note: I cannot use NFS sync, since I need cross-platform ready environment.

关于如何启用实时同步的任何想法?

Any ideas on how to enable real-time sync?

推荐答案

默认情况下,该框的所有者已启用rsync的同步类型.如果您查看包装盒的Vagrantfile(在我的案例中为~/.vagrant.d/boxes/centos-VAGRANTSLASH-7/0/vmware_fusion,但您的包装可能在virtualbox提供商的支持下),则会看到包含内容的Vagrantfile

The owner of the box has enabled rsync by default on the sync type. If you look at Vagrantfile of your box (in my case its ~/.vagrant.d/boxes/centos-VAGRANTSLASH-7/0/vmware_fusion but yours might probably under the virtualbox provider) you'll see a Vagrantfile with content

Vagrant.configure("2") do |config|
  config.vm.synced_folder ".", "/vagrant", type: "rsync"
end

只需从box目录中删除此文件,它就会起作用.

Just remove this file from the box directory and it will work.

请注意,如果您打算使用nfs,则可以在Vagrantfile中更改同步类型

note if you plan to use nfs you can change the sync type in your Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.vm.network "private_network", ip: "192.168.88.88"
  config.vm.hostname = "my.centos.dev"
  config.vm.synced_folder ".", "/vagrant", type: "nfs"
end

这篇关于流浪者同步的文件夹无法在VirtualBox上实时工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆