Monday, January 26, 2015

Solaris 11.2: Converting native zone as Kernel zone


Oracle Solaris 11.2 kernel zones supports both backwards and forwards compatibility which means you can also run oracle Solaris 11.3(When it release) on the kernel zone where your global zone can still with oracle Solaris 11.2  In most of the Solaris 11 projects , they may have already deployed the  traditional native zones (Whole root) and now may be they are thinking that how to convert the whole root zones as kernel zones. For those who want to convert existing native zone as kernel zone, please follow the below procedure.

1. Login to the global zone and list the installed zones. Here we will convert WHOLEROOT zone (native) as kernel zone.

root@UA-GLOBAL:/UAIPS# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / solaris shared
- UAKLZ1 installed - solaris-kz excl
- WHOLEROOT installed /cloudS/WHOLEROOT solaris excl
- UANEWZ1 installed /cloudS/UANEWZ1 solaris excl
root@UA-GLOBAL:/UAIPS#

2. Here WHOLEROOT is native zone. Create a unified archive for that local zone.

root@UA-GLOBAL:~# archiveadm create -z WHOLEROOT /UAIPS/WHOLEROOT.uar
Unified Archive initialized: /UAIPS/WHOLEROOT.uar.
Logging to: /system/volatile/archive_log.17649
Dataset discovery completey...
Media creation completefor zone(s)...
Archive stream creation completen...
Archive creation completessembly...
root@UA-GLOBAL:~#

3. Check the newly created unified archive information.

root@UA-GLOBAL:/UAIPS# ls -lrt /UAIPS/WHOLEROOT.uar
-rw-r--r-- 1 root root 1276774400 Aug 11 08:12 /UAIPS/WHOLEROOT.uar
root@UA-GLOBAL:/UAIPS# archiveadm info /UAIPS/WHOLEROOT.uar
Archive Information
Creation Time: 2014-08-11T02:38:16Z
Source Host: UA-GLOBAL
Architecture: i386
Operating System: Oracle Solaris 11.2 X86
Deployable Systems: WHOLEROOT
root@UA-GLOBAL:/UAIPS#

4. To know more about archive, use option -v.

root@UA-GLOBAL:/UAIPS# archiveadm info -v /UAIPS/WHOLEROOT.uar
Archive Information
Creation Time: 2014-08-11T02:38:16Z
Source Host: UA-GLOBAL
Architecture: i386
Operating System: Oracle Solaris 11.2 X86
Recovery Archive: No
Unique ID: 0cc5c0db-0238-4420-e0c1-f9441f91de70
Archive Version: 1.0

Deployable Systems
'WHOLEROOT'
OS Version: 0.5.11
OS Branch: 0.175.2.0.0.42.2
Active BE: solaris-1
Brand: solaris
Size Needed: 720MB
Unique ID: b5223e93-d28c-402c-ecfa-b0fb8d1b19bd
AI Media: 0.175.2_ai_i386.iso
Root-only: Yes
root@UA-GLOBAL:/UAIPS#

5. Create a new kernel zone configuration using below command.

root@UA-GLOBAL:/UAIPS# zonecfg -z UAKERZ2 create -t SYSsolaris-kz
root@UA-GLOBAL:/UAIPS#

6. Make sure you have minimum 16GB on the zone's root path.

root@SAN:~# zonecfg -z UAKERZ2 info device
device:
match not specified
storage: dev:/dev/zvol/dsk/rpool/VARSHARE/zones/UAKERZ2/disk0
id: 0
bootpri: 0
root@SAN:~#

Note: Oracle Solaris kernel zones will not use ZFS dataset. It creates an emulated volume in ZFS and that will act as virtual disk. So there is no option to set the zonepath. Instead of that, we have to set device to install the kernel zone.
As per the above command output, this kernel zone will create a virtual disk under rpool. Let me modify to other zpool since my rpool doesn't have enough space to install it.

7. Here i am modifying the zone's root disk path.

root@UA-GLOBAL:~# zonecfg -z UAKERZ2
zonecfg:UAKERZ2> select device id=0
zonecfg:UAKERZ2:device> set storage=dev:/dev/zvol/dsk/cloudS/UAKERZ2-disk0
zonecfg:UAKERZ2:device> info
device:
match not specified
storage: dev:/dev/zvol/dsk/cloudS/UAKERZ2-disk0
id: 0
bootpri: 0
zonecfg:UAKERZ2:device> end
zonecfg:UAKERZ2> commit
zonecfg:UAKERZ2> exit
root@UA-GLOBAL:~# zonecfg -z UAKERZ2 info device
device:
match not specified
storage: dev:/dev/zvol/dsk/cloudS/UAKERZ2-disk0
id: 0
bootpri: 0
root@UA-GLOBAL:~# zpool list cloudS
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
cloudS 23.8G 1.47G 22.3G 6% 1.00x ONLINE -
root@UA-GLOBAL:~#

8. Restore the wholeroot zone's archive using below command.

root@UA-GLOBAL:/UAIPS# zoneadm -z UAKERZ2 install -a /UAIPS/WHOLEROOT.uar
Progress being logged to /var/log/zones/zoneadm.20140811T085531Z.UAKERZ2.install
[Connected to zone 'UAKERZ2' console]
Boot device: cdrom1 File and args: -B install=true,auto-shutdown=true -B aimanifest=/system/shared/ai.xml
reading module /platform/i86pc/amd64/boot_archive...done.
reading kernel file /platform/i86pc/kernel/amd64/unix...done.
SunOS Release 5.11 Version 11.2 64-bit
Copyright (c) 1983, 2014, Oracle and/or its affiliates. All rights reserved.
Remounting root read/write
Probing for device nodes ...
Preparing image for use
Done mounting image
Configuring devices.
Hostname: solaris
Using specified install manifest : /system/shared/ai.xml

solaris console login:
Automated Installation started
The progress of the Automated Installation will be output to the console
Detailed logging is in the logfile at /system/volatile/install_log
Press RETURN to get a login prompt at any time.

08:58:17 Install Log: /system/volatile/install_log
08:58:17 Using XML Manifest: /system/volatile/ai.xml
08:58:17 Using profile specification: /system/volatile/profile
08:58:17 Starting installation.
08:58:17 0% Preparing for Installation
08:58:18 100% manifest-parser completed.
08:58:18 100% None
08:58:18 0% Preparing for Installation
08:58:19 1% Preparing for Installation
08:58:19 2% Preparing for Installation
08:58:19 3% Preparing for Installation
08:58:19 4% Preparing for Installation
08:58:20 5% archive-1 completed.
08:58:21 8% target-discovery completed.
08:58:24 Pre-validating manifest targets before actual target selection
08:58:24 Selected Disk(s) : c1d0
08:58:24 Pre-validation of manifest targets completed
08:58:24 Validating combined manifest and archive origin targets
08:58:24 Selected Disk(s) : c1d0
08:58:24 9% target-selection completed.
08:58:24 10% ai-configuration completed.
08:58:24 9% var-share-dataset completed.
08:58:30 10% target-instantiation completed.
08:58:30 10% Beginning archive transfer
08:58:30 Commencing transfer of stream: b5223e93-d28c-402c-ecfa-b0fb8d1b19bd-0.zfs to rpool
08:58:39 14% Transferring contents
08:58:41 20% Transferring contents
08:58:43 21% Transferring contents
08:58:45 28% Transferring contents
08:58:51 35% Transferring contents
08:58:56 37% Transferring contents
08:59:00 40% Transferring contents
08:59:02 45% Transferring contents
08:59:06 52% Transferring contents
08:59:10 62% Transferring contents
08:59:16 66% Transferring contents
08:59:21 74% Transferring contents
08:59:23 75% Transferring contents
08:59:27 80% Transferring contents
08:59:31 89% Transferring contents
09:00:32 Completed transfer of stream: 'b5223e93-d28c-402c-ecfa-b0fb8d1b19bd-0.zfs' from file:///system/shared/uafs/OVA
09:00:35 Archive transfer completed
09:00:54 90% generated-transfer-867-1 completed.
09:00:54 90% Beginning IPS transfer
09:00:54 Setting post-install publishers to:
09:00:54 solaris
09:00:54 origin: file:///UAIPS/repo/
09:00:54 90% generated-transfer-867-2 completed.

9. Once the zone installation is completed, just boot the zone and login to zone's console for setting the host name and IP address.

root@UA-GLOBAL:/UAIPS# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / solaris shared
- UAKLZ1 installed - solaris-kz excl
- WHOLEROOT installed /cloudS/WHOLEROOT solaris excl
- UANEWZ1 installed /cloudS/UANEWZ1 solaris excl
- UAKERZ2 installed - solaris-kz excl
root@UA-GLOBAL:/UAIPS#
root@UA-GLOBAL:/UAIPS# zoneadm -z UAKERZ2 boot

10. Login to zone's console to complete the installation.

root@UA-GLOBAL:/UAIPS# zlogin -C UAKERZ2

System Configuration Summary

Review the settings below before continuing. Go back (F3) to make
changes.

Computer name: UAKERZ2

Network:
Manual Configuration: net0/v4
IP Address: 192.168.2.82/24
Netmask: 255.255.255.0

Time Zone: Asia/Kolkata
Locale:
Default Language: English
Language Support: English (United States)
No user account

Support configuration:
Not generating a Support profile as OCM and ASR services are not
installed.

F2_Apply F3_Back F6_Help F9_Quit
SC profile successfully generated as:
etc/svc/profile/sysconfig/sysconfig-20140811-083944/sc_profile.xml

Exiting System Configuration Tool. Log is available at:
/system/volatile/sysconfig/sysconfig.log.7288
Hostname: UAKERZ2

UAKERZ2 console login:

 
We have successfully migrated the whole root zone(native) as oracle Solaris kernel zone using unified archive . Kernel zones are very useful when you want to run the zone on its own patch level.

No comments:

Post a Comment