Wednesday, December 24, 2014

Dtrace on the Solaris Non-Global Zone

List solaris privileges in global-zone:

# ppriv -l “zone-name”

List of non-global zone privileges:

# zlogin “zone-name”

# ppriv -l “zone-name”  ( use -v for more verbose info)

How to use Dtrace

# zonecfg -z “zone-name”

zonecfg:zone-name> set limitpriv="default,dtrace_proc,dtrace_user"

zonecfg:zone-name> exit

Now boot the zone:

# zoneadm -z “zone-name” boot

Now log in:

# zlogin “zone-name”

Run Dtrace utility:

# dtrace -l

Trick:

You can run the commands on the fly the same way you execute
the commands over SSH on the local zone from the global


# zlogin “zone-name” svcs -a | grep -i ssh



====================================

Solaris 10 zone Admin commands in short

List the zones:

# zoneadm list -iv

Reboot the zone:

# zoneadm -z “zone-name” reboot

Halt the zone:

# zoneadm -z “zone-name” halt

Uninstall a zone:

# zoneadm -z “zone-name” uninstall -F

Cloning a non-global zone on the same system:

from the global zone as a root-

# zoneadm -z “zone-name” halt

you can configure new zone by exporting the configuration
of the zone you are using as a source. Edit the pfile as
the configuration can not be same for components
like network resources

# zonecfg -z “zone-name” export -f /export/zones/pfile

Install the new zone and clone it:

# zoneadm -z “zone-name” clone

List the zones on the global zone:

# zoneadm list -cv


====================================

Deleting/Removing non-global zone:


Shutdown the zone from global zone:

# zoneadm “zone-name” shutdown -y -g0 -i0

Remove root file system for the zone:

# zoneadm -z “zone-name” uninstall -F

Now delete the configuration:

# zoneadm -z “zone-name” delete -F

Let's list the zones:

# zoneadm list -cv

====================================

How to Login - non-global zone:

If the zone is just installed, you are required to login
the zone so that the configuration can be completed. I would-
call it kind of a post installation configuration.

From global zone:

# zlogin -C “zone-name”

Note: the zone is always in the "unconfigured" state after the
      installation is done.

-C option is for console login equivalent of serial console login.

Login as a regular user:

# zlogin -l username “zone-name”

In case of failed login and further trouleshoot- Please use the
failsafe mode:


# zlogin -S “zone-name”