Wednesday 27 March 2013

Copying a Solaris 11 Zone

Sidenote: While looking for some other info, a post I read said that Oracle was starting to use the word "zone" instead of "container" going forward. I don't know how official that is but I'm going to start doing the same - it's less to type!

 Okay, so one of my regular tasks in Solaris 10 is to copy a zone. My regular Solaris 10 procedure is like:

  1. Make a copy of the zone config (zonecfg -z zone export -f zone.cfg)
  2. Make a copy of the zonepath zfs filesystem (using zfs send and receive)
  3. Make a copy of any other filesystems  (using zfs send and receive)
  4. Edit the zone.cfg file to reference the copied zonepath and filesystems instead of the original ones. Also change the IP.
  5. Create the zone using the zone.cfg file (zonecfg -z zone1 -f zone.cfg)
  6. Attach the new zone (with -u)
  7. Boot the new zone and correct the hostname (using sys-unconfig).
For Solaris 11, points 2 and 7 have changed:
  1. Make a copy of the zone config (zonecfg -z zone export -f zone.cfg)
  2. Make a copy of the zonepath zfs filesystem (using zfs send and receive) including the zonepath's child filesystems but excluding the VARSHARE filesystem*
  3. Make a copy of any other filesystems  (using zfs send and receive)
  4. Edit the zone.cfg file to reference the copied zonepath and filesystems instead of the original ones. Also change the IP.
  5. Create the zone using the zone.cfg file (zonecfg -z zone1 -f zone.cfg)
  6. Attach the new zone (with -u)
  7. Boot the new zone, make sure export's mountpoint is /export and not /rpool/export and correct the hostname (using sysconfig configure -s).
---

*If you copied the zone and you included the VARSHARE filesystem, you're going to have problems when starting the zone. To fix this, log into the zone and do the following commands:
  zfs set canmount=noauto rpool/VARSHARE
  zfs set mountpoint=/var/share rpool/VARSHARE
  svcadm clear svc:/system/filesystem/minimal:default
  zfs set mountpoint=/export rpool/export

---

No comments:

Post a Comment

Note: only a member of this blog may post a comment.