UPWORK/ODESK guru: Tips and Tricks for clients

skype: upwork.link , email: info@upwork.link

How to detect which the virtualization system on your hosting.

without comments

Frequently, customers want to install software in a virtual machine. This can be OK, but frequently they hit a CPU,memory, or IO limit caused by running in a constrained virtual environment.When this happens, we really like to know if they’re running under virtualization when we try to support them. Here’s some tricks to detect, from
a shell, if the system is virtualized.

The first thing to check is dmesg. On a recently-booted system, checking the
‘dmesg’ command output may be sufficient. Otherwise, try “cat /var/log/dmesg”
instead of “dmesg”

  • VMWare:

    
    
    1
    2
    3
    4
     # dmesg | grep -i virtual
     VMware vmxnet virtual NIC driver
       Vendor: VMware    Model: Virtual disk      Rev: 1.0
     hda: VMware Virtual IDE CDROM Drive, ATAPI CD/DVD-ROM drive
  • QEmu or KVM:

    If the “-cpu host” option has not been used, QEmu and KVM will identify
    themselves as:

    
    
    1
    2
     # dmesg | grep -i virtual
     CPU: AMD QEMU Virtual CPU version 0.9.1 stepping 03

    otherwise, the host’s CPU information will be used both in dmesg, or in
    /proc/cpuinfo.

    However, you should see something like:

    
    
    1
    2
     $ dmesg | grep -i virtual
     [    0.000000] Booting paravirtualized kernel on KVM

    on newer kernels that understand that they’re running under paravirtualization.
    (Thanks to René Pfeiffer for pointing this out)

  • Microsoft VirtualPC:

    
    
    1
    2
    3
     # dmesg | grep -i virtual
     hda: Virtual HD, ATA DISK drive
     hdc: Virtual CD, ATAPI CD/DVD-ROM drive
  • Xen (thanks, wardi and others)

    
    
    1
    2
    # dmesg | grep -i xen
    Xen virtual console successfully installed as tty1
  • Virtuozzo

    
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    # dmesg
    (returns no output)


    # cat /var/log/dmesg
    (returns no output)


    # ls -al /proc/vz
    veinfo  veinfo_redir  veredir  vestat  vzaquota  vzdata

On longer-running systems, you may need to grep /var/log/dmesg instead.

If that doesn’t produce anything useful, try using dmidecode to look at the
BIOS information. Frequently, there will be at least one component identifying
itself as virtualized:

  • VMWare:

    
    
    1
    2
    3
     # dmidecode | egrep -i 'manufacturer|product'
     Manufacturer: VMware, Inc.
     Product Name: VMware Virtual Platform
  • Microsoft VirtualPC:

    
    
    1
    2
    3
     # dmidecode | egrep -i 'manufacturer|product'
     Manufacturer: Microsoft Corporation
     Product Name: Virtual Machine
  • QEMU or KVM:

    
    
    1
    2
     # dmidecode | egrep -i 'vendor'
     Vendor: QEMU
  • Virtuozzo:

    
    
    1
    2
     # dmidecode
     /dev/mem: Permission denied
  • Xen:

    
    
    1
    2
     # dmidecode | grep -i domU
           Product Name: HVM domU

You should just examine the output of dmidecode directly rather than trying to
grep as above, in case the output changes. QEMU, for example, doesn’t report
the vendor in all versions.

Next, check disk devices for identification as virtualized:

  • VMWare:

    
    
    1
    2
    3
    4
    5
    6
    7
    # cat /proc/ide/hd*/model
    VMware Virtual IDE CDROM Drive
    # cat /proc/scsi/scsi
    Attached devices:
    Host: scsi0 Channel: 00 Id: 00 Lun: 00
      Vendor: VMware   Model: Virtual disk     Rev: 1.0
      Type:   Direct-Access                    ANSI SCSI revision: 02
  • Microsoft VirtualPC:

    
    
    1
    2
    3
    # cat /proc/ide/hd*/model
    Virtual HD
    Virtual CD
  • QEMU, KVM, or Xen:

    
    
    1
    2
    3
    # cat /proc/ide/hd*/model
    QEMU HARDDISK
    QEMU DVD-ROM
  • Virtuozzo:

    
    
    1
    2
    # ls -al /dev/vzfs
    b-----x--- 1 root root 0, 19 2009-04-06 15:04 /dev/vzfs

If you’ve got tips for other virtualized environments, let me know and I’ll add
them to the list.

Thanks for that – http://www.dmo.ca/blog/detecting-virtualization-on-linux/

Written by spectre

March 13th, 2013 at 5:59 pm

Posted in Hostings ...

Leave a Reply

*