2009-01-20

Mounting Shared Folder in VirtualBox - Linux Host With Linux Guest

i am using VirtualBox to run a Linux guest virtual machine in a Linux host (both Ubuntu Intrepid Ibex), and utilise VirtualBox's shared folder to copy files between host and guest.

Sometimes, i would get the following error message when trying to mount the shared folder in the guest machine:

/sbin/mount.vboxsf: mounting failed with the error: Protocol error

Searching on Google for the cause and solution led me to a few suggestions:

1. The kernel module may have not been loaded - try doing a modprobe vboxvfs.
2. The folder name in the guest machine cannot contain upper case letters (e.g. /mnt/Share).
3. The folder name in the guest machine cannot contain a dash (e.g. /mnt/sh-are).

After some experimentation, i may have found the solution (or perhaps "workaround" sounds more appropriate), and hopefully help others facing the same issue. i have to add though, that i am using Ubuntu 8.10 guest on Ubuntu 8.10 host, so am unaware if the same solution works for other combinations. Also, though those suggestions above did not work for me, one of them may just do the trick for people in slightly different situations (different combination or different root cause perhaps).

First, responses to the three suggestions above:

1. Doing modprobe vboxvfs did not work for me. i still faced the very same error message after that. In my case, the kernel module most probably has already been loaded beforehand.
2. The folder name i am using does not contain any upper case letters. In any case, after using the workaround (to be described below), i tried and can use upper case letters without problem.
3. Same findings as suggestion (2).

Now, the solution (or workaround) i found is that the mount command cannot be issued in the folder that contains the shared folder itself. For example, if the shared folder is /mnt/share, the mount command cannot be issued from the /mnt folder (even if the full path is provided i.e. sudo mount -t vboxsf share /mnt/share). Another example, if the shared folder is /share, the command can be issued from any working directory except for /.

Strange, but this finding works for me, and i hope you will find it useful as well.

0 comments: