I would like to set-up a PC to run ubuntu most of the time, but also need to run XP for specific applications and testing. In the past I would have simply set up a dual boot machine and then restart and boot into windows XP as needed.

However since the machine has multiple cores and significant memory, I think I can use Virtual Box, Xen, or VMWare hypervisors. I am thinking of making Ubuntu the "host" VM and having XP as a guest VM. This would be especially nice for testing/debug/development since it is possible to run applications in both OS's simultaneously. I've never setup a virtual machine before and think that by asking the questions below I can avoid some trial-and-error.

Basically, I need to decide if a dual boot or VM setup is more appropriate for what I want to do.

Here's my questions:

I do not always need to have XP running. Do the hypervisors allow me to shut the guest VM down so that the host VM can then immediately use all memory and processor resources? When I then bring up the guest VM, is it easy to provision how much memory and other resources are used by it? Ideally, I'd like to pre-configure this in advance and then toggle the guest VM off/on without thinking about it.

Is it possible or advisable to have the host OS be 64bit and the guest OS be 32bit? Alternatively, if both VM's are 32 bit and I have 8G of RAM, can the hypervisor provision each VM with 4G of RAM when they are running simultaneously?

4 Answers
4

From my experience it is a good idea to run a less often used OS in a virtual machine. This avoids reboots and enables easy data exchange between both worlds. As a rule of thumb we should have the OS we work most with as the host OS to run the guest OS we don't use that often.

From my side I can only speak for Virtual Box, as I have very little experience with other solutions. However, Virtual Box is stable, free and available across platforms. I do recommend it.

Drawbacks and advantages of a virtual machine are summarized in this answer, so I will not repeat them here.

Just one thing in addition: if you develop software you may find it quite nice to have the bug going wild in a virtual machine only.

To answer your quesitons:

Yes, you can just shut down the guest OS to have all ressources back to the host. You can even save a machines state to continue your work after waking it up again.

The architecture does not really matter. I run both 64-bit machines, and 32-bit machines on my 64-bit host. They feel the same. If your processor offers virtualization (it very likely does) you can even run 64-bit guests on a 32-bit host.

That depends on very specific needs where one or the other solution may be better at the moment be - we can't really give a recommendation for all aspects. Such things will also likely change over time.

Try it out, it is not that complicated, and support for Virtual Box is excellent.

The 1 GiB VM is sent to shut down at position 1, the 4 GiB VM sent to shut down at position 2.

Further increasing the memory sizes of the VMs led to extensive usage of swap that made the system almost unresponsive. Running 2 VMs with 4 GiB each was not allowed on my system here (8 GiB). One of the machines was then shut down from Virtual Box manager.

Thanks! There seems to be some differences in the answers about whether or not one can have (for example) 8GB of physical RAM and simultaneously allocate 4GB each to two 32 bit VM's. What do you say about that?
–
AngeloMay 8 '12 at 15:37

@Angelo: you can freely assign any amount of RAM to a machine but you need some RAM left for the host to operate the virtual machine. Virtual Box does not allow to assign more than 88% of RAM to a machine.
–
TakkatMay 8 '12 at 15:41

thanks, yes I understand that there must be some overhead for virtual box. What I am asking is if I can get a large amount of physical RAM (for example 8GB or 16GB) and then allocate the max possible (4GB) to each 32bit machine when running concurrently. It sounds like from the other answer that the 32bit VM's are restricted to sharing the first 4GB of physical memory (my question might not have been clear). Is this the case?
–
AngeloMay 8 '12 at 15:47

@Angelo: my tests (see edit) indicate that - provided you have enough RAM - you should be able to run multiple 32-bit machines using 4 GiB at the same time.
–
TakkatMay 8 '12 at 16:42

With Virtualbox you can even add a link to your XP virtual machine on your desktop or between your application to start it in no time, and you can easily switch between guest and host too.

By shutting down your guest, host regain immediately its resources since virtual machines are to your system like application. Even when you are running a virtual machine, if it didn't use all the ram designed for it, it will be dynamically given to the host. Example: if you got a total of 8GB of ram memory, then you set an amount of 4GB ram on your guest, but it use only 2GB in his processes the host will be able to access to 6GB of ram.

Actually it is very easy to set memory and other resources on your VM, and they will be remembered on every VM startup.

There is no problem on running 32bit guest on 64bit host, I'm doing it every day.

You can even run 32bit guest on 32bit host that's absolutely no problem.

Alternatively, if both VM's are 32 bit and I have 8G of RAM, can the
hypervisor provision each VM with 4G of RAM when they are running
simultaneously?

I did't really understand that question, but if you've got a total of 8GB of ram, you can only dedicate half of it (4GB) to your VMs, if you want to run multiple VMs at the same time you had to split 4GB in how many VM you want to run.

Since you are a first timer I can suggest you to use VM Virtualbox, which is good for advanced users too so you can grow using it. It is available in the official repository by terminal:

sudo apt-get install virtualbox

or just check for it in the Ubuntu Software Center.

It comes to you with a very user friendly interface and easy step by step wizards to do things.

Answers:
A1: Yes, VirtualBox will allow to to emulate ANY kind of computer you want(as long as it meets your hardware specifications), You can even emulate a 64Bit machine in a 32Bit computer. So whenever you start a VM it will take up the set amount memory and VD space you told it to when starting. Even if the VM doesn't use all of it's given Memory there is still null memory sitting there that the host machine cannot use though. So if you have strong enough processing power you can even emulate OTHER processors cards etc, though that doesn't make much sense most the time and you can't monitor it as easily. And of coarse because of how efficient virtualbox is,(besides the memory thing) it does check the first time you boot(and any time after you specify), for which drivers and things that it needs to have when it boots, and tries to have them "pre-loaded" whenever you boot, so you do come out with a faster boot too.

A2: Yes and very easily, though if you had two VM's each taking half you Memory, you will still have to have around 50-100 MB of ram for virtualbox and the host to use as they run in the background. So about 3.75 GB for each...

A3: When you say hypervisors do you mean Host OS or VMWare vs VirtualBox, because the straight forward answer is VMWare is outdated, and VirtualBox is stable. So you have to decide for crashing and buggy but fast VMWare or Efficient and stable, but still takes up a bit of memory when running VirtualBox...I prefer VirtualBox, but many others with not-so-capable hardware like to use VMWare...You decide, although I do suggest using Ubuntu with openbox if you want as minimal processes running whenever you do dual-VM's...

Unless you need to do graphics intensive tasks on the guest, the VM will work fine. I have found Virtual Box to be very easy to setup for what you are trying to do. You can load and unload the guest as needed. You can easily configure memory usage and can adjust how much memory the guest is allotted. It is best if you use a 64-bit host with more than about 3GB of memory on the host. If you are using XP as a guest it will most likely be a 32-bit guest which works great.

All three VM managers are great. Xen is primarily configured via the command-line. It is really powerful, but can be a little daunting. VMware is not open source if that matters to you. Virtual Box works great and is simple to configure. Certain features require a proprietary add-on pack, but they are not usually mandatory.

The only thing I would caution you about is the initial disk drive size. This is really difficult to change the virtual partition size after the initial config. I would recommend making it a little larger than you think you need.

In short, virtual machines can be great. It is definitely more convenient than dual boot.