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 a set of machines and want to know how to find out if a given machine is virtualized or not. Any commands?

share|improve this question
2  
Do you know what kind of virtualization technology they would be running on? –  Chris S Jun 21 '10 at 12:40
add comment

8 Answers

If Solaris is running in a container/zone/branded zone, the command "uname -v" will say "Generic_Virtual"

share|improve this answer
add comment

For zones Only:

Top of the heap

[ "`/usr/bin/zonename`" = 'global' ] && echo "im global"

In a zone

[ ! "`/usr/bin/zonename`" = 'global' ] && echo "im in a zone"

More general purpose

If you want something more full-featured, something like this (please help with edits/feedback/flames for other hypervisors; and yes, currently many edge-cases)....

/usr/sbin/prtconf -dv | /usr/bin/egrep -i '(vmw|qemu|xen|hyper-v|openvz|virtualbox|oracle vm|parallels|virtuoso)' >/dev/null

Credit: http://compgroups.net/comp.unix.solaris/how-to-detect-if-solaris-is-running-as-a-gu/281238

share|improve this answer
add comment

It may depend on the virtualization used, but if you are using the "Oracle VM for SPARC" (previously known as LDOMs) the "virtinfo" tool (in the core SUNcsu package) provides the information you're after.

For example:

user@server1> virtinfo

Domain role: LDoms control I/O service root

user@server2> virtinfo

Domain role: LDoms guest

user@zone > virtinfo

virtinfo can only be run from the global zone

user@M4000 > virtinfo

Virtual machines are not supported

user@x3650 > virtinfo

command not found

beware that this command's Interface Stability is classified as "Uncommited" and might be subject to modifications to the next minor release.

share|improve this answer
add comment

Does Solaris have something like lspci or /proc/cpuinfo?

Here are some examples of how other tools solve the detection:

http://github.com/reductivelabs/facter/blob/master/lib/facter/util/virtual.rb

http://imvirt.svn.sourceforge.net/viewvc/imvirt/trunk/perl/lib/ImVirt/VMD/

share|improve this answer
    
On my KVM Solaris 10 VM, facter gets the "virtual" fact totally wrong. It does report manufacturer and productname as "Bochs", not sure how reliable that is. –  Not Now Oct 12 '11 at 0:23
    
prtconf -dv ... see also answer of yours truly. –  Barry Oct 16 '12 at 1:49
add comment

There is no single way to figure out if you are running a virtualized Solaris or not. Solaris can run on various kinds of containers (native or branded zones) regardless of the architecture. On x86/x64, Solaris can also run at least on top of VirtualBox, VMware, Xen, Parallels and probably several more. On SPARC, LDOMs on T series and Physical domains on M series

share|improve this answer
add comment

Have a look at this Perl library: http://search.cpan.org/~doneill/Sys-Detect-Virtualization-0.105/lib/Sys/Detect/Virtualization.pm

If you want to dive into the assembly way of detecting it: http://talhatariq.wordpress.com/2006/05/14/detecting-virtualization-2/

And this overview of things to look for when doing it manually: http://www.dmo.ca/blog/detecting-virtualization-on-linux/ .

HTH

share|improve this answer
add comment

use the prtdiag command. If you are in a zone you can see the error message prtdiag can only buy run in the global zone

if the command works you are in a real machine (real or ldom)

share|improve this answer
add comment

psrinfo will give you some answers about your processor:

$ psrinfo -v
Status of virtual processor 0 as of: 07/09/10 10:41:32
  on-line since 06/01/04 13:30:59.
  The sparcv9 processor operates at 1002 MHz,
        and has a sparcv9 floating point processor.

Check out this link, it may give you more informations.

share|improve this answer
1  
Most hypervisors pass the CPU through directly to the VM, so it would report a normal processor either way. –  Chris S Jul 12 '10 at 22:19
    
damn! solaris is a bit new to me, and I though this could help... –  petrus Jul 12 '10 at 22:30
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.