dmidecode -s system-product-name
I have tested on Vmware Workstation, VirtualBox, QEMU with KVM, standalone QEMU with Ubuntu as the guest OS. Others have added additional platforms that they’re familiar with as well.
Virtualization technologies
- VMware Workstation
root@router:~# dmidecode -s system-product-name VMware Virtual Platform
- VirtualBox
root@router:~# dmidecode -s system-product-name VirtualBox
- Qemu with KVM
root@router:~# dmidecode -s system-product-name KVM
- Qemu (emulated)
root@router:~# dmidecode -s system-product-name Bochs
- Microsoft VirtualPC
root@router:~# dmidecode | egrep -i 'manufacturer|product' Manufacturer: Microsoft Corporation Product Name: Virtual Machine
- Virtuozzo
root@router:~# dmidecode /dev/mem: Permission denied
- Xen
root@router:~# dmidecode | grep -i domU Product Name: HVM domU
On bare metal, this returns an identification of the computer or motherboard model.
/dev/disk/by-id
If you don’t have the rights to run dmidecode
then you can use:
Virtualization Technology: QEMU
ls -1 /dev/disk/by-id/
Output
[root@host-7-129 ~]# ls -1 /dev/disk/by-id/
ata-QEMU_DVD-ROM_QM00003
ata-QEMU_HARDDISK_QM00001
ata-QEMU_HARDDISK_QM00001-part1
ata-QEMU_HARDDISK_QM00002
ata-QEMU_HARDDISK_QM00002-part1
scsi-SATA_QEMU_HARDDISK_QM00001
scsi-SATA_QEMU_HARDDISK_QM00001-part1
scsi-SATA_QEMU_HARDDISK_QM00002
scsi-SATA_QEMU_HARDDISK_QM00002-part1