mercoledì 19 gennaio 2011

VirtualBox Shared folders on Ubuntu 10.04 client

Required: Virtualbox Guest Additions. See this post: http://diegobenna.blogspot.com/2011/01/how-to-install-virtualbox-guest.html

Prepare host

Click on Devices and then Shared Folders in Virtualbox:


Click on the add button in the Shared Folder dialog:


Click on the down arrow in the Folder Path field, select Other and navigate to the folder you create:

 

Make a note of the Folder Name since you'll be needing it in a minute. Check off Make Permanent to ensure the shared folder stays shared after you shutdown or reboot your virtual machine:


Prepare guest
If the client is Linux, you have to mount and connect it to a folder.

The following bash commands (in the client) would setup a correct mount (and creates a link from your desktop) Note: you should not use spaces in the share name.

sudo mkdir /mnt/sharename 
sudo chmod 777 /mnt/sharename
sudo mount -t vboxsf -o uid=1000,gid=1000 Example-Shared-Folder /mnt/sharename
ln -s /mnt/sharename $HOME/Desktop/sharename

Note: if you want to mount the folder as owned and writable only by root, omit the  -o uid=1000,gid=1000  option to the mount command.

For the above command if you get error as

mount: unknown filesystem type 'vboxsf'

Then just change the vboxsf to vboxfs

If error persist install virtualbox guest utils:

sudo apt-get install virtualbox-ose-guest-utils

end reboot the virtual machine.

To ensure the shared folder is mounted whenever your virtual machine is booted, run the following command: sudo nano /etc/rc.local and enter the command you entered in the last step (without the sudo in front) into this file below the hashes (i.e., #'s) but above “exit 0” (note that the arrow keys move the cursor and ctrl+x is used to exit which will prompt you to save first, answer Y, then hit Enter)

sudo mount -t vboxsf -o uid=1000,gid=1000 Example-Shared-Folder /mnt/sharename


Exit the terminal by typing: exit or by pressing ctrl+d.

Congratulations, you now have a functional Linux Mint virtual machine to use for any purpose you see fit. Please see below if you would like to enable hardware video acceleration on your virtual machine.

6 commenti:

  1. Wouldn't it be better if you change /etc/fstab in the VirtualBox Ubuntu client?

    Then you don't need to change /etc/rc.local, and upgrades of that file will go much smoother in the future.

    RispondiElimina
  2. sudo apt-get install virtualbox-ose-guest-utils
    That line saved me. Thanks a lot...

    RispondiElimina
  3. You the man! Who'd have thought of installing:

    virtualbox-ose-guest-utils

    Cheers

    RispondiElimina
  4. thank you very much for your tips solved my issues!!

    RispondiElimina