Header Ads

Share folders in Virtual Box running Ubuntu-guest on Windows-host

Sun xVM VirtualBox is a powerful x86 virtualization product for home and enterprise use which supports a large number of guest operating systems such as Windows (NT 4.0, 2000, XP, Server 2003, Vista, 7), DOS/Windows 3.x, Linux (2.4 and 2.6), Solaris and OpenSolaris, and OpenBSD. VirtualBox also has Shared Folders feature, which is common among virtualization solutions to provide easy data exchange between hosts and guests.

In Sun xVM Virtual Box, VirtualBox allows user to select and declare folders and directories on host machine as “shared folders”. After setting the shared folders, user can then access these shared folders from within the guest operating system of the virtual machines. In Windows XP
and Vista guest, user can see the VirtualBox Shared Folders from within its entire network neighborhood.

Although Virtual Box provided an option of shared folder, it is not straightforward to use this shared folder. It took me some searches on VirtualBox forum to find it how Ubuntu guest OS can access the shared Folder on WinXP host OS.


Start the Virtual Machine on which you want to work. First you have to make sure that have install Guest Additions. 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.run. When the program completes reboot your VirtualBox.

With Guest Additions installed 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 very soon.

When done with you shared folder(s) specification, you may now go ahead and actually mount these folders from Ubuntu. First you have to create a mountpoint, 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.

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.