I have a Vista/Ubuntu dual boot system, and would like to install VirtualBox to use both systems, but I don't want to uninstall any of these OS. If possible, what is the best way to accomplish this? I don't care about which OS will be the main system. I'm just after the best solution.



I recently wrote a blog post about this. Not sure what the etiquette is for this in terms of linking or copying content from. However here it is:

Seamless Ubuntu and Windows

Essentially you create a VMDK file for the Ubuntu drive and point VirtualBox at it using a bootable Grub mount as the boot media

(I also echo the current sentiments regarding backing up before doing anything just in case)

| improve this answer | |
  • I did this successfully with Ubuntu and XP. You will probably want to use Windows as the host, otherwise it will want to activate every time you switch "hardware", but there are ways around this. Needless to say, it would be best if the OS's are on different disks to help the IO bottleneck. – prestomation Aug 27 '09 at 12:16

VirtualBox will allow you to attach physical hard drives, including existing partitions, to virtual machines. The option is not exposed in the user interface, but is documented in the User Manual. I've done it in Ubuntu, and I believe it's also possible on Windows.

If you create a VM under one platform and attach the disks of the other platform, you should be able to run one in the other without wiping and reinstalling. Ubuntu is probably better at dealing with hardware changing around on an existing install, so I would recommend using Windows as the host.

You will almost certainly want to take a backup of your entire drive before attempting the instructions!

| improve this answer | |

AFAIK, there's not physical-to-virtual conversion tool for virtualbox. someone else may chime in with a different answer on that, though. There is the VMWare converter, but I'm not sure if VirtualBox can run VMWare VMs.

My advice would be to backup any data on the OS that you pick as the guest OS, then use a partition editing tool like PartedMagic to delete the guest OS's partitions and grow the host OS's partition(s) to fill the disk. Then, re-install the guest OS in VirtualBox on the host OS.

Whether you can do the P2V migration automatically or not, you'll still need to delete guest OS and grow your partition(s) for your host OS, and I've had great success with PartedMagic in the past.

| improve this answer | |

This will certainly be easiest if you make Vista the host OS. It's a bit of a hack, but you can certainly accomplish this with the following procedure:

  1. Create a new VirtualBox VM with a disk of the desired size
  2. Add your existing Ubuntu disks as additional disks to the VM
  3. Boot the VM off of some sort of live CD, I've found the Gentoo LiveCD works well for this purpose.
  4. Partition the virtual disk in a scheme similar to the way the physical Ubuntu partitions are created.
  5. Mount the physical Ubuntu partitions and copy their contents to the virtual partitions.
  6. Reboot the VM from the virtual disk

That's the general gist of it, but you should note there are a ton of caveats and likely a lot of little details you will have to take care of. It helps a lot to have intimate knowledge of the boot process of the Linux OS in question.

I've successfully performed a similar procedure numerous times moving a physical server to a virtual Xen server, and the same should also work for VirtualBox.

If you're not comfortable with using command line tools, partitioning, playing with boot loaders, and other low level things in Linux, this will either be quite difficult or a good learning experience.

At worst, you can always reinstall Ubuntu in virtualbox and use dpkg --get-selections and dpkg --set-selections to install the same set of packages, then mount and copy your home partition to get your settings back.

| improve this answer | |

I think I'm missing what the issue is...Virtualbox will install on either one (there's a Linux and Windows version as I recall), then you can boot a virtual system in which to install whatever operating system you want. You don't need to uninstall either OS, just need a lot of disk space.

Do you mean you want to share the VM's with whatever OS is currently running? In that case you'd need to create a third partition (or use an external disk) and use a filesystem that both can read; NTFS should work for this, as last I knew the latest version of Ubuntu can read and write NTFS and FAT32 won't let you create files over 2 gig in size.

| improve this answer | |

Best method for dual booting and using both in virtuals is with two physical disks. (but it can be done with a single disk - multiple partitions)

If using three or more drives physical disks, data drives are mounted by windows or linux acting as host and accessed using VirtualBox shared folders if needed from Virtualbox clients. (You can't access the physical disk and/or partition if using a single disk, and the same physical disk virtualized at the same time.)

Setup vmdk's for physical disks. See this guide

Boot to windows. Start Virtualbox linux client.

Boot to linux. Start Virtualbox window client.

Create a separate hardware profile for windows and a separate linux network profile before starting up virtualized existing physical systems. This will keep hardware changes to a minimum.

My preference, although it uses more space, is too clone the systems, physicals to virtuals. Then use rsync to synchronize/backup the physicals. This gives you a backup of your systems as a bonus. And there are no profiles/hardware driver issues except for the first clone import.

When booting up to windows, sync-up physical linux to virtual linux then start virtual linux up.

When booting linux, sync-up physical windows to virtual windows then start virtual windows up.

  • For physical-to-virtual conversion, see my previous post on increasing virtual disk size. serverfault.com/questions/2678/how-to-increase-the-size-of-a-virtualbox-disk-image/45639#45639

The best solution is highly subjective. For beginners I would settle on one OS for the system and import the other(s) into Virtualbox on virtual disks (not using a physical disks or partitions). I would use windows for the host as games and other 3D and audio/video apps run "better" on the outside. After the import I would reclaim the exported physical space or leave it as a "rescue/recovery" partition.

For advanced users I would of course use Opensolaris as the host. Linux in a zone and Virtualbox in a different zone for running windows. Also having a dual boot to windows if needed for games/3D. Use virtual shared folders for home directories on ZFS pools on the Opensolaris host. This gives you snapshots, journaled directories, raidz pools, dtrace for debugging, etc. and it's a much smaller virus/rootkit target than windows or even linux.

See this post for snapshot journals, once you're used to them it's hard to go without: https://blogs.oracle.com/erwann/entry/zfs_on_the_desktop_zfs

| improve this answer | |

In this question I point to a link that enabled me to do this with Windows 7 as host and booting the physical partition with a grub rescue .iso. I have full access to the Ubuntu OS and partition on the VM. Thing is you have to manually load the kernel each VM startup from grub rescue prompt with the usual steps (vmlinuz and initrd pointing, then "boot" command).

So all in all I totally accomplish what you need but still without a definitive solution to both:

  • having a normal grub menu on physical boot (with Win 7 and Ubuntu menu entries)


  • at the same time have VBox booting without the grub rescue prompt tricky kernel load

This is happening because running "update-grub" on the VBox Ubuntu "session" will clear Win 7 menu entries, as it has no "visibility" to the Win 7 partition (either because it's in raw state, encrypted, or simply not accessible). I can "rescue" the normal physical boot by running Ubuntu as a host (physical boot) and re-run update-grub so it can fix the menu entries again, but will need grub rescue ISO again (and manual kernel loading) when booting from VBox. If somebody can answer my question, a more complete aproach than anything already replied can be achieved. Wish there was a solution for Windows that automated this issue like on Mac (VMWare Fusion/Bootcamp).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.