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 Answers
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.
- 12,482
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
- 30,396
- 15
- 136
- 260
- 206
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.
- 8,672
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 .
- 101