How to mount a VirtualBox shared folder? [closed]

Solution 1:

Ok this was a little confusing for me but I finally realized what was happening. So I decided to give my 2 cents in hopes that it will be more clear for others and if I forget sometime in the future : ).

I was not using the name of the share I created in the VM, instead I used share or vb_share when the name of my share was wd so this had me confused for a minute.

First add your share directory in the VM Box: enter image description here

Whatever you name your share here will be the name you will need to use when mounting in the vm guest OS. i.e. I named mine "wd" for my western digital passport drive.

Next on the the guset OS make a directory to use for your mount preferably in your home directory.

mkdir share

Next open the terminal and copy and paste the following or type it in. You can enable shared clipboard under Device-> Shared Clipboard-> Bidirectional

sudo mount -t vboxsf wd ~/share/

You should now be able to copy files between OS's using the folder "share" in your home directory.

Hope this Helps!

Solution 2:

For VirtualBox with a Linux guest, these are the steps to mount a shared folder:

  1. Use the VirtualBox host's application, VirtualBox Manager, to specify host folders to share.

  2. Make sure VirtualBox Guest Additions are installed in the VirtualBox guest.

  3. In the Linux guest, the mount command should show a line that the share was mounted. This is indicated by type vboxsf. The issue becomes that the mount point may not be where desired, and the permissions are root only. The default mount location is in /media/sf_.

  4. You can access the share by making the user, or group id of 1000, a member of group vboxsf. This is done by changing the vboxsf line in the /etc/group file. May require reboot.

  5. You can change where the folder is mounted by using the VBoxControl command. The command is installed when Guest Additions is installed. May require reboot. For example, to change the mount point from /media/sf_... to /home/toto/sf_... use the following command to set the VirtualBox shared folder guestproperty:

sudo VBoxControl guestproperty set /VirtualBox/GuestAdd/SharedFolders/MountDir /home/toto/

To confirm the change, use get:

sudo VBoxControl guestproperty get /VirtualBox/GuestAdd/SharedFolders/MountDir

References:

VirtualBox's Shared Folder Info

VirtualBox's guestproperty info

Solution 3:

When encountering:

mount: Protocol error

after trying to share folders in VirtualBox, eg:

$ sudo mount -o uid=1000,gid=1000 -t vboxsf D_DRIVE ~/host

this finally worked for me:

$ sudo apt-get install virtualbox-guest-dkms

(My setup: Windows 7 host, guests: Ubuntu 12.04,13.10,14.04; currently running VBox 4.3.10 r93012)