How to find if my OS is running on a virtualized or non-virtualized environment?
Asked Answered
S

1

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.

Subordinate answered 20/1, 2013 at 18:51 Comment(3)
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? :-)Styles
A perfect (or good enough) virtualized environment should not be dectable this way....Sicklebill
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 148GBPeti
C
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.

Caty answered 20/1, 2013 at 19:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.