Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Detect Xen and KVM
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Detect Xen and KVM

drmikedrmike Member
edited August 2011 in General

Well we have an OpenVZ thread....

How does one detect Xen and KVM from a bash script?

Comments

  • KVM will show something like "model name : QEMU Virtual CPU version 0.9.1" in /proc/cpuinfo

    Xen (PV)'s disks will be called something like /dev/xvda1

    Thanked by 2drmike Asim
  • If I remember well, Xen has a folder /proc/xen or something like that

    Thanked by 2drmike Asim
  • Thanks. It was just a thought to throw this up there since we were discussing it.

  • Xen PV will be running kernel-xen

    Thanked by 1Asim
  • tuxtux Member

    miTgiB said: Xen PV will be running kernel-xen

    Or distro's default kernel with pygrub

  • tux said: Or distro's default kernel with pygrub

    If it is a Xen PV, it will be running kernel-xen or it won't be running, whether the shared host kernel or via pygrub. Unless something has changed in the past few months since I stopped running Xen

  • Xen HVM > cat /proc/cpuinfo | grep hypervisor or egrep 'hypervisor' --color=always /proc/cpuinfo

    should be showing hypervisor not xmv/svm

  • My understanding of the original question was how does one detect the environment from within a script.

    At least that's how I understood it.

  • @drmike. if you are referring to my own original question, so yes, it is! Because openvz naturally lacks part of the kernel, and it may be important in some installation/optimization scripts.

    But as I've never (yet) tried any Xen or KVM, I'm not sure it has the same importance. I guess I'll have to wake up for the next buyvm order time :-)

    But please, you're an adept of full virtualization; enlight me! :-)

  • Thanks for that link!

  • the util-linux package on ubuntu includes lscpu which shows hypervisor vendor and virt. type....

    example output on KVM:

    root@localhost:~# lscpu
    Architecture:          x86_64
    CPU op-mode(s):        64-bit
    CPU(s):                1
    Thread(s) per core:    1
    Core(s) per socket:    1
    CPU socket(s):         1
    NUMA node(s):          1
    Vendor ID:             GenuineIntel
    CPU family:            6
    Model:                 2
    Stepping:              3
    CPU MHz:               2533.634
    Hypervisor vendor:     KVM
    Virtualisation type:   full
    L1d cache:             32K
    L1i cache:             32K
    L2 cache:              4096K
    
  • One year bump?

  • Stumbled across this thread in a google search (ranks high when searching for how to detect virt type). Thought this might help someone....apologies if its seen as noise.

  • Drmikes posts keep getting resurrected.. its a sign :P

    Thanked by 2DanielM Infinity
  • @GetKVM_Ash said: its a sign

    Yes it is. Brace yourself..

  • gbshousegbshouse Member, Host Rep
    edited September 2012

    http://linux.die.net/man/1/virt-what
    Download the source code and use the same commands of just apt-get install virt-what

    Thanked by 1craigb
  • Made me think drmike was back.

  • @birdie25 said: Made me think drmike was back.

    Me too haha :( i think most of us miss the good old doc.

  • Actually this is useful. Thanks for bumping :p

  • Anyone here can contact drmike?

  • i still have his email and some couple of his details (address, phone, etc) and maybe many people here's too. but i think i would not contact him for honor his decision about leaving.

  • @Mon5t3r said: i still have his email and some couple of his details (address, phone, etc) and maybe many people here's too. but i think i would not contact him for honor his decision about leaving.

    Come on! The reason he left is no longer here. It is always nice to see fine people making contribution.

  • If we mention him like this @drmike, is he still receiving the notification email?

Sign In or Register to comment.