Welcome to Machine Unix

Search Below

How to Upgrade your Solaris Zones with zoneadm detach/attach Feature

I am in OS heaven, this month and last month Solaris world saw bunch of distribution releases. Joyent released SmartOS and shortly after a month later we saw OpenIndiana release. Just recently Oracle also released an update to Solaris OS, thus marking it’s 10th release/update.

Having choices is a good thing from a customer or user point of view. It gives us a lot of flexibility. So with this in mind, I was considering to update my Solaris 10 U9 to Solaris 10 U10. If you had access to the patch bundles, it would be really easy to upgrade the system to update 10 with Live Upgrade. Since I don’t have access to the patch bundles at all, I decided to do a scratch install. However I have bunch of  zones in my Update 9 install.

So simply copying the zone files into the new Update 10 install is not going to cut it because now I have a higher patch level in the new install. I found the solution in zoneadm detach/attach feature.

First, I did a simple zfs send/receive on the file system so that zfs fs can be fetched into the new install:

root@solu9# zfs snapshot rpool/zones/zdns@092711

root@solu9# zfs send rpool/zones/zdns@092711 | ssh root@192.168.1.200 zfs recv rpool/zones/zdns

So, in the destination system I now have:

 # zfs list

……

rpool/zones/zdns              468M   41.1G     468M   /rpool/zones/zdns

rpool/zones/zdns@092711    0           –        468M  –

Then I scp’ed the zone’s xml file to the destination and updated the /etc/zones/index at the destination

root@solu9# scp /etc/zones/zdns.xml root@192.168.1.200:/etc/zones/.

root@solu10# cat /etc/zones/index

….

global:installed:/

zdns:installed:/zones/zdns:

Now, let’s look at the patch level in the source OS for that particular zone:

root@solu9# zlogin zdns

[Connected to zone ‘zdns’ pts/3]

Last login: Thu Sep 22 17:32:48 on pts/3

           .

._ _  _. _.|_ *._  _  ___ . .._ *./

[ | )(_](_.[ )|[ )(/,     (_|[ )|/’

                           __. .._  __|_ *._  _    _  _|*-+-* _ ._

                          _) (_|[ )_) [ )|[ )(/,  (/,(_]| | |(_)[ )

                ——————DNS SERVER—————–

root@zdns# uname -a

SunOS zdns 5.10 Generic_142910-17 i86pc i386 i86pc

Ok, my dns server’s on 142910-17 patch level on Update 9 install. In the destination, we have all we need and now we detach and attach the zone, so that the zone in the destination server will update itself to the newer patch level.

root@solu10# zoneadm -z zdns detach

root@solu10# zoneadm -z zdns attach -U

Getting the list of files to remove

Removing 1 files

Remove 16 of 16 packages

Installing 4243 files

Add 1021 of 1021 packages

Updating editable files

The file </var/sadm/system/logs/update_log> within the zone contains a log of the zone update.

root@solu10# zoneadm list -civ

  ID NAME             STATUS     PATH                           BRAND    IP

   0 global           running    /                              native   shared

   – zdns             installed  /zones/zdns                    native   shared

Let’s look at the Update 10’s patch level:

root@solu10# uname -a

SunOS solu10 5.10 Generic_147441-01 i86pc i386 i86pc

Let’s boot the zone and login to the zone on the destination server:

root@solu10# zoneadm -z zdns boot

root@solu10# zlogin zdns

[Connected to zone ‘zdns’ pts/4]

Last login: Mon Sep 26 23:34:00 on console

           .

._ _  _. _.|_ *._  _  ___ . .._ *./

[ | )(_](_.[ )|[ )(/,     (_|[ )|/’

                           __. .._  __|_ *._  _    _  _|*-+-* _ ._

                          _) (_|[ )_) [ )|[ )(/,  (/,(_]| | |(_)[ )

                ——————DNS SERVER—————–

root@zdns# uname -a

SunOS zdns 5.10 Generic_147441-01 i86pc i386 i86pc

Beautiful, I just transferred one of my zones and upgraded its patch level by attaching the zone. One more thing to notice is that when I did the upgrade for the zone, index file also automatically updated with its zone id.