是否可以运行OS命令来确定是否在基于Xen的虚拟机中运行 [英] Is there an OS command I can run to determine if running inside a Xen based virtual machine
问题描述
我是否可以在基于Xen的虚拟机中运行OS命令,以告诉我它是一个虚拟盒子,而不是物理盒子-我听说内核对此有一些自我意识.例如像"ps"输出中的额外列之类的东西? [我知道vmstat提供了"st"列,但是我在运行Linux Kernel 2.6.11及更高版本的物理主机盒上也看到了此信息.]
Is there an OS command I can run from within a Xen based virtual machine to tell me that it is a virtual box rather than a physical box - I heard that the kernel had some self awareness smarts about it. e.g. like an extra column in "ps" output or something? [I know vmstat provides the "st" column but I have seen this on physical host boxes running Linux Kernel 2.6.11 and greater as well].
非常感谢,
保罗
推荐答案
Dmesg 可能会给您一些帮助来自内核消息缓冲区的提示,这是来自Slicehost的虚拟化Ubuntu实例上的输出:
Dmesg may give some hints from the kernel message buffer, here is output on a virtualized Ubuntu instance from Slicehost:
bvm@qdbp:~$ sudo dmesg | grep Xen
[ 0.000000] Xen: 0000000000000000 - 00000000000a0000 (usable)
[ 0.000000] Xen: 00000000000a0000 - 0000000000100000 (reserved)
[ 0.000000] Xen: 0000000000100000 - 0000000010000000 (usable)
[ 0.000000] Booting paravirtualized kernel on Xen
[ 0.000000] Xen version: 3.1.2-rc1
[ 0.000000] Xen: using vcpu_info placement
[ 0.000000] Xen: using vcpuop timer interface
[ 0.000000] installing Xen timer for CPU 0
[ 0.021223] installing Xen timer for CPU 1
[ 0.046157] installing Xen timer for CPU 2
[ 0.046157] installing Xen timer for CPU 3
[ 0.265880] Initialising Xen virtual ethernet driver.
这篇关于是否可以运行OS命令来确定是否在基于Xen的虚拟机中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!