This article hasn't been updated for over 5 years. The information below may be obsolete.
Renaming a local Solaris zone
This is a short how-to article providing steps to rename a local zone on Solaris.
NOTE: All these steps need to be performed on the global zone.
We use the zonecfg to change the zonename entry. In this article we will rename zone alpha to bravo.
- Stop the zone you wish to rename:
root@global# zoneadm -z alpha halt
- List the zones on the system, to verify that your zone has been halted:
root@global# zoneadm list -iv ID NAME STATUS PATH BRAND IP 0 global running / solaris shared - alpha installed /zones/alpha solaris excl
- Rename the zone using zonecfg:
root@global# zonecfg -z aplha zonecfg:alpha> set zonename=bravo zonecfg:bravo>
Notice that the prompt has already changed to indicate the new zone name. - Use the info sub-command to check the information is correct:
zonecfg:bravo> info zonecfg:myzone2> info zonename: bravo zonepath: /zones/alpha brand: native autoboot: false bootargs: pool: scheduling-class: ip-type: shared hostid: inherit-pkg-dir: dir: /lib inherit-pkg-dir: dir: /platform inherit-pkg-dir: dir: /sbin inherit-pkg-dir: dir: /usr net: address: x.x.x.x/24 physical: nxge2 defrouter: y.y.y.yReview the output - Verify the current configuration, commit your changes from memory to stable storage, and exit zonecfg:
zonecfg:bravo verify zonecfg:bravo commit zonecfg:bravo exit
- Modify /etc/nodename and set the new hostname. Using the zonepath from the info output in step 4, the file we would need to modify is:
/zones/alpha/root/etc/nodename
- Likewise, modify /etc/hosts and set the new hostname. In our example, the path to /etc/hosts is:
/zones/alpha/root/etc/hosts
- Start your newly renamed zone:
root@global# zoneadm -z bravo boot
- Login to your new zone and verify that the old hostname has changed to your new hostname:
root@global# zlogin bravo root@bravo# hostname bravo