I have a FreeBSD Vagrant box that looks like this:

# -*- mode: ruby -*-
# vi: set ft=ruby :


Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "chef/freebsd-10.0"

  config.vm.network "private_network", ip: ""
  config.vm.synced_folder '.', '/vagrant', :nfs => true, id: "vagrant-root"


However, if it tries to run in a directory path with too long a name it fails:

==> 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 '' '/vagrant'

Stdout from the command:

Stderr from the command:

mount_nfs: File name too long

Is there a way to resolve this other than copying the directory to one with a shorter name? Can I update FreeBSD stuff so it can accept larger file names?

  • Why is the paths' name that long? Normally you try to avoid those big lengths. – Sascha R. Jan 19 '15 at 11:55
  • paths with meaning are often very long. unix legacy is about short stuff – Skaperen Feb 14 '15 at 11:57

FreeBSD limits the length of mount point names to 88 chars. The reasons for this are somewhat esoteric, but has to do with aligning a memory structure on page boundaries[1].

You can patch the mount binary to use a larger limit or to remove it all together[2] but this may cause crashes. I have successfully removed the check (also for vagrant with nfs) and had it work without problems, but do so at your own risk. I did not do a full buildworld but rebuilt only the mount_nfs binary with the patch from the second link.

As a final note, I eventually decided that vagrant with nfs is too buggy and switched to using rsync shared folders instead.

[1] http://www.secnetix.de/olli/FreeBSD/mnamelen.hawk

[2] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=167105

protected by Michael Hampton May 8 '18 at 2:15

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.