Wednesday, October 10, 2012

Branded Zones


Zones - Solaris 8 Branded Zone


Install and patch Solaris 10


hostA # cat /etc/release
                      Solaris 10 10/09 s10s_u8wos_08a SPARC
           Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                           Assembled 16 September 2009

Assumptions

  • you are using Solaris 10 10/08 or later for the global zone
  • you will use ZFS as the filesystem for the zone

Create the zone


Install Branded zone software


Solaris 8 or Solaris 9 branded container packages can be obtained from here.

Check you have SUNWs8brandr and SUNWs8brandu installed. If you don't, you will have to install them from the DVD/wherever and re-patch the system.

hostA # pkginfo | grep SUNWs8brand
system      SUNWs8brandr                     Solaris 8 Containers: solaris8 brand support (Root)
system      SUNWs8brandu                     Solaris 8 Containers: solaris8 brand support (Usr)

Assuming SUNWs8brandr and SUNWs8brandu are installed, continue as below:

hostA # cd dir_where_you_put_s8containers
hostA # ls -l
total 1213068
-rw-r--r--   1 newcar01 sysadmin 44037764 Jun 28 14:04 s8containers-bundle-solaris10-sparc.tar.gz
-rw-r--r--   1 newcar01 sysadmin 576538362 Jun 28 14:05 solaris8-image.flar

Compare the checksum with the list provided on the software site:

hostA # digest -a md5 s8containers-bundle-solaris10-sparc.tar.gz
8d21762e5133954e1191879fe8772a01
hostA # digest -a md5 solaris8-image.flar
3e422b386b5c5824ce1f359da47bedbd

Gunzip and untar

hostA # gzcat s8containers-bundle-solaris10-sparc.tar.gz | tar xf -

 
hostA # pkgadd -d s8containers-bundle/1.0.1/Product SUNWs8brandk
 
Processing package instance <SUNWs8brandk> from </export/home/newcar01/branded_zones/s8containers-bundle/1.0.1/Product>
 
Solaris 8 Containers: solaris8 brand support RTU(sparc) 11.10.0,REV=2008.09.20.18.50
Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Using </> as the package base directory.
## Processing package information.
## Processing system information.
   8 package pathnames are already properly installed.
## Verifying package dependencies.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
 
The following files are already installed on the system and are being
used by another package:
  /usr/share/man/man5/solaris8.5
 
Do you want to install these conflicting files [y,n,?,q] y
## Checking for setuid/setgid programs.
 
Installing Solaris 8 Containers: solaris8 brand support RTU as <SUNWs8brandk>
 
## Installing part 1 of 1.
/usr/lib/brand/solaris8/files/patches/109147-44.zip
/usr/lib/brand/solaris8/files/patches/109221-01.zip
/usr/lib/brand/solaris8/files/patches/111023-03.zip
/usr/lib/brand/solaris8/files/patches/111431-01.zip
/usr/lib/brand/solaris8/files/patches/112050-04.zip
/usr/lib/brand/solaris8/files/patches/112605-04.zip
/usr/lib/brand/solaris8/files/patches/order
/usr/share/man/man5/solaris8.5
[ verifying class <none> ]
 
Installation of <SUNWs8brandk> was successful.

Create a fileystem for the container/zone


hostA # format
Searching for disks...done
 
AVAILABLE DISK SELECTIONS:
       0. c0d0 <SUN-DiskImage-15GB cyl 424 alt 2 hd 96 sec 768>
          /virtual-devices@100/channel-devices@200/disk@0
       1. c0d1 <SUN-DiskImage-15GB cyl 424 alt 2 hd 96 sec 768>
          /virtual-devices@100/channel-devices@200/disk@1
 
hostA # zpool create zonepool c0d1
hostA # zpool list
NAME       SIZE   USED  AVAIL    CAP  HEALTH  ALTROOT
rpool     14.9G  6.14G  8.73G    41%  ONLINE  -
zonepool  14.9G  76.5K  14.9G     0%  ONLINE  -
 
hostA # mkdir -p /export/zones/A
hostA # zfs create -o mountpoint=/export/zones/lt07z01 -o quota=15g zonepool/A
hostA # df -k /export/zones/A
Filesystem            kbytes    used   avail capacity  Mounted on
zonepool/A     15353856      21 15353743     1%    /export/zones/A
hostA # zfs list
NAME                            USED  AVAIL  REFER  MOUNTPOINT
rpool                          8.14G  6.50G    97K  /rpool
rpool/ROOT                     4.64G  6.50G    21K  legacy
rpool/ROOT/s10s_u8wos_08a      4.64G  6.50G  4.58G  /
rpool/ROOT/s10s_u8wos_08a/var  67.6M  6.50G  67.6M  /var
rpool/dump                     1.50G  6.50G  1.50G  -
rpool/export                     60K  6.50G    25K  /export
rpool/export/home                35K  6.50G    35K  /export/home
rpool/swap                        2G  8.50G    16K  -
zonepool                        112K  14.6G    21K  /zonepool
zonepool/A                21K  14.6G    21K  /export/zones/A

Configure the Solaris 8 container


Make sure that the zonepath is only rwx by root

hostA # cd /export/zones/
hostA # ls -l
total 3
drwxr-xr-x   3 root     root           3 Jun 28 11:07 A
hostA # chmod go-rx lt07z01
hostA # ls -l
total 3
drwx------   3 root     root           3 Jun 28 11:07 A
hostA # cd -
hostA # ls
s8containers-bundle
s8containers-bundle-solaris10-sparc.tar.gz
solaris8-image.flar
 
hostA # zonecfg -z A
A: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:A> create -t SUNWsolaris8
zonecfg:A> set zonepath=/export/zones/A
zonecfg:A> set autoboot=true
zonecfg:A> add net
zonecfg:A:net> set address=<IP>
zonecfg:A:net> set physical=vnet0
zonecfg:A:net> end
zonecfg:A> add attr
zonecfg:A:attr> set name=hostid
zonecfg:A:attr> set type=string
zonecfg:A:attr> set value=8000abcd
zonecfg:A:attr> end
zonecfg:A> add attr
zonecfg:A:attr> set name=machine
zonecfg:A:attr> set type=string
zonecfg:A:attr> set value=sun4u
zonecfg:A:attr> end
zonecfg:A> verify
zonecfg:A> commit
zonecfg:A> exit
hostA # ls /
bin       devices   home      mnt       platform  sbin      usr       zonepool
boot      etc       kernel    net       proc      system    var
dev       export    lib       opt       rpool     tmp       vol
hostA # mkdir -p /backup/zones
hostA # zonecfg -z A export > /backup/zones/A.config

Note: commands in grey above are optional. Use them only if the system needs them, (license requires specific hostid for example).

Use the full path to the zone image file ...


hostA # zoneadm -z A install -u -a <PATH>/branded_zones/solaris8-image.flar
      Log File: /var/tmp/A.log
        Source: /<PATH>/branded_zones/solaris8-image.flar
    Installing: This may take several minutes...
Postprocessing: This may take several minutes...
 
        Result: Installation completed successfully.
      Log File: /export/zones/A/root/var/log/A.log

Note regarding the zoneadm flags available/used:

-a
Location of archive from which to copy system image. Full flash archive and cpio, gzip compressed cpio, bzip compressed cpio, and level 0 ufsdump are supported. Refer to the gzip man page available in the SUNWsfman package. Use the full path.
-p
Preserve system identity (opposite of -u below)
-s
Install silently
-u
sys-unconfig the zone
-v
Verbose output

hostA # zoneadm list -icv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   - A        installed  /export/zones/A         solaris8 shared
hostA # zoneadm -z A boot
hostA # zoneadm list -icv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   2 A          running    /export/zones/A          solaris8 shared
h1gs002lt07 # zlogin -C A
[Connected to zone 'A' console]
 
 
You did not enter a selection.
What type of terminal are you using?
 1) ANSI Standard CRT
 2) DEC VT52
 3) DEC VT100
 4) Heathkit 19
 5) Lear Siegler ADM31
 6) PC Console
 7) Sun Command Tool
 8) Sun Workstation
 9) Televideo 910
 10) Televideo 925
 11) Wyse Model 50
 12) X Terminal Emulator (xterms)
 13) Other
Type the number of your choice and press Return:
(etc)

After configuring:

hostA console login: root
Password:
Jun 28 15:12:36 hostA login: ROOT LOGIN /dev/console
Sun Microsystems Inc.   SunOS 5.8       Generic Patch   February 2004
# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/                    15353659 5877991 9475668    39%    /
/.SUNWnative/lib     9766611 4593430 5173181    48%    /.SUNWnative/lib
/.SUNWnative/platform
                     9766611 4593430 5173181    48%    /.SUNWnative/platform
/.SUNWnative/usr     9766611 4593430 5173181    48%    /.SUNWnative/usr
/dev                 15353659 5877991 9475668    39%    /dev
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 6216728      16 6216712     1%    /etc/svc/volatile
/dev/ksyms           9766611 4593430 5173181    48%    /dev/ksyms
fd                         0       0       0     0%    /dev/fd
swap                 6216728      16 6216712     1%    /tmp

Note: Being Solaris 8, SSH will not be running. Or even installed.


Zones - Solaris 9 Branded Zone


Install and patch Solaris 10


hostA # cat /etc/release
                      Solaris 10 10/09 s10s_u8wos_08a SPARC
           Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                           Assembled 16 September 2009

Assumptions

  • you are using Solaris 10 10/08 or later for the global zone
  • you will use ZFS as the filesystem for the zone

Create the zone


Install Branded zone software


Solaris 8 or Solaris 9 branded container packages can be obtained from here.

heck you have SUNWs9brandr and SUNWs9brandu installed. If you don't, you will have to install them from the DVD/wherever and re-patch the system.

hostA # pkginfo | grep SUNWs9brand
system      SUNWs9brandr                     Solaris 9 Containers: solaris9 brand support (Root)
system      SUNWs9brandu                     Solaris 9 Containers: solaris9 brand support (Usr)

Assuming SUNWs9brandr and SUNWs9brandu are installed, continue as below:

hostA # cd dir_where_you_put_s9containers

Compare the checksum with the
list provided on the software site: 

hostA # digest -a md5 s9containers-bundle-solaris10-sparc.tar.gz
bdc58266678ff721aa64fc548e9cc0a3
hostA # digest -a md5 solaris9-image.flar
549b402a6b250b590e7e90580eafe323

Gunzip, untar and install

hostA # gzcat s9containers-bundle-solaris10-sparc.tar.gz | tar xf -

hostA7 # pkgadd -d s9containers-bundle/1.0.1/Product SUNWs9brandk
 
Solaris 9 Containers: solaris9 brand support RTU(sparc) 11.10.0,REV=2008.09.20.18.50
Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Using </> as the package base directory.
## Processing package information.
## Processing system information.
   8 package pathnames are already properly installed.
## Verifying package dependencies.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.
 
Installing Solaris 9 Containers: solaris9 brand support RTU as <SUNWs9brandk>
 
## Installing part 1 of 1.
/usr/lib/brand/solaris9/files/patches/112963-32.zip
/usr/lib/brand/solaris9/files/patches/115986-03.zip
/usr/lib/brand/solaris9/files/patches/order
/usr/share/man/man5/solaris9.5
[ verifying class <none> ]
 
Installation of <SUNWs9brandk> was successful.

Create a fileystem for the container/zone


hostA # zpool status -v
  pool: ABapps
 state: ONLINE
 scrub: none requested
config:
 
        NAME        STATE     READ WRITE CKSUM
       ABapps    ONLINE       0     0     0
          c0d3s0    ONLINE       0     0     0
 
errors: No known data errors
 
  pool: rpool
 state: ONLINE
 scrub: none requested
config:
 
        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          c0d0s0    ONLINE       0     0     0
 
errors: No known data errors
hostA # echo | format
Searching for disks...done
 
 
AVAILABLE DISK SELECTIONS:
       0. c0d0 <SUN-DiskImage-15GB cyl 424 alt 2 hd 96 sec 768>
          /virtual-devices@100/channel-devices@200/disk@0
       1. c0d1 <Unknown-Unknown-0001-15.00GB>
          /virtual-devices@100/channel-devices@200/disk@1
       2. c0d3 <Unknown-Unknown-0001-10.01GB>
          /virtual-devices@100/channel-devices@200/disk@3
Specify disk (enter its number): Specify disk (enter its number):

c0d1 appears to be free. Since it is labelled <Unknown-Unknown-0001-15.00GB>, it has either been exported as a slice (essential for later resizing, should it be required), or the underlying [primary] LUN (as opposed to the [guest] virtual disk) is an EFI-labelled disk.

In this case (I know from checking the primary), the underlying LUN is an EFI-labelled disk.

Either way, we need to specify slice 0 when creating a zpool, e.g.:

hostA # zpool create zonepool02 c0d1
invalid vdev specification
use '-f' to override the following errors:
/dev/dsk/c0d1s0 is part of exported or potentially active ZFS pool zonepool. Please see zpool(1M).
hostA # zpool create zonepool02 c0d1s0
invalid vdev specification
use '-f' to override the following errors:
/dev/dsk/c0d1s0 is part of exported or potentially active ZFS pool zonepool. Please see zpool(1M).

This seems to be because c0d1s0 was used for other zpools. Make sure that it is not in current use, (check the primary as well) then if you are sure, you can force the zpool create:

hostA # zpool create -f zonepool02 c0d1s0
hostA # zpool status -v zonepool02
  pool: zonepool02
 state: ONLINE
 scrub: none requested
config:
 
        NAME        STATE     READ WRITE CKSUM
        zonepool02  ONLINE       0     0     0
          c0d1s0    ONLINE       0     0     0
 
errors: No known data errors
 
hostA # zfs create -o mountpoint=/export/zones/A -o quota=15g zonepool02/A
hostA # zfs list
NAME                            USED  AVAIL  REFER  MOUNTPOINT
...
zonepool02                      112K  14.6G    21K  /zonepool02
zonepool02/A          21K  14.6G    21K  /export/zones/A

Configure the Solaris 9 container


Make sure that the zonepath is only rwx by root

hostA # cd /export/zones/
hostA # ls -l
total 3
drwxr-xr-x   2 root     root           2 Jul  6 11:58 A
hostA # chmod go-rx A
hostA # ls -l
total 3
drwx------   2 root     root           2 Jul  6 11:58 A

Return to the directory where the s9 container flar file is located

hostA # cd -
/apps/rob/s9bz
hostA # ls
s9containers-bundle
s9containers-bundle-solaris10-sparc.tar.gz
solaris9-image.flar

Create the zone


hostA # zonecfg -z A
A: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:A> create -t SUNWsolaris9
zonecfg:A> set zonepath=/export/zones/A
zonecfg:A> set autoboot=true
zonecfg:A> add net
zonecfg:A:net> set address=<IP>
zonecfg:A:net> set physical=vnet0
zonecfg:A:net> end
zonecfg:A> add attr
zonecfg:A:attr> set name=hostid
zonecfg:A:attr> set type=string
zonecfg:A:attr> set value=8000bcde
zonecfg:A:attr> end
zonecfg:A> add attr
zonecfg:A:attr> set name=machine
zonecfg:A:attr> set type=string
zonecfg:A:attr> set value=sun4u
zonecfg:A:attr> end
zonecfg:A> verify
zonecfg:A> commit
zonecfg:A> exit
hostA # ls /
bin       devices   home      mnt       platform  sbin      usr       zonepool
boot      etc       kernel    net       proc      system    var
dev       export    lib       opt       rpool     tmp       vol
hostA # mkdir -p /backup/zones
hostA # zonecfg -z A export > /backup/zones/A.config

Note: commands in grey above are optional. Use them only if the system needs them, (license requires specific hostid for example).

Use the full path to the zone image file ...

hostA # pwd
/apps/rob/s9bz
hostA # zoneadm -z Ainstall -u -a /<PATH>/solaris9-image.flar
     
 
        Result: Installation completed successfully.
     
Note regarding the zoneadm flags available/used:

-a
Location of archive from which to copy system image. Full flash archive and cpio, gzip compressed cpio, bzip compressed cpio, and level 0 ufsdump are supported. Refer to the gzip man page available in the SUNWsfman package. Use the full path.
-p
Preserve system identity (opposite of -u below)
-s
Install silently
-u
sys-unconfig the zone
-v
Verbose output

hostA # zoneadm list -icv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   - A         installed  /export/zones/A          solaris9 shared
hostA # zoneadm -z A boot
h1gs002lt07 # zoneadm list -icv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   2 A         running    /export/zones/A        solaris9 shared
hostA # zlogin -C A
[Connected to zone 'A' console]
 
...
 
Select a Language
 
  0. English
  1. es
  2. fr
 
Please make a choice (0 - 2), or press h or ? for help: 0
 
...
 
Select a Locale
 
  0. English (C - 7-bit ASCII)
  1. Canada-English (ISO8859-1)
  2. Hindi UTF-8
  3. Thai TIS620
  4. Thai UTF-8
  5. U.S.A. (UTF-8)
  6. U.S.A. (en_US.ISO8859-1)
  7. U.S.A. (en_US.ISO8859-15)
  8. Go Back to Previous Screen
 
Please make a choice (0 - 8), or press h or ? for help: 0
 
...
 
What type of terminal are you using?
 1) ANSI Standard CRT
 2) DEC VT52
 3) DEC VT100
 4) Heathkit 19
 5) Lear Siegler ADM31
 6) PC Console
 7) Sun Command Tool
 8) Sun Workstation
 9) Televideo 910
 10) Televideo 925
 11) Wyse Model 50
 12) X Terminal Emulator (xterms)
 13) CDE Terminal Emulator (dtterm)
 14) Other
Type the number of your choice and press Return: 3
Configuring network interface addresses: vnet0.
(etc)

After configuring:

hostA console login: root
Password:


No comments:

Post a Comment