Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shared folder in VirtualBox for Apache

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.

like image 282
mqsoh Avatar asked Jun 09 '11 20:06

mqsoh


People also ask

Can VirtualBox mount shared folder?

To share a host folder with a virtual machine in Oracle VM VirtualBox, you must specify the path of the folder and choose a share name that the guest can use to access the shared folder. This happens on the host. In the guest you can then use the share name to connect to it and access files.


1 Answers

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 
like image 195
mqsoh Avatar answered Sep 22 '22 12:09

mqsoh