【发布时间】:2015-06-20 13:55:43
【问题描述】:
好的,这是我的问题: 我将 vagrant 与 VirtualBox 一起使用。主机是 Windows 8.1,来宾是 Ubuntu(64 位)。我正在尝试使用由
创建的符号链接的 windows 文件夹mklink /j somefolder someotherfolder
作为 Vagrant 中的同步文件夹。在我的 Vagrantfile 中有
# disable the default synced folder
config.vm.synced_folder ".", "/vagrant", disabled: true
# sync my desired folder
config.vm.synced_folder "./somefolder", "/vagrant"
不幸的是,这不起作用,但会出现以下错误:
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`
vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
The error output from the last command was:
stdin: is not a tty
/sbin/mount.vboxsf: mounting failed with the error: Invalid argument
在您询问之前:已安装来宾添加,并且安装常规文件夹可以完美运行。
有没有办法在 vagrant 中使用符号链接目录作为 vbox 中的同步文件夹?
感谢您的帮助!
【问题讨论】:
-
/j 创建联结,与符号链接不同,/d 创建符号链接。这可能会对你的情况产生影响,我不知道。除此之外,请确保 someOtherFolder 是绝对路径,并且它在 Windows 资源管理器和/或 cmd.exe 中可见/可访问,独立并且在使用联结/符号链接创建联结/符号链接之后。
-
我尝试了 /d 和 /j。不幸的是,它没有任何区别。我找到了一种方法来完成这项工作,尽管我不确定我是否喜欢它。当我将文件夹与 SMB 同步(config.vm.synced_folder“./somefolder”、“/vagrant”、输入:“smb”)时,它似乎可以工作。 Vagrant 文档说,对 SMB 的支持仍然有点粗糙,不过......
-
谢谢,这个问题帮助我意识到符号链接对我来说是个问题。切换到在原始目录中运行
vagrant up为我解决了这个问题。 (虽然我猜这对你的情况没有帮助。)
标签: windows vagrant symlink shared-directory