4
1
Is there a way to tell if I am on a XEN or KVM linux server? Reason I asked is nothing is on top yet I am seeing load averages high well after I do tasks and I am getting hangs/spikes when I do simple tasks
4
1
Is there a way to tell if I am on a XEN or KVM linux server? Reason I asked is nothing is on top yet I am seeing load averages high well after I do tasks and I am getting hangs/spikes when I do simple tasks
0
If you have sudo
privileges you can run the following command to get information about the "hardware" that CentOS is running on:
sudo lshw
For example, the first few lines of output on one of my computers is:
description: Desktop Computer
product: Virtual Machine
vendor: Microsoft Corporation
A virtual machine from Microsoft? I'm running on Hyper-V.
2
systemd-detect-virt
returns on this Ubuntu 18.04 KVM setup:
kvm
and on my host:
none
See also: https://unix.stackexchange.com/questions/89714/easy-way-to-determine-virtualization-technology
Tested on an Ubuntu 18.04 host.
1
There is code that can detect this: http://ivanlef0u.fr/repo/windoz/rootkit/invisiblethings/redpill.html
You can also check dmesg and lspci.
Xen PV guest or Xen guests with PV drivers will have something xen-related in dmesg
dmesg | egrep -i 'xen|front
0
lshw
is not always available on *nix servers. Yes you can install it, however I like to opt for stuff that I get for free on the box. I found that for the most part dmidecode
is usually available.
Use this instead:
Fun fact, lshw
gets some info from DMI table entries and other sources for the info it provides. But for this purpose, just using dmidecode
is sufficient.
dmidecode -t system|grep 'Manufacturer\|Product'
Output on Dell server:
Manufacturer: Dell Inc.
Product Name: PowerEdge C5220
Output on Virtualbox VM:
Manufacturer: innotek GmbH
Product Name: VirtualBox
Output on KVM/QEMU:
Manufacturer: QEMU
Product Name: Standard PC (i440FX + PIIX, 1996)
This is great for scripts that can parse these out for better identification of servers... but if you use Chef in your infrastructure, you can check the node attribute Virtualization -> system
in the chef server .
Did not work with this Ubuntu 18.04 on Ubuntu 18.04 setup: https://askubuntu.com/revisions/1046792/15 , it just output: Standard PC (i440FX + PIIX , 1996)
.
I don't have anything like that so this looks like a dedicated server. – Rachel Nark – 2012-05-18T14:42:13.040
I don't know what kind of output one would get with KVM or XEN. There is always the possibility that they spoof actual hardware. Other than asking the system administrator, there may not be a way to definitively determine whether it is a virtual machine. – William Jackson – 2012-05-18T16:28:32.703