Find it

Tuesday, August 18, 2009

How to tell if server is global or non-global zone/How to Tell If the Solaris Zone is a Whole Root or Sparse Zone

On day to day basis many times wee need to know if the server we are working on is GZ or NGZ or may be sometimes for performing some automation related to such condition, pkgcond command can be very much helpful in such cases.

# pkgcond is_nonglobal_zone
# echo $?
1
# pkgcond is_global_zone
# echo $?
0

Where 1 is false and 0 is true. So here pkgcond is_nonglobal_zone output is 1 it means it is a global zone!

-----------------------------------------------------------------------------------

# pkgcond
no condition to check specified; usage is:
pkgcond [-nv] [ ]

command options:
-n - negate results of condition test
-v - verbose output of condition testing

may be any one of:
can_add_driver [path]
can_remove_driver [path]
can_update_driver [path]
is_alternative_root [path]
is_boot_environment [path]
is_diskless_client [path]
is_global_zone [path]
is_mounted_miniroot [path]
is_netinstall_image [path]
is_nonglobal_zone [path]
is_path_writable path
is_running_system [path]
is_sparse_root_nonglobal_zone [path]
is_what [path]
is_whole_root_nonglobal_zone [path]

are specific to the condition used

pkgcond -?
- Shows this help message

So same can be achieved for finding if zone is a whole root or Sparse Zone.

# pkgcond is_whole_root_nonglobal_zone
# echo $?
0
# pkgcond is_sparse_root_nonglobal_zone
# echo $?
1


So here it clearly shows the zone is whole root zone.

No comments:

Post a Comment