Ubuntu – auto-mounting shared folders in VirtualBox

automountshared-foldersUbuntuvirtualbox

I am writing to ask what the effect of the auto-mounting process is in VirtualBox, and where the folders can be accessed within a guest Linux system if auto-mount is used.

I have VirtualBox 4.0.4 installed on Mac OS 10.6.7, with Guest Additions apparently running correctly. The guest OS is Ubuntu 10.04, and I observe no apparent problems with it. I find that if the shared folders have "auto-mount" unchecked in the VirtualBox settings, they can then be mounted using the prescribed syntax

sudo mount -t vboxsf folder_name path_to_mount_point

and all works as it is supposed to.

But if the auto-mount option is checked, then I find that I can no longer mount the shared folders manually. I get the error

mounting failed with the error: Invalid argument

and the folders also do not appear to mount anywhere else accessible to me. Using the syntax

sudo mount -t vboxsf

without specifying a path installs them in /media, with their names prefixed with sf_, but they are not easily accessible there and I have not been able to change their owner using chown, either.

Thanks for your patient explanation.

Best Answer

I had similar problems and found that my fstab wasn't auto mounting for some reason, whether I had the Auto mount checked or not. So I tried this approach instead and it worked fine:

  1. Create a directory to mount into (if you haven't already): mkdir -p /mnt/path_to_mount_point
  2. Edit your rc.local file: nano /etc/rc.local
  3. Append the following line and save: mount.vboxsf -w -o fmode=0777,dmode=0777 folder_name /mnt/path_to_mount_point

Reboot and it should mount with the correct permissions.