Virtualbox shared folder mount from fstab fails; works once bootup is complete

I ran afoul of this problem too. I mount /var/www using VBox shared folders functionality, so this was quite annoying.

The solution I found was to force the vboxsf module to be loaded early, before the mounting of file systems. Just add vboxsf on a line of its own in /etc/modules.

Another solution is to set noauto in /etc/fstab and manually mount drives in /etc/rc.local, but this wasn't such a good solution for me because by that time Apache has already started and been unable to find anything in /var/www.


In addition to Richard Turner's suggestion of adding vboxsf on a line of its own to /etc/modules, I suggest adding the _netdev mount option to /etc/fstab. I tested on Ubuntu 12.04 LTS and this seems to add just the right amount of delay for the mount to succeed.

My /etc/fstab entry:

dev /media/dev vboxsf defaults,_netdev 0 0


Richard's fix stopped working for me after the last update (VirtualBox 4.3.18, Ubuntu 14.04). Luckily I was able to fix it, by loading vboxsf right with the kernel:

# echo "vboxsf" >> /etc/initramfs-tools/modules
# update-initramfs -u

The first command adds a parameter to load the module to the kernel and the second updates the init file system. After a reboot I was able to use my fstab-mounts again :)

Warning: The boot process might freeze, if a shared folder cannot be mounted. So test your configuration, before you add the module to initramfs. If your system hangs anyway, you can boot in recovery mode to fix the problem.