How to Setup Folder Sharing with VirutalBox Guests

virtualbox-thumbHaving a virtual machine installed on a personal computer offers many uses.  One use is the ability to try a new operating system before it is released, such as Windows 7.

Once you’ve installed a virtual operating system, you might want to access files that are stored on the host operating system.  VirtualBox offers a feature called ‘Shared Folders’ which will allow you to share files between the host and guest operating systems.

Linux Host with Windows Guest

Steps performed in host (Linux)

  1. Verify that the guest virtual machine has been shut down.
  2. Open the terminal from Applications > System Tools > Terminal
  3. Enter the following, substituting the virtual machine name, shared folder name, and the path to files on the host.
  4. VBoxManage sharedfolder add “virtual machine name here” -name “shared folder name” -hostpath “/path/to/files/here

  5. Start the guest operating system.

Steps performed in guest (Windows)

  1. Start the guest operating system from the host.
  2. Install Guest Additions from Devices > Install Guest AdditionsNote: You will need to restart.
  3. Open the command prompt from Start > Run… > cmd.
  4. Enter the following into the command prompt, substituting the shared folder name entered in step 3 above.
  5. net use p: \\vboxsvr\shared folder name /PERSISTENT:YES

  6. Adding the /PERSISTENT:YES to the command will mount the share at every boot.
  7. You can also change the drive letter from p: to any other you wish.

Windows Host with Linux Guest

Steps performed in guest (Linux)

  1. Start the guest operating system from the host.
  2. Before Guest Additions can be installed, some dependencies need to be installed using the command below.
  3. sudo yum install kernel-headers kernel-devel gcc

  4. After the dependencies have been installed, you can install Guest Additions from Devices > Install Guest Additions.
  5. Open the terminal and enter the following line
  6. sudo cd /media/VBOXADDITIONS_(VirtualBox Version Number)

    Once the guest additions have been installed, you will need to restart the guest OS.

  7. When the guest has restarted, open Shared Folders from Devices > Shared Folders… from the guest window.
  8. Click the Add New Shared Folder icon on the right of the window, or press the Insert button on your keyboard.
  9. At the Add Share window, select Other… from the Folder Path drop down and select the path of the folder on the host that you wish to share with the virtual guest.
  10. In the Folder Name enter a name of the shared folder, such as MyShare.
  11. Click the Make Permanent checkbox if you wish to keep the changes and click Ok to close the dialog.
  12. Open the terminal and enter the following command to mount the shared folder.
  13. sudo mount -t vboxsf sharename mountpoint
    Eg. sudo mount -t vboxsf MyShare /home/dustin/Desktop/Shared

  14. The above command will not keep the shared folder mounted after restarting the system.  To mount when starting the system, you will need to edit your fstab as shown below.
  15. sudo nano /etc/fstab
    sharedname mountpoint vboxsf defaults 0 0
    eg. MyShare /home/dustin/Desktop/Shared vboxsf defaults 0 0

  16. Your shared folder will now be mounted at boot.

Once the above steps are completed, you will now be able to access files on your host operating system from your VirtualBox guest operating system.

Fix: Connecting USB Devices To VirtualBox On Fedora 11


Update: This problem has been resolved in VirtualBox Version 3.0.8. Remove the following fix before upgrading to 3.0.8 to take advantage of the update.  For help on installing VirtualBox on Fedora 11, checkout our guide.

I have come across one problem with VirtualBox on Fedora 11 – USB devices are listed in the device manager but are grayed out and cannot be enabled.  To see if this problems exists on your system you can navigate to Devices > USB Devices in a running virtual machine console window.  The devices physically connected to the host are shown, but are grayed out and are not clickable, preventing them from being connected to the virtual machine.

To correct the problem, edit /etc/fstab and add the following line:

none /sys/bus/usb/drivers usbfs devgid=501,devmode=664 0 0

Substitute “devgid=501” with the id of the vboxusers group which all VirtualBox users should be part of.  The id of the vboxusers group can be found by navigating to System > Administration > Users and Groups.

Once you are finished, power off all virtual machines.  Run the following command in Fedora to enable USB support:

mount -a

When you power on your Virtual Machine next time, the USB devices under Devices should no longer be grayed out and are now clickable, allowing you to connect them to your virtual machines.

How to Install VirtualBox in Fedora 11

fedora-logoFedora 11, the most recent release of the Fedora Linux distribution, includes built-in virtualization capabilities.  Virtualization allows you to install an operating system from within another operating system, which can be a great way to test out a new version of Windows.

Since Fedora’s included virtualization is mainly geared towards developers, many users prefer a different virtualization platform such as VirtualBox which can be used in both Linux and Windows.

Installing VirtualBox in Fedora 11

  1. As root, install the necessary dependencies with yum.
  2. yum install -y qt qt-x11 xine-lib kernel-devel gcc

  3. When the above dependencies have been installed, download the VirtualBox RPM from (At the time of writing I downloaded Version 3.0.4)
  4. Install the VirtualBox RPM you downloaded, replacing the text in the < > with the name of the file you downloaded.
  5. rpm -ivh .rpm

  6. After the installation completes, add your account as a member of the vboxusers group.  To do this, navigate to System > Administration > Users and Groups, select your account and click Properties.  Click the Groups tab and check the box for vboxusers to add your account to the group.
  7. Consult /var/log/vbox-install.log if you receive any error messages or experience any problems during the installation.
  8. If there are any errors in the above log, correct them and run the setup script as root by entering

    /etc/init.d/vboxdrv setup

  9. Start VirtualBox by typing “VirtualBox” in the terminal or navigating to Applications > System Tools > Sun VirtualBox in the Gnome desktop.
  10. Agree to the License.

Once the above steps are complete, you will have VirtualBox installed on Fedora 11.