Shared folder in VirtualBox for Apache

apache, mount, shared-directory, virtualbox

Solution

I was wrong; it was happening elsewhere but I noticed that it was only with .css and .js files. A search led me to this post which talks about a problem with vboxsf and small files.

The solution is to set, in Apache

    EnableSendfile off

Problem

My host machine is ArchLinux and I'm running Apache in a CentOS guest. I have the vhost configuration and all the site code in a shared folder. To be able to put the vhost configuration in a shared folder I mounted the shared folder as apache:apache. ``` shared /mnt/shared vboxsf defaults,uid=48,gid=48 0 0 ``` When I'm editing files in the host, Apache will consistently start sending old versions of the file with trailing characters. In vim, they show up as ^@, so I guess they're null characters. The number of null characters is related to the number of changes I make even if I edit the first line, null characters show up at the end. If I were to speculate, it looks like a bad diff. If I stop `httpd`, `umount`, remount, and start `httpd` the file looks fine. Just restarting httpd doesn't help. How would I go about debugging the mount? Nothing jumped out at me in `/var/log`.

Original source

Related problems