How to identify the global zone from within a local zone

Every now and then, a customer/ISV/partner wants to be able to identify the global zone from within a local zone. Per default, this is not possible.

This example describes how this can be done and even survive the relocation of the affected local zone from one node to another.

In this example, the global zone is named example, the local zone is named subample. local's zonepath is /zones/local.

Prework, has to be done once: Create an empty file /etc/globalzone in the local zone

root@example:/ # touch /zones/subample/root/etc/globalzone


Modify the zone's configuration

as a one-liner:

root@example:/ # zonecfg -z subample "add fs; set special=/etc/nodename; set type=lofs; set dir=/etc/globalzone; set options=ro; end"

or interactively:

root@example:/ # zonecfg -z subample
zonecfg:subample> add fs
zonecfg:subample:fs> set special=/etc/nodename
zonecfg:subample:fs> set type=lofs
zonecfg:subample:fs> set dir=/etc/globalzone
zonecfg:subample:fs> set options=ro
zonecfg:subample:fs> end
zonecfg:subample> exit

If the zone is already running, mount /etc/nodename

root@example:/ # mount -o ro -F lofs /etc/nodename /zones/subample/root/etc/globalzone

Check your work

root@example:/ # zlogin subample /bin/cat /etc/globalzone
example

Labels

rss rss Delete
solaris solaris Delete
container container Delete
favourite favourite Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact