Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to find out if OS(linux) is running inside KVM guest..

share|improve this question
up vote 6 down vote accepted

Grep dmesg, there should be at least one line containing kvm. On my machines:

[    0.000000] kvm-clock: cpu 0, msr 0:5dd801, boot clock
[    0.000000] kvm-clock: cpu 0, msr 0:1023801, primary cpu clock

Alternativly check /proc/cpuinfo, it contains a line:

model name : QEMU Virtual CPU version 0.9.1

But, the problem is: You can't be sure you are an KVM guest (on top of QEMU) or only a QEMU-Guest.

share|improve this answer
kvm-clock clocksource might be not present or disabled for stability reasons. – sendmoreinfo Oct 2 '10 at 11:57
You may want to add dmidecode to the list of ways that might show if you are running virtualized, it works well with VMWare. – Law29 Apr 3 at 6:49

You can check if imvirt or virt-what which are available for several Linux distros, including Ubuntu, can help you.

share|improve this answer
In my experience imvirt is more accurate. – bahamat Sep 14 '13 at 1:04

I just tried both scripts (as root) on a KVM instance from Bluehost. imvirt said it's physical hardware, and virt-what said it's kvm. Personally, I'm going with virt-what...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.