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.
If you want to check Linux Server is Physical or Virtual then you can use another important tool called hwinfo . You can grep the Product keyword from hwinfo command output as shown below. If it is a virtual machine then it will show under Product section.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With