Sponsored

Not the solution you were looking for?

At Techglimpse we frequently receive mails from our readers asking us to write a tutorial on ‘Virtualization Detection’ from a VPS or a Virtual machine. However, we were not able to respond to those emails immediately, as we didn’t have a test setup comprising of popular hypervisors (at least few) such as Xen, VmWare, KVM, VirtualBox, HyperV etc…Recently, we got to have few hypervisors running – just for the sake of our readers. So finally, this tutorial will tell you few commands and digging (I mean, reading logs) that can help you to identify the type of the Hypervisor that runs the current virtual machine.

The below commands were executed on virtual machines created on top of Xen, KVM, VirtualBox hypervisors and also on an OpenStack-KVM Icehouse.

Method 1: Reading system log

Certain hypervisor leaks information about their type (including the name of the hypervisor and type of virtualization – such as paravirtualization, full virtualization or HVM) in system log files. These informations can be obtained from /var/log/message or by grepping the output of ‘dmesg‘ command.

Note: As told, this method will work only on certain Hypervisors. For e.g., VirtualBox and Xen does not leak any information in the log files.

Note: You can see ‘Bochs‘ as a value for Manufacturer, Product Name etc…Bochs is an X86-64 compatible emulator and debugger that helps emulation of processor, display, BIOS, memory and other hardware of PC. It means, machine is emulating some hardware hinting it’s a VM and mostly, KVM.

Method 3: Listing /dev/disk

Virtual machines should have hardware emulation from the host machine. For e.g., disk emulation from host. So if you just list the files under ”/dev/disk/by-id‘, then you can easily make out what emulator is being used by the Hypervisor.