Physical and virual server difference

Hi,

i am trying to find whether any particular solaris server is physical or virtual....are there any commands or set of commands which only runs (or provide specific pattern ) on physical machines and provides different pattern or error on virtual one...

Is this the correct approach to find whether the machine is physical or virtual...

for VMware based virtualization its easy to find as i am using below method :

 
#!/bin/bash
prtdiag -v | grep -i "System Configuration" | grep -i virtual
if [[ $? -eq 0 ]]
then
echo "virtual machine"
else
echo "physical machine"
fi

Please suggest some better meothods or way by which i can distinguish between physical and virtual machine.

For LDOMs virtualization, you can use:

virtinfo -a

thanks a lot for the command..but are there any commands or set of commands which can be run only on physical or only on virtual machines...basically i am trying to find a way by which i can distingwish between physical or virtual server

There is no such command at the OS level. There are plenty of ways to virtualize a Solaris server (physical domains, logical domains, zones, ovm for x86, virtualbox, VMWare, and the likes), and each one has its own more or less reliable method to identify itself.

can you please help me in identifying the type of virtualization techinque used on particular machine..it will be of great help..
i am able to grab information about VMware but not aware about others..could you please guide with commands or small scripts which can determine the virtualization technology is being used on particular server :slight_smile:

Well, you already have the way to check if it is LDOMs virtualization. To check if the server is a zone, you can try running:

pgrep init

If you receive anything other than "1", it means it is a Solaris zone (this is the only situation that I know of that results in init process PID on Solaris to be other than "1").

thanks a lot "bartus11"...so you mean to say if i get output of command " pgrep init" other than one that means the zone is installed..
I have machine which is virtual one based on VMware.output is as below :

bash-3.2# pgrep init
1
235

so if i run this command on any of the physical solaris server will give output as "1"? .. correct me if i am wrong somewhere..

i am trying to run command

#zoneadm list -cvv

on VMware machine output is as below:

 
bash-3.2# zoneadm list -cvv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared

Does this command output differs or has any peculiar pattern(for eg : ID filed will be nonzero) on virtualized machine done through zoning.

Is this the right approach i am taking to find out zone based virtual machine...

What is your expectation when dealing with a Solaris 10 branded zone running on top of a Solaris 11 global zone running on VirtualBox running on Ubuntu running on VMWare ?

Beware that most if not all the heuristics used to identify what the server is running on might be fooled.