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

link|improve this question
feedback

2 Answers

up vote 2 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.

link|improve this answer
kvm-clock clocksource might be not present or disabled for stability reasons. – sendmoreinfo Oct 2 '10 at 11:57
feedback

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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