如何移动Vagrant VM文件夹



有没有一种方法可以在不出现nfs共享文件夹和/etc/exports问题的情况下移动流浪vm文件夹?

每当我试图在任何其他盒子(例如:vagrant up)上操作时,试图移动机器(停止)会导致以下错误:

==> default: Exporting NFS shared folders...
NFS is reporting that your exports file is invalid. Vagrant does
this check before making any changes to the file. Please correct
the issues below and execute "vagrant reload":
exports:14: path contains non-directory or non-existent components: /Users/[...]/vm
exports:14: no usable directories in export entry
exports:14: using fallback (marked offline): /

我来晚了一点,但我也遇到了同样的问题,我想分享我的解决方案,以防其他人也遇到这个问题。

我最终更改了/etc/exports(在主机上)中的路径,例如:

# VAGRANT-BEGIN: 501 121121ae-813d-4546-8fbb-f44c591f5529
"/Users/me/wrong/dir" 192.168.3.103 -alldirs -mapall=501:20
# VAGRANT-END: 501 121121ae-813d-4546-8fbb-f44c591f5529

在那里,您可以更改主机上的路径。然后在vagrant reload之后,它应该工作。

路径也存储在.vagrant/machines/default/virtualbox/synced_folders中(目录名取决于您使用的提供商和是否使用默认机器),我先尝试更改它,但这还不够,然而,如果您不在那里也更改它,可能会混淆Vagrant——为了安全起见,您也应该在那里更改它。

不幸的是,如果不手动更改这些文件或销毁盒子,我不知道有什么方法可以做到这一点。

最新更新