A universally unique identifier (UUID) is assigned to a zone when it is installed. The UUID can be obtained by using zoneadm with the list subcommand and the –c –p options. The UUID is the fifth field of the display.
global# zoneadm list -cp
You will see a display similar to the following:
0:global:running:/::solaris:shared:-:none: 3:test_zone:running:/system/volatile/zones/test_zone/zonepath:95180a6d-fab2-4363-ee33-81ba6e84a84f:solaris-kz:excl:R:solaris-kz: -:zone123:installed:/system/zones/zone123:96972ce7-d41d-4fec-ff4b-8f14123e0974:solaris:excl:-::
Use the following command to obtain the UUID for test_zone:
# zoneadm list -cp | grep test_zone | cut -f 5 -d:
You will see a display similar to the following:
95180a6d-fab2-4363-ee33-81ba6e84a84fExample 3-2 How to Use the test_zone UUID in a Command
global# zoneadm -z test_zone -u 95180a6d-fab2-4363-ee33-81ba6e84a84f list -v
You will see a display similar to the following:
ID NAME STATUS PATH BRAND IP 3 test_zone running - solaris-kz excl
If both –u uuid-match and –z zonename are present, the match is done based on the UUID first. If a zone with the specified UUID is found, that zone is used, and the –z parameter is ignored. If no zone with the specified UUID is found, then the system searches by the zone name.
Zones can be uninstalled and reinstalled under the same name with different contents. Zones can also be renamed without the contents being changed. For these reasons, the UUID is more reliable than the zone name.
See also
For more information, see zoneadm(1M) and libuuid(3LIB).