Step by step instructions on how to create a Solaris 10 container.

Here is a step by step instructions on how I created a Solaris 10 container. I took advantage of the Solaris ZFS file system because of it’s inherient benifits such as quotas, compression, snapshots, shared storage of zone pool and zone cloning.

The first thing you need to do is to identify the free disk space. In my case I had already installed a new LUN on a fiber channel SAN and the LUN appears as a new disk in Solaris 10 (http://www.gamescheat.ca/2009/12/how-to-enable-fiber-channel-multipathing-on-solaris-10-server/). The format command will display all physical disks that the Os sees. In the below example disk 2 is the new LUN on the SAN.

root@myserver1 # format
Searching for disks…done

AVAILABLE DISK SELECTIONS:
0. c0t0d0
/pci@0,600000/pci@0/pci@0/scsi@0/sd@0,0
1. c0t1d0
/pci@0,600000/pci@0/pci@0/scsi@0/sd@1,0
2. c3t60060E800429C400000029C40000030Ad0
/scsi_vhci/ssd@g60060e800429c400000029c40000030a
Specify disk (enter its number):

In most cases the new disk is already preformatted as indicated in the example below, c3t60060E800429C400000029C40000030Ad0
[disk formatted].
If the disk was not formatted you will not see [disk formatted]. Make a note of the disk name c3t60060E800429C400000029C40000030Ad0, you will need this for later steps.

Specify disk (enter its number): 2
selecting c3t60060E800429C400000029C40000030Ad0
[disk formatted]

FORMAT MENU:
disk – select a disk
type – select (define) a disk type
partition – select (define) a partition table
current – describe the current disk
format – format and analyze the disk
repair – repair a defective sector
label – write label to the disk
analyze – surface analysis
defect – defect list management
backup – search for backup labels
verify – read and display labels
inquiry – show vendor, product and revision
volname – set 8-character volume name
! – execute , then return
quit

Create a new ZFS pool zone with zpool command.

root@myserver1 # zpool create -f bigzone c3t60060E800429C400000029C40000030Ad0

List the new ZFS pool zone you just created.

root@myserver1 # zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
bigzone 348G 95.5K 348G 0% ONLINE –

Create the new zone with the zfs create command. The new zone is called myzfs.

root@myserver1 # zfs create bigzone/myzfs

Verify that the zfs zone was created. By default the new pool will utilize all avaiable disk space.

root@myserver1 # zfs list
NAME USED AVAIL REFER MOUNTPOINT
bigzone 134K 343G 18K /bigzone
bigzone/myzfs 18K 343G 18K /bigzone/myzfs

You can limit the amount of disk space the new zones uses as in the example below.

root@myserver1 # zfs set quota=300g bigzone/myzfs

Confirm that the quota took effect.

root@myserver1 # zfs list
NAME USED AVAIL REFER MOUNTPOINT
bigzone 134K 343G 19K /bigzone
bigzone/myzfs 18K 300G 18K /bigzone/myzfs

The ZFS zones are automatically mounted in Solaris 10. The mount command will display

root@myserver1 # mount | grep bigzone
/bigzone on bigzone read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=4010002
on Tue Dec 8 14:44:17 2009
/bigzone/myzfs on bigzone/myzfs read/write/setuid/devices/nonbmand/exec/xattr/
atime/dev=4010003 on Tue Dec 8 14:44:45 2009

The mount point property for ZFS filesystem must be configured to legacy in order to create a new zone (container).

root@myserver1 # zfs set mountpoint=legacy bigzone/myzfs

Verify that the mountpoint is set to legacy.

root@myserver1 # zfs list
NAME USED AVAIL REFER MOUNTPOINT
bigzone 144K 343G 19K /bigzone
bigzone/myzfs 18K 300G 18K legacy

Create a new zone (container) with the zonecfg command.
root@myserver1 # zonecfg -z myzfs
myzfs: No such zone configured
Use ‘create’ to begin configuring a new zone.
zonecfg:myzfs> create

Set the zone path, /bigzone/myzfs in this example.
zonecfg:myzfs> set zonepath=/bigzone/myzfs

If you want the virtual server to boot automatically, set autoboot to true.
zonecfg:myzfs> set autoboot=true

This is an optional step. Creat a file system.
zonecfg:myzfs> add fs

Set the mount point for the zone, /bigzone/myzfs
zonecfg:myzfs:fs> set dir=/bigzone/myzfs

Specify that /bigzone/myzfs in the global zone is to be mounted as bigzone/myzfs.
zonecfg:myzfs:fs> set special=bigzone/myzfs

Specify the file system type as zfs.
zonecfg:myzfs:fs> set type=zfs

End the file system specification.
zonecfg:myzfs:fs> end

Optionally you can specify a network card for this new zone. For example network card bge0 can be dedicated for the global zone and bge1 can be dedicated to the new zone myzfs. The NIc bge1 must be plumbed

in the global zone first with the command ‘ifconfig bge1 plumb up’.
zonecfg:myzfs> add net
zonecfg:myzfs:net> set physical=bge1
zonecfg:myzfs:net> set address=172.20.9.19/16
zonecfg:myzfs:net> end

Optionally you can specify the attributes for the new zone.
zonecfg:myzfs> add attr
zonecfg:myzfs:attr> set name=New Virtual Server
zonecfg:myzfs:attr> set type=string
zonecfg:myzfs:attr> set value=”myzfs”
zonecfg:myzfs:attr> end

Verify the zone configuration.
zonecfg:myzfs> verify

Commit the zone configuration with the commit command. Note, if you do not explicitly type commit at the prompt, a commit is automatically attempted when you exit or an EOF occurs.
zonecfg:myzfs> commit

To view the zone configuration type info at the zonecfg prompt.
zonecfg:myzfs> info
zonename: myzfs
zonepath: /bigzone/myzfs
brand: native
autoboot: true
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
fs:
dir: /bigzone/myzfs
special: bigzone/myzfs
raw not specified
type: zfs
options: []
net:
address: 172.20.9.19/16
physical: bge1
defrouter not specified
attr:
name: New Virtual Server
type: string
value: myzfs

Type exit
zonecfg:myzfs>exit

After you have configured the non-global zone verify that it is in configured status. This means that the zone can now be installed with the zoneadm command. Zoneadm is the primary tool used to install and administer non-global zones and can only be run form the global zone.

root@myserver1 # zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
– myzfs configured /bigzone/myzfs native shared

Install the configured zone myzfs using the zoneadm command with the -z install option. This will take a few minutes to complete.

root@myserver1 # zoneadm -z myzfs install
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <11495> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1923> packages on the zone.
Initialized <1923> packages on zone.
Zone is initialized.
The file contains a log of the zone installation.

Check the status of the new non-global zone myzfs, it should have changed to installed.

root@myserver1 # zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
– myzfs installed /bigzone/myzfs native shared

Now you are ready to boot the non-global zone up.

root@myserver1 # zoneadm -z myzfs boot

The status of the non-global zone will change to running after it has booted up successfully.

root@myserver1 # zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
1 myzfs running /bigzone/myzfs native shared

Logon to the console of myzfs using the zlogin command with the -C option. If you do not specify the -C otpion then you will not not see the Solaris 10 Os installation messages. The first time you logon to the console, the sysidtool program is automatically started and you will be prompted to configure the time zone and various other tasks.

root@myserver1 # zlogin -C myzfs
[Connected to zone ‘myzfs’ console]

(you may have to hit the enter key a few times to see the below screen)

Select a Language

0. English
1. French
2. German
3. Italian
4. Japanese
5. Korean
6. Simplified Chinese
7. Spanish
8. Swedish
9. Traditional Chinese

Please make a choice (0 – 9), or press h or ? for help: 0

Select a Locale

0. English (C – 7-bit ASCII)
1. Albania (ISO8859-2)
2. Albania (UTF-8)
3. Australia (ISO8859-1)
4. Belgium-Flemish (ISO8859-1)
5. Belgium-Flemish (ISO8859-15 – Euro)
6. Belgium-Flemish (UTF-8)
7. Bokmal, Norway (UTF-8)
8. Bosnia (ISO8859-2)
9. Bosnia and Herzegovina (UTF-8)
10. Brazil (ISO8859-1)
11. Brazil (UTF-8)
12. Bulgaria (ISO8859-5)
13. Bulgaria (UTF-8)
14. Canada (English) (UTF-8)
15. Canada-English (ISO8859-1)
16. Catalan, Spain (ISO8859-1)
17. Catalan, Spain (ISO8859-15 – Euro)
18. Croatia (ISO8859-2)

Press Return to show more choices.
Please make a choice (0 – 93), 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: 6

Host Name

Enter the host name which identifies this system on the network. The name
must be unique within your domain; creating a duplicate host name will cause
problems on the network after you install Solaris.

A host name must have at least one character; it can contain letters,
digits, and minus signs (-).

Host name myserver

F2_Continue F6_Help

On this screen you must specify your default time zone. You can specify a
time zone in three ways: select one of the continents or oceans from the
list, select other – offset from GMT, or other – specify time zone file.

> To make a selection, use the arrow keys to highlight the option and
press Return to mark it [X].

Continents and Oceans
———————————-
– [ ] Africa
| [X] Americas
| [ ] Antarctica
| [ ] Arctic Ocean
| [ ] Asia
| [ ] Atlantic Ocean
| [ ] Australia
| [ ] Europe
| [ ] Indian Ocean
v [ ] Pacific Ocean

F2_Continue F6_Help

Continue to follow menu prompts to complete the Solaris 10 Os configuration.

System identification is completed.

rebooting system due to change(s) in /etc/default/init

[NOTICE: Zone rebooting]

SunOS Release 5.10 Version Generic_141414-07 64-bit
Copyright 1983-2009 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Hostname: myserver
Reading ZFS config: done.

If you see the below message, it means that the DNS entry for myserver does not exists. Simply add the A name record for myserver to the DNS server.

myserver console login: Dec 8 15:18:24 myserver sendmail[5543]: My unqualified
host name (localhost) unknown; sleeping for retry

5 comments for “Step by step instructions on how to create a Solaris 10 container.

Comments are closed.