Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have been playing with virtual machines latley, and wondered if I could run a virtual machine inside a virtual machine?
Is it possible?
Is it practical?

share|improve this question
2  
A practical reason is if you're renting a server. Whether the server is physical or virtual should not matter - it's my server. And if i want to install VirtualPC or Virtual Server on my server: that's my business. –  Ian Boyd Jul 28 '09 at 13:59
2  
That's not really a practical reason, since the "practicality" of installing a VM inside of a VM is going to ultimately depend on whether it's "practical" to implement this capability in the chosen HW+SW platform. Just because somebody "wants" to do it doesn't make it practical. –  Joe Internet Feb 17 '10 at 0:01
add comment

12 Answers 12

up vote 13 down vote accepted

Nesting VMs is something that has been done for forever on IBM Mainframe hardware. That hardware does lots of stuff to make the process very very efficient. You can have VMs nested to an arbitrary depth and it works very well.

PC hardware very recently has kinda made this barely possible. A document on VMware's web site discusses it, but the gist is that you can have VMs nested 2 deep, but only on very modern hardware that supports true hardware virtualization (VT-x or AMD-V), and the second VM depth must be running the older style BT/binary translation style virtualization. There are also severe restrictions on the virtual monitors you're able to run on the inner guest.

Needless to say, it's not supported and I'd expect it to be really flakey if you do anything even remotely weird (like Hyper-V under ESX). And performance will not be good, regardless of if it is stable.

share|improve this answer
add comment

I don't believe most virtualization packages will allow you to run a VM in a VM. I know that VMware will check when it's installed to see if its being installed in a VM, and I hope other products do the same. I don't think the necessary CPU instructions would be presented through from the hypervisor running on the hardware up through the VM to reach the second VM. If it did work, you'd also be adding overhead without getting anything in return.

As for whether it's practical - I don't see why. If you need another VM, you can just run it next to the one you already have running. I can't imagine a case where you must have a VM running inside another VM. The additional overhead without a proportional gain of some resource would make this impractical.

share|improve this answer
add comment

Yes. There are even ways to run VMware ESX/vSphere in a virtual machine. I don't know why you would ever want to in practice, but it has been done.

share|improve this answer
    
I've seen people wanting to test ESX in a VM, but the install requires additional work past just the normal install method. It's not something that works out of the box. –  baumgart Jul 28 '09 at 13:58
add comment

Yes, you CAN but like so many things doesn't mean you should. I've seen a virtualized ESX server running a virtual machine that has another virtual ESX server within it. Granted it was a test just to see if it could be done (and it can) I really wouldn't recommend it.

share|improve this answer
add comment

Yes you can. For example, on Linux, you may run Xen with multiple VMs running OpenVZ, VirtualServer or some other kind of VM system. It is most certainly possible and also very practical depending on your purpose.

One reason that I could think of for doing this is to run multiple servers on a single physical machine. Whether you run it as a single level of VM hierarchy or multiple ones is dependent on your resource isolation plan.

share|improve this answer
add comment

If you need some specific, say legacy, system to be virtualized you can always do it in software, the nesting is not an issue then. Try qemu, I did it 2 level deep with it, but you can go deeper, the performance will probably make it useless, though. BTW, PC architecture was nomen omen made by IBM, but for totally different uses compared to what it is used for today.

share|improve this answer
add comment

As far as I know it is not possible, but VMware ESX can run in VMware Workstation for example. IMHO it is only good for testing.

share|improve this answer
add comment

It depends on the virtualisation technique. If you use solutions that are not "real" virtualisation like UML then you can run those inside, say, VMWare. Or themselves for that matter.

UML based installs can run inside VMWare VMs and other UML based installs (even nested). The performance metrics are not going to be pretty though!

share|improve this answer
add comment

Like many people have all ready said: of course it's possible. It depends on how well the VM hardware is emulated and what virtualization software you're using. VMWare Workstation, at least, doesn't want you to virtualize it.

As for if it's practical, maybe we should pose the question back to you: why would you need to do that kind of thing? What's wrong with just running two VMs side by side? And to what degree do you ask if it's practical? That is, if you're worried about it being practical to set up and configure, probably not. If you're more worried about it's practical usage, again, I can't think of anything I'd need to do this for unless I'm looking for bugs in the virtualization software or something.

share|improve this answer
add comment

Come on. Here's why. You need to run a Linux virtual machine to compile some stuff inside it. In the meantime, you need to access some remote resources which requires VPN (client available on Windows only). Thus I prefer a Windows virtual machine to run the VPN. Due to connectivity issues, the two virtual machines must be nested. Simple?

share|improve this answer
2  
I don't see why this statement is true: "Due to connectivity issues, the two virtual machines must be nested." –  mfinni Feb 16 '10 at 20:26
add comment

Yes, it is possible but really slow.

It's particulary useful if you're renting a server with limited allocated public IP (which depends for example on your MAC adress to not poison the network of your server provider); and that you want your VM IP to be bridged to communicate directly with internet. So when you can't have more than, for example, 3 public IP adress, but that you need 10 VM, it's a pretty good idea to have VMs in a global VM : you will use only one of your given public IP and then have many sub bridged VMs.

But you could actually use a mix of bridge and routed network config, it's just more tough concerning configuration.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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