有时无法访问同步文件夹中新创建的文件

时间:2014-08-15 15:24:10

标签: linux virtual-machine vagrant virtualbox virtualization

有时我会获得新创建的文件,我无法访问,但我可以在控制台中列出它们。我的Vagrant file包含此synced_folder设置:

config.vm.synced_folder "/home/ulkas/Develop/beauty/Beautyportal", "/vagrant/Beautyportal", owner: "vagrant", group: "vagrant", :mount_options => ['dmode=777', 'fmode=777']

当我在主机和访客中创建/修改文件时,它们就会变得无法访问:

cannot access GuzzleStreamWrapper.php: No such file or directory

什么都没有,我可以在控制台中列出它们,但没有权限(看起来像挂载问题):

vagrant@precise64:/vagrant/Beautyportal/vendor/guzzlehttp/streams/src$ ls -al
ls: cannot access functions.php: No such file or directory
ls: cannot access NoSeekStream.php: No such file or directory
ls: cannot access LazyOpenStream.php: No such file or directory
ls: cannot access MetadataStreamInterface.php: No such file or directory
ls: cannot access StreamInterface.php: No such file or directory
ls: cannot access LimitStream.php: No such file or directory
ls: cannot access AppendStream.php: No such file or directory
ls: cannot access Stream.php: No such file or directory
ls: cannot access CachingStream.php: No such file or directory
ls: cannot access StreamDecoratorTrait.php: No such file or directory
ls: cannot access GuzzleStreamWrapper.php: No such file or directory
total 12
drwxrwxr-x 1 vagrant vagrant 4096 Aug 14 11:33 .
drwxrwxr-x 1 vagrant vagrant 4096 Aug 14 11:33 ..
?????????? ? ?       ?          ?            ? AppendStream.php
?????????? ? ?       ?          ?            ? CachingStream.php
?????????? ? ?       ?          ?            ? functions.php
?????????? ? ?       ?          ?            ? GuzzleStreamWrapper.php
?????????? ? ?       ?          ?            ? LazyOpenStream.php
?????????? ? ?       ?          ?            ? LimitStream.php
?????????? ? ?       ?          ?            ? MetadataStreamInterface.php
?????????? ? ?       ?          ?            ? NoSeekStream.php
?????????? ? ?       ?          ?            ? StreamDecoratorTrait.php
?????????? ? ?       ?          ?            ? StreamInterface.php
?????????? ? ?       ?          ?            ? Stream.php
drwxrwxr-x 1 vagrant vagrant 4096 Aug 14 11:33 .svn

重新启动机器(vagrant reload)后,文件变得可访问,因此我怀疑安装/重新安装有问题。

这个问题已经出现在linux mint 13主机以及windows 7 64bit主机上。 框是hashicorp/precise64

1 个答案:

答案 0 :(得分:0)

我认为我发现了问题,这是由于重复安装 - 默认情况下,vagrant将活动主机目录/home/user/vagranthost安装到/vagrant。我所做的是,我将另外的子目录作为/home/user/vagranthost/project之类的挂载点添加到/vagrant/project中,从而创建了一个碰撞,流浪者无法识别(尚未)并让它安装。

因此,解决方法是编辑Vagrantfile并更改行

config.vm.synced_folder "/home/ulkas/Develop/beauty/Beautyportal", "/vagrant/Beautyportal", owner: "vagrant", group: "vagrant", :mount_options => ['dmode=777', 'fmode=777']

进入

config.vm.synced_folder "/home/ulkas/Develop/beauty", "/vagrant", owner: "vagrant", group: "vagrant", :mount_options => ['dmode=775', 'fmode=775']

用于调试,这是在mount命令的输出之前:

/vagrant on /vagrant type vboxsf (uid=1000,gid=1000,rw)
/vagrant/Beautyportal on /vagrant/Beautyportal type vboxsf (uid=33,gid=1000,rw)
相关问题