5

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 Answers4

4
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

http://wiki.xen.org/wiki/Xen_Linux_PV_on_HVM_drivers#Verifying_Xen_Linux_PVHVM_drivers_are_using_optimizations

dmesg | egrep -i 'xen|front
phuclv
  • 30,396
  • 15
  • 136
  • 260
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.

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 .

Okezie
  • 101