我有一个FreeBSD Vagrant框,如下所示:
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "chef/freebsd-10.0" config.vm.network "private_network", ip: "10.0.1.10" config.vm.synced_folder '.', '/vagrant', :nfs => true, id: "vagrant-root" end
但是,如果它尝试在名称太长的目录path中运行,它将失败:
==> default: Mounting NFS shared folders... The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed! mount -t nfs '10.0.1.1:/Users/petersouter/projects/reallylongpathnameover88characterssothatmountfswillfail12345678910111213141516' '/vagrant' Stdout from the command: Stderr from the command: mount_nfs: 10.0.1.1:/Users/petersouter/projects/reallylongpathnameover88characterssothatmountfswillfail12345678910111213141516: File name too long
有没有办法解决这个问题,而不是复制目录到一个较短的名称? 我可以更新FreeBSD的东西,以便它可以接受更大的文件名?
FreeBSD限制挂载点名称的长度为88个字符。 其原因有些深奥,但与页面边界alignment内存结构有关[1]。
您可以修补装载二进制文件使用更大的限制或一起删除它[2],但这可能会导致崩溃。 我已经成功地取消了这个检查(对于nfs的stream浪汉也是如此),并且没有问题,但是这样做风险自担。 我没有做一个完整的buildworld,但只用第二个链接的补丁重新构build了mount_nfs二进制文件。
作为最后一点,我最终决定使用nfs进行stream浪是太麻烦了,转而使用rsync共享文件夹。
[1] http://www.secnetix.de/olli/FreeBSD/mnamelen.hawk
[2] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=167105