Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have Linux, AIX, SunOs & HP-UX machines, I want to detect if the machine is virtual or not. So far I found this article which helped me get this information on Linux:

dmesg | grep -i virtual    //On Linux Machines

But I also need commands for AIX, HP-UX & SunOs. Any help?

share|improve this question
add comment

5 Answers

Try http://people.redhat.com/~rjones/virt-what/. Correct me if I'm mistaken, but I think Red Hat uses this in their Satellite to detect and group virtualized systems.

share|improve this answer
    
Only since RHEL 5.7, just a side-note. –  Kwaio Jan 9 at 9:17
add comment

The definition of 'virtual' is too loose. If we assume that for AIX you mean any AIX image which is an LPAR (or a micro-partition, or any other terminology IBM chooses) then you can use uname -L, for example,

nonlpar# umame -L
-1 NULL

lparhost# uname -L
5 lparhost

If you mean WPAR, you can use uname -W and a result of 0 means you're not in a WPAR, a result of anything higher than 0 is a WPAR.

If you mean, does the AIX instance rely on a VIO server, then there's no solid reliable mechanism for knowing that other than looking at the devices and working out if they're presented via VIO servers.

It's worth remembering that for pSeries hardware running AIX, just about everything these days is an LPAR, and so essentially virtual, even if it's the only OS instance using the hardware.

share|improve this answer
add comment

In HP-UX there are different level of virtualization and different command to know if your system is virtualized.

  1. Integrity Virtual Machine Guest

    If you execute the following command in a IVM Guest you obtain:

     # hpvminfo 
     hpvminfo: Running inside an HPVM guest.
    

    If you execute the following command in a NO "IVM Guest" you obtain:

     # hpvminfo 
     hpvminfo: Running inside an HPVM host.
    

    or # hpvminfo sh: hpvminfo: not found.

  2. HP Virtual Partition

    If you execute the following command in a vpar you obtain:

     # hpvminfo 
     hpvminfo: Running inside an HPVM guest.
     # vparstatus -w
     The current virtual partition is <VPAR NAME>.
    

    If you execute the following command in a NO vpar you obtain:

     # vparstatus 
     sh: vparstatus:  not found.
    
share|improve this answer
add comment

Is it possible that virtual machines produce "fishy" cpu info?

In Aix try using lscfg on a known virtual machine and you may be able to find that the CPU information hints that the computer is virtual. This will largely contingent on the virtualizer, but its worth a go.

share|improve this answer
add comment

For an x86 virtual machine, simply run a program that invokes the official mechanisms for detecting x86 virtual machines. I'd provide examples, but I don't know any off the top of my head. I use my own tools. Thomas Liske's imvirt shows promise according to its doco, but I haven't used it or seen the source code.

Whether this also applies to your SunOS machines depends from whether that is x86 Solaris or truly SunOS. ☺ Detecting the existence of a virtual machine involves stuff that is specific to the processor instruction set architecture, not to the operating system. So "I have AIX and HP/UX machines." is less useful than, say, "I have PowerPC and Itanium machines.".

share|improve this answer
    
Any examples, i dont know much about virtualization –  Abhishek Simon Nov 21 '11 at 9:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.