Global zone name from local zone

How to check the global zone name from local zone.

The global zone name is always "global" so there is no need to check.

If you mean the global zone nodename/hostname, there is no direct way by design.

i mean if i 'm in a local zone and have no idea which global zone i belong to how can i see that or get my global zone name /hostname ?

As long as the Global Zone has not been renamed, you can find it.
Please check my previous post.

22blaze: Did you check that method ? I never had any success with it.
fugitive: As I already wrote, what you are asking for cannot be done by design. Non global zones are independent and shouldn't know anything about other zones. If they can, this is a bug and will be fixed.
Of course, nothing forbids you to create a file (eg: <zonepath>/root/etc/globalname) or to populate the /etc/inet/hosts file in each non global zone from the global one to tell them its hostname.

I do not know but i saw somewhere you can find it via a primitive method ..

arp -a | grep SP and then login to those servers .. and it shows the global zone but that will not in case if i 'm using exclusive IP for a zone :frowning:

The code finds pkginfo files in /var in the sparse zone.
Based on a quick review of my basic find output with no awks, the info gets parsed from the PATCH_INFO.
So, quite possibly, if the system has not been patched after the base install it may not return as expected.
Here is base code to start with and a single return of grep for my GZ name.

$ find /var -type f -name 'pkginfo' |xargs grep "From: " | grep <my GZ name here> 

RETURNS - 

/var/sadm/pkg/SUNWcsr/save/pspool/SUNWcsr/pkginfo:PATCH_INFO_125476-02=Installed: Tue Apr  1 17:19:43 PDT 2008 From: <my GZ name here>