Solaris Zones Cheat Sheet
As a zone is a light-weight VM created within a single instance of the Solaris Operating System, you can boot zone, login into zone, etc as if this is a separate computer. The original instance of Solaris is called a global zone. It always has the name global. The global zone run system-wide processes and is used for zone administrative control. A regular user of the global zone can be a root user of the zone and thus can boot the zone, add/delete users, etc. that’s a nice separation of duties in a large enterprise environment.
Solaris Zones can be maintained by System administrator with the help of minimal commands . Let us look at the commands which will help the Sys admins to face the day to day Zone administration.
Here is the quick cheat sheet of commands
Zone States
| Configured | Configuration has been completed and storage has been committed. Additional configuration is still required. |
| Incomplete | Zone is in this state when it is being installed or uninstalled. |
| Installed | The zone has a confirmed configuration, zoneadm is used to verify the configuration, Solaris packages have been installed, even through it has been installed, it still has no virtual platform associated with it. |
| Ready (active) | Zone’s virtual platform is established. The kernel creates the zsched process, the network interfaces are plumbed and filesystems mounted. The system also assigns a zone ID at this state, but no processes are associated with this zone. |
| Running (active) | A zone enters this state when the first user process is created. This is the normal state for an operational zone. |
| Shutting down + Down (active) | Normal state when a zone is being shutdown. |
Files and Directories
| zone config file | /etc/zones |
| zone index | /etc/zones/index
Note: used by /lib/svc/method/svc-zones to start and stop zones |
Cheat sheet
| Creating a zone | zonecfg -z <zone>
see creating a zone for a more details |
| deleting a zone from the global ssytem | ## halt the zone first, then uninstall it zoneadm -z <zone> halt zoneadm -z <zone> uninstall ## now you can delete it |
| Display zones current configuration | zonecfg -z <zone> info |
| Display zone name | zonename |
| Create a zone creation file | zonecfg -z <zone> export |
| Verify a zone | zoneadm -z <zone> verify |
| Installing a zone | zoneadm -z <zone> install |
| Ready a zone | zoneadm -z <zone> ready |
| boot a zone | zoneadm -z <zone> boot |
| reboot a zone | zoneadm -z <zone> reboot |
| halt a zone | zoneadm -z <zone> halt |
| uninstalling a zone | zoneadm -z <zone> uninstall -F |
| Veiwing zones | zoneadm list -cv |
| login into a zone | zlogin <zone> |
| login to a zones console | zlogin -C <zone> (use ~. to exit) |
| login into a zone in safe mode (recovery) | zlogin -S <zone> |
| add/remove a package (global zone) | # pkgadd -G -d . <package>
If the -G option is missing the package will be added to all zones |
| add/remove a package (non-global zone) | # pkgadd -Z -d . <package>
If the -Z option is missing the package will be added to all zones |
| Query packages in all non-global zones | # pkginfo -Z |
| query packages in a specified zone | # pkginfo -z <zone> |
| lists processes in a zone | # ps -z <zone> |
| list the ipcs in a zone | # ipcs -z <zone> |
| process grep in a zone | # pgrep -z <zone> |
| list the ptree in a zone | # ptree -z <zone> |
| Display all filesystems | # df -Zk |
| display the zones process informtion | # prstat -Z
# prstat -z <zone> Note:-Z reports information about processes and zones |
Just blowing some free time on Digg and I found your article . Not typically what I prefer to read about, but it was definitely worth my time. Thanks.