7

I have access to a machine to which I can ssh. How to determine if my OS is running in fully-virtualized (where VMM does binary translation), para-virtualized or non-virtualized environment? I have some idea of how to go about it (some operations like accessing a memory page/disk will take longer time in a virtualized environment) but don't know how to proceed.

madth3
  • 7,275
  • 12
  • 50
  • 74
Bruce
  • 33,927
  • 76
  • 174
  • 262
  • 2
    How could you tell if we are living inside a real universe or a fancy computer simulation? If it is performing well, does it matters? :-) – Paulo Scardine Jan 20 '13 at 19:18
  • 1
    A perfect (or good enough) virtualized environment should not be dectable this way.... – Basile Starynkevitch Jan 20 '13 at 19:33
  • why can you just ask the hosting company provider. try free -m , sometime you will see the whole ram the system has. i happend with my vm box. it showed the whole memory of the hardware 148GB – Mirage Jan 21 '13 at 03:22

1 Answers1

2

It does depends on the VMM you are running on top of. If it's a Xen or Microsoft VM, I believe CPUID with EAX value of 0x40000000 will give you a non-zero value in EAX. Not sure if that works on VMWare, VirtualBox or KVM. I expect that it will work there too...

Measuring access time is unlikely to ALWAYS show you the truth, since in a non-VM system those can vary quite a lot as well, and there is no REAL reason that you'd see a huge difference in an efficient implementation. And of course, you don't know if your VM is running with a REAL hard-disk controller passed through via the PCI, or if your NFS mounted disks are connected via a REAL network card passed through to the VM, or if they are accessed through a virtual network card.

A good VMM shouldn't show you much difference as long as the application is behaving itself.

Mats Petersson
  • 126,704
  • 14
  • 140
  • 227