Updated 22 March 2010
Linux Logo

Uninstalling a Solaris Zone


Description:
  • This procedure describes how to uninstall a Solaris Zone.
Prerequisites:
  • Access to the global zone server. Zone must be in the Installed.
Notes:
  • If a zone is not uninstalled and autoboot is set "true", it will startup automatically if the global zone is rebooted.
References:

Step Action Description
1 Use zoneadm list on the global zone server to show status of zone.
# /usr/sbin/zoneadm list -vi

On the global zone, use the zoneadm list -vi to show current status of all installed zones. If the zone is not in the installed state, it will need to be placed in that state with zoneadm -z <zone name> halt.

global# /usr/sbin/zoneadm list -vi                         
  ID NAME             STATUS         PATH                           BRAND    IP
   0 global           running        /                              native   shared
   2 lqwdev           running        /zones/lqwdev                  native   shared
   5 lqweb            running        /zones/lqweb                   native   shared
   - myzone           running        /zones/myzone                  native   shared
   - myzone2          installed      /zones/myzone2                 native   shared
   - myzone3          installed      /zones/myzone3                 native   shared
global# zoneadm -z myzone halt
global# /usr/sbin/zoneadm list -vi
  ID NAME             STATUS         PATH                           BRAND    IP
   0 global           running        /                              native   shared
   2 lqwdev           running        /zones/lqwdev                  native   shared
   5 lqweb            running        /zones/lqweb                   native   shared
   - myzone           installed      /zones/myzone                  native   shared
   - myzone2          installed      /zones/myzone2                 native   shared
   - myzone3          installed      /zones/myzone3                 native   shared
2 Use zoneadm -z <zone name> with the uninstalled option to uninstlled a zone.
# zoneadm -z <zone name> boot

On the global zone, Boot the new zone by issuing zoneadm -z <zonename> uninstall.

global# /usr/sbin/zoneadm list -vi                         
  ID NAME             STATUS         PATH                           BRAND    IP
   0 global           running        /                              native   shared
   2 lqwdev           running        /zones/lqwdev                  native   shared
   5 lqweb            running        /zones/lqweb                   native   shared
   - myzone           installed      /zones/myzone                  native   shared
   - myzone2          installed      /zones/myzone2                 native   shared
   - myzone3          installed      /zones/myzone3                 native   shared
global# zoneadm -z myzone uninstall
Are you sure you want to uninstall zone myzone (y/[n])? y
global# 
Note: Unintalling a zone will remove all its file in the "zonepath" directory. The directory will still remain.
3 Use zoneadm list on the global zone server with the -vc option to show status of zone
# /usr/sbin/zoneadm list -vc

On the global zone, use the zoneadm list -vc to verify that the zone is now running.

global# /usr/sbin/zoneadm list -vc
  ID NAME             STATUS         PATH                           BRAND    IP
   0 global           running        /                              native   shared
   2 lqwdev           running        /zones/lqwdev                  native   shared
   5 lqweb            running        /zones/lqweb                   native   shared
   - myzone           installed      /zones/myzone                  native   shared
   - myzone2          installed      /zones/myzone2                 native   shared
   - myzone3          installed      /zones/myzone3                 native   shared
global# zoneadm -z myzone uninstall
Are you sure you want to uninstall zone myzone (y/[n])? y
global#  /usr/sbin/zoneadm list -vc
  ID NAME             STATUS         PATH                           BRAND    IP
   0 global           running        /                              native   shared
   2 lqwdev           running        /zones/lqwdev                  native   shared
   5 lqweb            running        /zones/lqweb                   native   shared
   - myzone           configured     /zones/myzone                  native   shared
   - myzone2          installed      /zones/myzone2                 native   shared
   - myzone3          installed      /zones/myzone3                 native   shared
global#
Note: You must use /usr/sbin/zoneadm list -vc or the zone will never appear in the list. c-stands for configured which also includes running and installed. If you try to use /usr/sbin/zoneadm list -vi, it will not show any configured zone entry.
Click for more info