Skip to content


Subversion checkout URL

You can clone with
Download ZIP


shared folder problem #351

till opened this Issue · 20 comments

9 participants


We've run into weird inconsistency issues with shared folders.

This is the configuration in Vagrantfile:

config.vm.share_folder("v-data", "/vagrant_data", "~/project")

When I edit a file on the share -- either by vagrant ssh into the VM and editing directly, or on the host system -- I can see the change done to a file when I cat foo, etc.. However, it gets tricky when this file is a static asset served by nginx. So no matter what I do, the state of the file is not refreshed and the content delivered is the same as when I started the VM (vagrant up). To refresh the file I have to either rename it permanently, or vagrant destroy && vagrant up.

My nginx configuration is pretty generic. The reason why I rule out nginx is, that I ran into someone with the same issue, and he's using a share_folder in Vagrant as well.

I found this issue in 0.6.9 and also 0.7.3.

Supposedly this works better when an NFS export is used. I'm testing this next.


This same thing has happened to me. OH GOD, this is so frustrating.

I'm going to ask a co-worker how we fixed this tomorrow (if we even did). This was so dumb.


We fixed it using NFS.

On Ubuntu: aptitude install nfs-common

This has to be done both on the host and in your box. Since you can't do it via provisioning, you may have to re-package the box.


@mitchellh Any idea yet?



Yes, this has been solved. This is due to a bug/issue with the sendfile syscall that servers typically use to serve static files. The easiest thing to do is add this configuration option to Apache:

EnableSendfile Off

Or if you use nginx:

sendfile off;


@mitchellh mitchellh closed this

Ah, is this solvable in vagrant too, or is this something virtualbox has to fix?


This is something VirtualBox has to fix, unfortunately. For now, please use the proper configuration option for your servers.


Ok, just wanted to be sure.

Sorry to keep asking questions, but any idea if they are tracking this?



I wasn't able to find any tickets...



Adding a link for completeness:


I lost a ████ing hour and a half to this nonsense. Any thoughts on how this could be automatically detected? A scan of /etc/nginx.conf for sendfile on; (and the same for Apache), resulting in a warning on vagrant up?


I'd be a bit worried that Vagrant scanning nginx or apache configs would be doing too much. There are various ways that this could surface, and it really is up to VirtualBox to fix this issue. I realize it is frustrating (I too spent hours until I stumbled upon the answer), but I think that adding this to Vagrant would not be correct.


I think the shared folder documentation would be a good place to put a warning. The docs are open source in the docs branch if you'd like to make a pull request, otherwise I can add it when I can get to it.


The bug in VirtualBox still seems to be present, but in the new documentation for synced_folders the note about sendfile seems to have been dropped.


@mitchellh Would it be possible to put a blurb about this in the new docs? I noticed it is in the v1 documentation but missing from the new docs.

Just spent a few hours banging my head against the wall here as well.

@chenders chenders referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@swalkinshaw swalkinshaw referenced this issue from a commit in roots/trellis
@swalkinshaw swalkinshaw Turn off sendfile in development
Virtualbox has a bug that could cause static files to not update and
seem cached. References:

* (Virtualbox section)
* mitchellh/vagrant#351 (comment)
@pvoznenko pvoznenko referenced this issue from a commit in pvoznenko/Vagrant-CentOS-6.4-Puppet-Base-Repository
@pvoznenko pvoznenko Added 'sendfile off' to nginx config
because vagrant inherit bug from virtualbox regarding shared folders
in some point it could corrupt files. When you change a file on/in a shared folder,
the change is not seen when through a webserver (e.g. nginx).
for more info: mitchellh/vagrant#351 (comment)
ticket at VB:
@nathanielks nathanielks referenced this issue from a commit in nathanielks/layer-4-bedrock-ansible
@swalkinshaw swalkinshaw Turn off sendfile in development
Virtualbox has a bug that could cause static files to not update and
seem cached. References:

* (Virtualbox section)
* mitchellh/vagrant#351 (comment)

There is another VirtualBox ticket here for this same issue. It all seems to be being ignored. :-(


I had the same issue and tried NFS. NFS possibly corrupted my git index. I had an error similar to this:

Not sure where it came from exactly as I just booted up to find that error, though this coincides with the first time I used NFS.


Please add the information about Virtualbox send file bug on:

@zaa zaa referenced this issue in ninenines/cowboy

Allow disabling sendfile through configuration #812

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.