Lately I’ve been responsible for migrating quite some VMs from a Hyper-V platform to vSphere. One of the applications I migrated started experiencing some intermittent network issue. And sure enough it turned out the old VM was started again. This left me wondering; how can I check what hypervisor I’m running on.
Now with a Windows VM is quite easy. You just open a device manager and check for system devices related related to either Hyper-V or VMware. But I didn’t know how to check this with linux. This is actually a pretty easy thing to do. It’s just a matter of running dmesg and filtering the output.
Without any filters a VM on Hyper-V will return the following output.

And with vSphere things look like this.

If you specifically want to filter the line where the hypervisor is shown simply type
1 |
dmesg | grep Hypervisor |
And you know for sure what hypervisor your linux VM is running on.
Update
Just out of curiosity I booted a linux VM on VirtualBox. If you just select the line wich says ‘Hypervisor detected’ you might be under the impression that your VM is running on a KVM platform.

So you might want to include the DMI line as well using something like this.
1 |
dmesg | egrep 'DMI|Hypervisor' |
dmidecode -t System | egrep ‘Manufacturer|Product’
That’s a great tip Jose! Thanks for pointing it out. Much appreciated.
How do you find the hostname of the hypervisor that the VM is running on?