Dec 4, 2010

How to Run Ubuntu in Virtual Machine From Windows

At work I now work a lot with Visual Studio on Windows 7 Professional. While I have to use Windows, I don't want to loose the functionality and power of Linux, so I run a virtual machine with Ubuntu Maverick. Both Windows and Linux run smoothly on my machine and I can share files among them. In this post I give some help for setting this up.

I chose Oracle's VirtualBox (also: VBox) as virtual machine. This decision was motivated mainly by speed. I tried Qemu and it was too slow to be usable. Bochs is also reputed to be slow, I didn't even try it. I found a performance comparison between VMWare, VirtualBox, KVM, and Xen. Most important I found operations per second on guest OS and I/O overhead. The reviewer concludes

To me, it seem that VMware and VirtualBox are the fastest virtual machine across the board. They have good CPU/memory performance, good disk access time and good network layer speed. 

KVM is, instead, a mixed beast: it has quite good CPU/memory and network speed, but it fail in the crucial I/O subsystem performance more often than not.

Xen is at the opposite end of the spectrum: it as respectable I/O access time but quite bad CPU/memory performance that, in turn, can badly influence network speed and CPU load also.

Installation of VBox is straightforward. It follows a short howto on sharing folders between a VirtualBox virtual machine with a Windows host and Linux guest OS.

  1. Install VirtualBox guest additions on the linux guest OS:
    1. in the running guest OS window, go to devices, install guest add-ons.
    2. make the VBox Additions iso available as drive: devices->CD/DVD->VBoxGuestAdditions.iso
    3. in the terminal (assuming the iso is automatically mounted as cd, which it is in Ubuntu): i) cd /media/VBOX... (exact name depends on version) ii) sudo sh (or the corresponding 64 bit version)
    4. maybe you need to restart your guest OS.
  2. Share folder:
    1. in the VirtualBox guest OS window menu go to devices->shared folders and choose the host OS folder and a name for it under VirtualBox, say VBoxShare. You can choose permanent and can make it read-only if you want.
    2. in the guest OS linux terminal: sudo mkdir /media/WindowsShare; sudo mount -t vboxsf VBoxShare /media/WindowsShare
    3. you can put this also in fstab to have the share folder come up automatically on every boot: sudo gedit /etc/fstab

      VBoxShare /media/WindowsShare/ vboxsf defaults 0 0

Enjoy. Please leave a comment below for questions and suggestions.


  1. Hey thanks for the step by step information on how to run a virtual machine with Ubuntu. I was wondering if there was a way to share files among Windows and Linux. Thanks for the link to VirtualBox. I hope the installation is as easy as your illustration.

  2. @Jason: Installation was easy as a pie. File sharing between host and guest is just a few clicks away.

  3. Ι ωish this worκed propеrly on аnԁгoіd.

    .. аlthough if it did I wοuld
    ρгobably just maκe stuff liκe thіs аll dаy and
    not get anythіng done...

    my webρagе; cheap personal loans