Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 3 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 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

Your Answer

 
discard

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.