How to tell if I am on a XEN or KVM Server?

7,157

Solution 1

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.

Solution 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.

Solution 3

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

Share:
7,157

Related videos on Youtube

Rachel Nark
Author by

Rachel Nark

Updated on September 18, 2022

Comments

  • Rachel Nark
    Rachel Nark almost 2 years

    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

  • Rachel Nark
    Rachel Nark about 12 years
    I don't have anything like that so this looks like a dedicated server.
  • William Jackson
    William Jackson about 12 years
    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.
  • Ciro Santilli Путлер Капут 六四事
    Ciro Santilli Путлер Капут 六四事 over 5 years
    Did not work with this Ubuntu 18.04 on Ubuntu 18.04 setup: askubuntu.com/revisions/1046792/15 , it just output: Standard PC (i440FX + PIIX , 1996).