15

Having access to an VPS, i need to know which type of virtualization it is running from the terminal.

How can determine the virtualization platform that my VM is running on? (OpenVZ, Xen, KVM, etc?)

2
  • I've only used KVM - I'd hope that the others are similar - Assuming you are using Linux, in KVM you can just look through the bootlog for a line like "Booting paravirtulized kernel on KVM".
    – davidgo
    May 16, 2014 at 6:09
  • In my case all boot logs are empty... and dmesg dosen't show any output. =/ May 16, 2014 at 6:17

6 Answers 6

32

hostnamectl is your friend (requires systemd).

A few examples:

Laptop without any virtualization

$ hostnamectl status
   Static hostname: earth.gangs.net
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: 18a0752e1ccbeef09da51ad17fab1f1b
           Boot ID: beefdc99969e4a4a8525ff842b383c62
  Operating System: Ubuntu 16.04.2 LTS
            Kernel: Linux 4.4.0-66-generic
      Architecture: x86-64

Xen

$ hostnamectl status
   Static hostname: pluto.gangs.net
         Icon name: computer-vm
           Chassis: vm
        Machine ID: beef39aebbf8ba220ed0438b54497609
           Boot ID: beefc71e97ed48dbb436a470fe1920e1
    Virtualization: xen
  Operating System: Ubuntu 16.04.2 LTS
            Kernel: Linux 3.13.0-37-generic
      Architecture: x86-64

OpenVZ

$ hostnamectl status
   Static hostname: mars.gangs.net
         Icon name: computer-container
           Chassis: container
        Machine ID: 55296cb0566a4aaca10b8e3a4b28beef
           Boot ID: 1bb259b0eb064d9eb8a22d112211beef
    Virtualization: openvz
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 2.6.32-042stab120.16
      Architecture: x86-64

KVM

$ hostnamectl status
   Static hostname: mercury.gangs.net
         Icon name: computer-vm
           Chassis: vm
        Machine ID: beeffefc50ae499881b024c25895ec86
           Boot ID: beef9c7662a240b3b3b04cef3d1518f0
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-514.10.2.el7.x86_64
      Architecture: x86-64
1
  • 2
    I just get Failed to create bus connection: No such file or directory
    – janniks
    Nov 26, 2019 at 15:19
8

Unless the VM host is lying to you it can generally be figured out by inspecting the "hardware" the VM guest is seeing.

Easiest is probably to use a program like virt-what, which will do the parsing for you. Here I'm blindly assuming that you are running some kind of Linux based distribution by the way.

Might also be worth taking a look at puppet's facter, which too uses similar techniques to determine in what kind of VM environment it's running.

Or you could you ask whoever you happen to be renting the VPS from? :-)

2
  • 1
    virt-what worked to me. Thanks for the answer. May 16, 2014 at 13:11
  • 1
    I looked at facter. It calls virt-what! Aug 3, 2015 at 16:38
5

Use the virt-what command to determine the type of virtualization technology the system is using.

See: http://people.redhat.com/~rjones/virt-what/

4

Systemd includes systemd-detect-virt

2

Debian comes with this small package for detecting virtualisation type:

$ sudo apt-get install virt-what
$ virt-what

and little bigger because of Perl dependencies:

$ sudo apt-get install imvirt
$ imvirt
1

You can also use dmidecode which will show you system hardware info and other.

1
  • dmidecode is empty for my VPS. lshw is mostly empty. virt-what shown openvz ))
    – gavenkoa
    Aug 2, 2015 at 9:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .