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.

To answer the specific question "how do I go about debugging the mount":

(the below is paraphrasing, based on an investigation I just did into a problem caused by the same bug in Virtualbox, but with a different web server)

After diagnosing the problem is happening somewhere in how Apache reads files inside the virtual host, I would use "strace -p" inside the virtual host to log system calls by Apache.

While stracing, request just the one truncated/corrupted file.

Careful diagnosis will reveal that it is correctly stat'ing the file to get its length. And then it is serving it using the sendfile syscall. Basically confirming sendfile is misbehaving, meaning it must be a bug in the virtual machine.