Method 1:: use dmidecode command
For simplicity you can use the submission dmidecode by command:
dmidecode -t system | grep -E "Manufacturer|Product"
Some examples show.
[VMware Workstation]
# dmidecode -s system-manufacturer
VMware, Inc.
# dmidecode -s system-product-name
VMware Virtual Platform
[VirtualBox]
$ sudo dmidecode -s system-product-name
VirtualBox
[OpenStack]
$ sudo dmidecode -s system-product-name
OpenStack Nova
[Physical Server]
# dmidecode -s system-manufacturer
IBM
# dmidecode -s system-product-name
System x3550 M2 -[7284AC1]-
[VPS KVM]
dmidecode -t system | grep -E "Manufacturer|Product"
Manufacturer: QEMU
Product Name: Standard PC (i440FX + PIIX, 1996)
Method-2: Use the lshw command
Some examples:
The lshw command for VPS VMware Workstation
# lshw -class system
2daygeek
description: Computer
product: VMware Virtual Platform ()
vendor: VMware, Inc.
version: None
serial: VMware-42 0a a0 62 85 7e 8d 48-f2 8f 15 5a aa 7f 77 95
width: 64 bits
capabilities: smbios-2.4 dmi-2.4 vsyscall32
configuration: administrator_password=enabled boot=normal frontpanel_password=unknown keyboard_password=unknown power-on_password=disabled uuid=420AA062-857E-8D48-F28F-155AAA7F7795
*-remoteaccess UNCLAIMED
vendor: Intel
physical id: 1
capabilities: inbound
[Alternatively use lshw command to print only product]
# lshw -class system | grep product
product: VMware Virtual Platform ()
The lshw command for VPS VirtualBox
$ sudo lshw -class system
daygeek
description: Computer
product: VirtualBox
vendor: innotek GmbH
version: 1.2
serial: 0
width: 64 bits
capabilities: smbios-2.5 dmi-2.5 smp vsyscall32
configuration: family=Virtual Machine uuid=762A99BF-6916-450F-80A6-B2E9E78FC9A1
[Alternatively use lshw command to print only product]
# lshw -class system | grep product | awk '{print $2}'
VirtualBox
The lshw command for physical server
# lshw -class system
2daygeek
description: Blade
product: Flex System x240 Compute Node -[7284AC1]-
vendor: IBM
version: 06
serial: KQ3YZ9B
width: 64 bits
capabilities: smbios-2.7 dmi-2.7 vsyscall32
configuration: boot=normal chassis=enclosure family=System X uuid=8B57E5D1-7002-3F3C-8765-
[Alternatively use lshw command to print only product]
# lshw -class system | grep product
product: Flex System x240 Compute Node -[7284AC1]-
Method-3: Use a facter
Facter is a basic ruby tool that shows information about your server.
Install facter on centos: yum install -y facter
[VMware Workstation]
# facter virtual
vmware
[VirtualBox]
$ facter virtual
virtualbox
[Physical Server]
# facter virtual
physical
Method-4: Using imvirt Command
imvirt is a collection of Perl modules used to detect whether a Linux system is physical or virtual. If it detects that it is a virtualization, then it will try to find out which virtualization technology is used.
[VMware Workstation]
# imvirt
VMware VMware ESX Server
[VirtualBox]
$ imvirt
KVM
[Physical Server]
# imvirt
Physical
Method-5: Using virt-what Command
If virt-what detects that it is a virtualization, then it tries to figure out which virtualization technology is used. if no value is returned, it is the physical server.
Setting,
Centos: yum install -y virt-what
ubuntu: apt-get install -y virt-what
[VMware Workstation]
# virt-what
vmware
[VirtualBox]
$ sudo virt-what
virtualbox
kvm
[Physical Server]
# virt-what
Method-6: Use the hostnamectl command
The hostnamectl tool is provided to administer the hostname of the system, you can use this command to check.
VirtualBox Output
# hostnamectl
or
# hostnamectl status
Static hostname: daygeek
Icon name: computer-vm
Chassis: vm
Machine ID: c01b17d61f2542478047952180768c82
Boot ID: 8be91fafab024c5880581fb3968a22f8
Virtualization: oracle
Operating System: Ubuntu 16.10
Kernel: Linux 4.10.1-041001-generic
Architecture: x86-64
Physical Output
# hostnamectl
or
# hostnamectl status
Static hostname: daygeek
Icon name: computer-laptop
Chassis: laptop
Machine ID: bb8348e0f32e495184590f98ce96ee62
Boot ID: 06ee2c95917744b9b23a2861a0a82abb
Operating System: Fedora 25 (Workstation Edition)
CPE OS Name: cpe:/o:fedoraproject:fedora:25
Kernel: Linux 4.10.14-200.fc25.x86_64
Architecture: x86-64
Method-7: Use the Dmesg command
You can use Dmesg to check:
[VMware Workstation]
# dmesg |grep DMI
[ 0.000000] DMI: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 11/02/201
[Physical Server]
# dmesg |grep DMI
DMI: IBM System x3650 M4: -[7915AC1]-/00Y8494, BIOS -[VVE134MUS-1.50]- 18/20/2015
[VirtualBox]
# dmesg |grep DMI
[ 0.000000] DMI: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[KVM]
# dmesg |grep DMI
[ 0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.1-0-g0551a4be2c-prebuilt.qemu-project.org 04/01/2014
Method-8: use / sys file system
You can use the command like this:
# grep "" /sys/class/dmi/id/[pbs]*
/sys/class/dmi/id/bios_date:12/01/2006
/sys/class/dmi/id/bios_vendor:innotek GmbH
/sys/class/dmi/id/bios_version:VirtualBox
/sys/class/dmi/id/board_asset_tag:
/sys/class/dmi/id/board_name:VirtualBox
/sys/class/dmi/id/board_serial:0
/sys/class/dmi/id/board_vendor:Oracle Corporation
/sys/class/dmi/id/board_version:1.2
grep: /sys/class/dmi/id/power: Is a directory
/sys/class/dmi/id/product_name:VirtualBox
/sys/class/dmi/id/product_serial:0
/sys/class/dmi/id/product_uuid:762A99BF-6916-450F-80A6-B2E9E78FC9A1
/sys/class/dmi/id/product_version:1.2
grep: /sys/class/dmi/id/subsystem: Is a directory
/sys/class/dmi/id/sys_vendor:innotek GmbH
[VMware]
# cat /sys/class/dmi/id/product_name
VMware Virtual Platform
[Physical Server]
# cat /sys/class/dmi/id/product_name
System x3650 M4: -[7915AC1]-
Method-9: Use the proc library
You read at file: / proc / scsi / scsi
VMware Output
# cat /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
Type: CD-ROM ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: VMware Model: Virtual disk Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
VirtualBox Output
# cat /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: VBOX Model: CD-ROM Rev: 1.0
Type: CD-ROM ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: ATA Model: VBOX HARDDISK Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 05
QEMU Output (KVM)
# cat /proc/scsi/scsi
Attached devices:
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: QEMU Model: QEMU HARDDISK Rev: 2.3.
Type: Direct-Access ANSI SCSI revision: 05
# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 02 Id: 00 Lun: 00
Vendor: IBM Model: ServeRAID M5110e Rev: 3.24
Type: Direct-Access ANSI SCSI revision: 05
Host: scsi0 Channel: 02 Id: 01 Lun: 00
Vendor: IBM Model: ServeRAID M5110e Rev: 3.24
Type: Direct-Access ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: IBM SATA Model: DEVICE 81Y3672 Rev: SA82
Type: CD-ROM ANSI SCSI revision: 05
Method-10: Use the lscpu command
You can use the lscpu command to display basic information of the device, such as OS, CPU information ...
# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 60
Model name: Intel Core Processor (Haswell, no TSX)
Stepping: 1
CPU MHz: 2399.996
BogoMIPS: 4799.99
Virtualization: VT-x
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
NUMA node0 CPU(s): 0
[Alternatively use lshw command to print only product]
# lscpu | grep Hypervisor
Hypervisor vendor: KVM
Method-11: Read Devices File
You can read the following file for your VPS information.
[VMware]
# cat /sys/block/sda/device/model
Virtual disk
[VirtualBox]
# cat /sys/block/sda/device/model
VBOX HARDDISK
[OpenStack]
# cat /sys/block/sda/device/model
QEMU HARDDISK
[Pysical]
# cat /sys/block/sda/device/model
ServeRAID M5110e
[KVM]
cat /sys/block/sda/device/model
QEMU HARDDISK
0 Comments