Wednesday, July 7, 2010

How to configure shared folders between Windows-host and Ubuntu-guest on VirtualBox

Shared Folders is a feature provided by VirtualBox to share folders between the 2 operating systems (host and guest).
To configure shared folders on VirtualBox Ubuntu guest, follow these steps:
  1. Make sure that Guest Additions are already installed, if not, install them: From the VirtualBox's menu go to Devices -> Install Guest Additions.

    This will mount a virtual CD on your /media/cdrom. Normally this folder's window will show up.

    As root run the program VBoxLinuxAdditions-x86.run (or VBoxLinuxAdditions-amd64.run if you're using 64bit).

    sudo /media/VBOXADDITIONS_3.2.6_63112/VBoxLinuxAdditions-x86.run
    When the program completes reboot your VirtualBox.

  2. You may now go ahead and define the shared folder(s). From the VirtualBox's menu go to Devices -> Shared Folders. A dialog will show up. In this dialog you can specify which folder from your Windows system you want to share with your Ubuntu. Press the button with the + symbol to add a new shared folder in the list. You will have to specify a Folder Name for each folder you add. Make sure you memorize that name because you will need it in the next step. in this example it's SHARED

    When done with your shared folder(s) specification, you may now go ahead and actually mount these folders from Ubuntu. First you have to create a mounpoint, that is, a directory in your Ubuntu which will reflect the shared folder from Windows:

    sudo mkdir /media/windows-share
    Of course you may choose an alternative path for your mountpoint. With your mountpoint created you can now mount the shared folder, like this:

    sudo mount -t vboxsf folder-name /media/windows-share
    Where folder-name will be the name you assigned for this folder when you were adding it in the shared folders list. in this example it will be SHARED

  3. You could use the /etc/init.d/rc.local script to execute these commands on startup to have the shared folders automatically mounted every time you start your Ubuntu VirtualBox.

No comments: