Tuesday, December 1, 2015

Cloud: Find Out More about Your VM

If you can access a VM in a cloud and would like to find out more about it, here are what you can do on a Linux system.

lscpu


lscpu is a useful Linux command to uncover CPU architecture information.  It can print out the following VM information:
  • Hypervisor vendor[1]
  • Virtualization type 
  • Cpu virtualization extension[2]
Using two different servers (see below) as examples, we have found that:
  • Server #1
    • This is a Xen guest fully virtualized (HVM).
  • Server #2
    • This is a physical server.  However, it does have the virtualization extensions in hardware.
      • Another way to verify it is to:[3]
        • cat /proc/cpuinfo | grep vmx
Server #1

$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    4
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 63
Stepping:              2
CPU MHz:               2294.924
BogoMIPS:              4589.84
Hypervisor vendor:     Xen
Virtualization type:   full

L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              46080K
NUMA node0 CPU(s):     0-3

Server #2


$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                16
On-line CPU(s) list:   0-15
Thread(s) per core:    2
Core(s) per socket:    4
CPU socket(s):         2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 26
Stepping:              5
CPU MHz:               1600.000
BogoMIPS:              4521.27
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              8192K
NUMA node0 CPU(s):     0-3,8-11
NUMA node1 CPU(s):     4-7,12-15


virt-what


virt-what is another useful Linux command to detect if we are running in a virtual machine.  For example, Server #1 is a Xen guest fully virtualized as shown below:[4]

$ sudo virt-what
xen
xen-hvm

If virt-what is not installed in the system, you can install it using yum (an interactive, rpm based, package manager).

To find out which package "virt-what" is in, type:

$ yum whatprovides "*/virt-what"
Loaded plugins: aliases, changelog, downloadonly, kabi, presto, refresh-
              : packagekit, security, tmprepo, verify, versionlock
Loading support for kernel ABI
virt-what-1.11-1.1.el6.x86_64 : Detect if we are running in a virtual machine
Repo        : installed
Matched from:
Filename    : /usr/sbin/virt-what

To install the matched package, type (note that "-1.11-1.1.el6" in the middle of the full name has been removed):

# yum install virt-what.x86_64
Loaded plugins: aliases, changelog, downloadonly, kabi, presto, refresh-
              : packagekit, security, tmprepo, verify, versionlock
Loading support for kernel ABI
Setting up Install Process
Nothing to do


Finally, If nothing is printed and the "virt-what" exits with code 0 (or no error) as in Server #2, then it can mean either that the program is running on bare-metal or the program is running inside a type of virtual machine which we don't know about or cannot detect.

References

  1. How to check which hypervisor is used from my VM?
  2. Linux: Find Out If CPU Support Intel VT and AMD-V Virtualization Support
      • Hardware virtualization support:
        • vmx — Intel VT-x, virtualization support enabled in BIOS.
        • svm — AMD SVM,virtualization enabled in BIOS.
    1. Enabling Intel VT and AMD-V virtualization hardware extensions in BIOS
    2. Hardware-assisted virtualizion (HVM)
      • HVM support requires special CPU extensions - VT-x for Intel processors and AMD-V for AMD based machines. 
    3. Oracle Process Cloud Service 16.2.1 Release
    4. All Cloud-related articles on Xml and More


    1 comment:

    1. Are you looking to earn cash from your visitors using popunder ads?
      If so, did you try using Ero Advertising?

      ReplyDelete