Professional Documents
Culture Documents
Home | About
https://www.techsupportpk.com/2012/12/oracle-solaris-10-zones-step-by-step.html 1/13
1/13/24, 1:26 AM Oracle Solaris 10 Zones Step-by-Step Guide - TechSupport
Home / Zone / Oracle Solaris 10 Zones Step-by-Step Guide
DONATE
YouTube 470
POPULAR POSTS
lets make it very simple, a zone is a virtual operating system environment created within a single
instance of the Solaris operating system. Efficient resource utilization is the main goal of this
technology.
As of now, the upper limit for the number of zones that can be created/run on a system is 8192; of
course, depending on the resource availability, a single system may or may not run all the
configured zones effectively.
Global Zone
When we install Solaris 10, a global zone gets installed automatically; and the core operating
system runs under global zone. To list all the configured zones, we can use zoneadm command:
# zoneadm list -v
ID NAME STATUS PATH
0 global running /
Prerequisites:
Plenty of disk space to hold the newly installed zone. It needs at least 2G space to
copy the essential files to the local zone, and of course the disk space needed by the
application(s) you are planning to run, in this zone; and
A dedicated IP for network connectivity
https://www.techsupportpk.com/2012/12/oracle-solaris-10-zones-step-by-step.html 2/13
1/13/24, 1:26 AM Oracle Solaris 10 Zones Step-by-Step Guide - TechSupport
% df -h /
Filesystem size used avail capacity Mounted on
/dev/dsk/c1t1d0s0 29G 22G 7.1G 76% /
% ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
eri0: flags=1000843 mtu 1500 index 2
inet 192.168.74.217 netmask fffffe00 broadcast 192.168.75.255
2. Since there is more than 5G free space, I've decided to install a local zone under /zones.
% mkdir /zones
3. Next step is to define/create the zone root. This is the path to zone's root directory that is
relative to the global zone's root directory. Zone root must be owned by root user with the
mode 700. This will be used in setting the zonepath property, during the zone creation
process
% cd /zones
% mkdir appserver
% chmod 700 appserver
% ls -l
total 2
drwx------ 2 root root 512 Feb 17 12:46 appserver
4. Create & configure a new 'sparse root' local zone, with root privileges
% zonecfg -z appserv
appserv: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:appserv> create
zonecfg:appserv> set zonepath=/zones/appserver
zonecfg:appserv> set autoboot=true
zonecfg:appserv> add net
zonecfg:appserv:net> set physical=eri0
zonecfg:appserv:net> set address=192.168.175.126
zonecfg:appserv:net> end
zonecfg:appserv> add fs
zonecfg:appserv:fs> set dir=/repo2
zonecfg:appserv:fs> set special=/dev/dsk/c2t40d1s6
zonecfg:appserv:fs> set raw=/dev/rdsk/c2t40d1s6
zonecfg:appserv:fs> set type=ufs
zonecfg:appserv:fs> set options noforcedirectio
zonecfg:appserv:fs> end
zonecfg:appserv> add inherit-pkg-dir
zonecfg:appserv:inherit-pkg-dir> set dir=/opt/csw
zonecfg:appserv:inherit-pkg-dir> end
zonecfg:appserv> info
zonepath: /zones/appserver
autoboot: true
pool:
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
inherit-pkg-dir:
dir: /opt/csw
https://www.techsupportpk.com/2012/12/oracle-solaris-10-zones-step-by-step.html 3/13
1/13/24, 1:26 AM Oracle Solaris 10 Zones Step-by-Step Guide - TechSupport
net:
address: 192.168.175.126
physical: eri0
zonecfg:appserv> verify
zonecfg:appserv> commit
zonecfg:appserv> exit
In a Sparse Root Zone, the directories /usr, /sbin, /lib and /platform will be mounted as
loopback file systems. That is, although all those directories appear as normal directories
under the sparse root zone, they will be mounted as read-only file systems. Any change to
those directories in the global zone can be seen from the sparse root zone.
However if you need the ability to write into any of those directories listed above, you may
need to configure a Whole Root Zone. For example, softwares like ClearCase need write
permissions to /usr directory. In that case configuring a Whole Root Zone is the way to go.
The steps for creating and configuring a new 'Whole Root' local zone are as follows:
% zonecfg -z appserv
appserv: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:appserv> create
zonecfg:appserv> set zonepath=/zones/appserver
zonecfg:appserv> set autoboot=true
zonecfg:appserv> add net
zonecfg:appserv:net> set physical=eri0
zonecfg:appserv:net> set address=192.168.175.126
zonecfg:appserv:net> end
zonecfg:appserv> add inherit-pkg-dir
zonecfg:appserv:inherit-pkg-dir> set dir=/opt/csw
zonecfg:appserv:inherit-pkg-dir> end
zonecfg:appserv> remove inherit-pkg-dir dir=/usr
zonecfg:appserv> remove inherit-pkg-dir dir=/sbin
zonecfg:appserv> remove inherit-pkg-dir dir=/lib
zonecfg:appserv> remove inherit-pkg-dir dir=/platform
zonecfg:appserv> info
zonepath: /zones/appserver
autoboot: true
pool:
inherit-pkg-dir:
dir: /opt/csw
net:
address: 192.168.175.126
physical: eri0
zonecfg:appserv> verify
zonecfg:appserv> commit
zonecfg:appserv> exit
https://www.techsupportpk.com/2012/12/oracle-solaris-10-zones-step-by-step.html 4/13
1/13/24, 1:26 AM Oracle Solaris 10 Zones Step-by-Step Guide - TechSupport
Grant access to the block (/dev/dsk/c2t40d1s6) and raw (/dev/rdsk/c2t40d1s6) devices so
the file system can be mounted in the non-global zone. Make sure the block device is not
mounted anywhere right before installing the non-global zone. Otherwise, the zone
installation may fail with ERROR: file system check
of failed: exit status <33>: run fsck manually. In that case, unmount the file system that is being
exported, uninstall the partially installed zone (zoneadm -z uninstall) then install the zone from
the scratch (no need to re-configure the zone, just do a re-install). \* set type=ufs
The file system is of type UFS \* set options noforcedirectio
Mount the file system with the option noforcedirectio[/Added 08/25/08]
\* dir=/opt/csw
read-only path, will be lofs'd (loop back mounted) from global zone. Note: it works for sparse root
zone only -- whole root zone cannot have any shared file systems
zonecfg commands verify and commit, verifies and commits the zone configuration for the zone,
respectively. Note that it is not necessary to commit the zone configuration; it will be done
automatically when we exit from zonecfg tool. info displays information about the current
configuration
Next step is to install the configured zone. It takes a while to install the necessary packages
% ls -ld /zones
drwxrwxr-x 3 root root 512 Feb 17 12:46 /zones
Since /zones must not be group writable, let's change the mode to 700.
% ls -ld /zones
drwx------ 3 root root 512 Feb 17 12:46 /zones
Boot up the appserv zone. Let's note down the ifconfig output to see how it changes after the
local zone boots up. Also observe that there is no answer from the server yet, since it is not up
https://www.techsupportpk.com/2012/12/oracle-solaris-10-zones-step-by-step.html 5/13
1/13/24, 1:26 AM Oracle Solaris 10 Zones Step-by-Step Guide - TechSupport
% ping 192.168.175.126
no answer from 192.168.175.126
% ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
eri0: flags=1000843 mtu 1500 index 2
inet 192.168.74.217 netmask fffffe00 broadcast 192.168.75.255
ether 0:3:ba:2d:0:84
% ping 192.168.175.126
192.168.175.126 is alive
% ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
lo0:1: flags=2001000849 mtu 8232 index 1
zone appserv
inet 127.0.0.1 netmask ff000000
eri0: flags=1000843 mtu 1500 index 2
inet 192.168.74.217 netmask fffffe00 broadcast 192.168.75.255
ether 0:3:ba:2d:0:84
eri0:1: flags=1000843 mtu 1500 index 2
zone appserv
inet 192.168.175.126 netmask ffff0000 broadcast 192.168.255.255
Observe that the zone appserv has it's own virtual instance of lo0, the system's loopback
interface and the zone's IP address is also being served by the eri0 network interface
Login to the Zone {console} and performing the internal zone configuration. zlogin utility can
be used to enter a zone. The first time we log in to the console, we get a chance to answer a
series of questions for the desired zone configuraton. -C option of zlogin can be used to log in to
the Zone console.
% zlogin -C -e [ appserv
[Connected to zone 'appserv' console]
Select a Language
0. English
1. es
2. fr
Select a Locale
https://www.techsupportpk.com/2012/12/oracle-solaris-10-zones-step-by-step.html 6/13
1/13/24, 1:26 AM Oracle Solaris 10 Zones Step-by-Step Guide - TechSupport
...
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 (-).
...
...
That is all there is in the creation of a local zone. Now simply login to the newly created zone, just
like connecting to any other system in the network.
# zonecfg -z appserv
zonecfg:appserv> add device
zonecfg:appserv:device> set match=/dev/rdsk/c5t0d0s6
zonecfg:appserv:device> end
zonecfg:appserv> verify
zonecfg:appserv> commit
zonecfg:appserv> exit
# hostname
v440appserv
https://www.techsupportpk.com/2012/12/oracle-solaris-10-zones-step-by-step.html 7/13
1/13/24, 1:26 AM Oracle Solaris 10 Zones Step-by-Step Guide - TechSupport
# ls -l /dev/rdsk/c5t0d0s6
crw-r----- 1 root sys 118, 126 Aug 27 14:33 /dev/rdsk/c5t0d0s6
Now that the raw device is accessible within the non-global zone, we can use the regular Solaris
commands to create any file system like UFS.
eg.,
# newfs -v c5t0d0s6
newfs: construct a new file system /dev/rdsk/c5t0d0s6: (y/n)? y
mkfs -F ufs /dev/rdsk/c5t0d0s6 1140260864 -1 -1 8192 1024 251 1 120 8192 t 0 -1
Warning: 4096 sector(s) in last cylinder unallocated
/dev/rdsk/c5t0d0s6: 1140260864 sectors in 185590 cylinders of 48 tracks, 128 sec
556768.0MB in 11600 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
Initializing cylinder groups:
...............................................................................
...............................................................................
.........................................................................
super-block backups for last 10 cylinder groups at:
1139344160, 1139442592, 1139541024, 1139639456, 1139737888, 1139836320,
1139934752, 1140033184, 1140131616, 1140230048
# zonecfg -z appserv
zonecfg:appserv> add device
zonecfg:appserv:device> set match=/dev/dsk/c5t0d0s6
zonecfg:appserv:device> end
zonecfg:appserv> verify
zonecfg:appserv> commit
zonecfg:appserv> exit
# hostname
v440appserv
# ls -l /dev/dsk/c5t0d0s6
brw-r----- 1 root sys 118, 126 Aug 27 14:40 /dev/dsk/c5t0d0s6
# fstyp /dev/dsk/c5t0d0s6
ufs
# df -h /mnt
Filesystem size used avail capacity Mounted on
/dev/dsk/c5t0d0s6 535G 64M 530G 1% /mnt
Mounting a file system from the global zone into the non-global zone
Sometimes it is desirable to have the flexibility of mounting a file system in the global zone or
non-global zone on-demand. In such situations, rather than exporting the file systems or block
devices into the non-global zone, create the file system in the global zone and mount the file
system directly from the global zone into the non-global zone. Make sure to unmount that file
https://www.techsupportpk.com/2012/12/oracle-solaris-10-zones-step-by-step.html 8/13
1/13/24, 1:26 AM Oracle Solaris 10 Zones Step-by-Step Guide - TechSupport
system in the global zone if mounted, before attempting to mount it in the non-global zone.
eg., In the non-global zone:
# mkdir /repo1
# df -h /repo1
/dev/dsk/c2t40d0s6 134G 64M 133G 1% /repo1
# umount /repo1
# ls -ld /zones/appserv/root/repo1
drwxr-xr-x 2 root root 512 Aug 27 14:45 /zones/appserv/root/repo1
Now go back to the non-global zone and check the mounted file systems.
# hostname
v440appserv
# df -h /repo1
Filesystem size used avail capacity Mounted on
/repo1 134G 64M 133G 1% /repo1
To unmount the file system from the non-global zone, run the following command from the
global zone.
# umount /zones/appserv/root/repo1
# zonecfg -z appserv
zonecfg:appserv> remove fs dir=/repo2
zonecfg:appserv> verify
zonecfg:appserv> commit
zonecfg:appserv> exit
Just for the sake of completeness, the following steps show how to remove a local zone.
Steps to delete a Local Zone
https://www.techsupportpk.com/2012/12/oracle-solaris-10-zones-step-by-step.html 9/13
1/13/24, 1:26 AM Oracle Solaris 10 Zones Step-by-Step Guide - TechSupport
2. Uninstall the local zone -- remove the root file system
2. Change the configuration of the new zone that differ from the existing one -- for example,
IP address, data set names, network interface etc. To make these changes, edit
/tmp/siebeldb.config.cfg
3. Create the zone root directory for the new zone being created
# mkdir /zones3/oraclebi
# chmod 700 /zones3/oraclebi
# ls -ld /zones3/oraclebi
drwx------ 2 root root 512 Mar 12 15:41 /zones3/oraclebi
4. Create a new (empty, non-configured) zone in the usual manner with the edited
configuration file as an input
https://www.techsupportpk.com/2012/12/oracle-solaris-10-zones-step-by-step.html 10/13
1/13/24, 1:26 AM Oracle Solaris 10 Zones Step-by-Step Guide - TechSupport
This step takes at least 5 minutes to clone the whole zone. Larger zones may take longer to
complete the cloning process.
7. Boot the newly created zone
# zlogin -C oraclebi
3. Move the zonepath for the zone to be migrated from the old host to the new host. Do the
following on the old host:
# cd /zones3
# tar -Ecf orabi.tar orabi
# compress orabi.tar
# sftp newhost
Connecting to newhost...
sftp> cd /zones3
sftp> put orabi.tar.Z
Uploading orabi.tar.Z to /zones3/orabi.tar.Z
sftp> quit
On the newhost:
# cd /zones3
# uncompress orabi.tar.Z
# tar xf orabi.tar
4. On the new host, configure the zone. Create the equivalent zone orabi on the new host --
use the zonecfg command with the -a option and the zonepath on the new host. Make any
required adjustments to the configuration and commit the configuration.
# zonecfg -z orabi
orabi: No such zone configured
https://www.techsupportpk.com/2012/12/oracle-solaris-10-zones-step-by-step.html 11/13
1/13/24, 1:26 AM Oracle Solaris 10 Zones Step-by-Step Guide - TechSupport
Use 'create' to begin configuring a new zone.
zonecfg:orabi> create -a /zones3/orabi
zonecfg:orabi> info
zonename: orabi
zonepath: /zones3/orabi
brand: native
autoboot: false
bootargs:
pool:
limitpriv: all,!sys_suser_compat,!sys_res_config,!sys_net_config,!sys_linkdi
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
net:
address: IPaddress
physical: nxge1
defrouter not specified
zonecfg:orabi> set capped-memory
zonecfg:orabi:capped-memory> set physical=8G
zonecfg:orabi:capped-memory> end
zonecfg:orabi> commit
zonecfg:orabi> exit
5. Attach the zone on the new host with a validation check and update the zone to match a
host running later versions of the dependent packages
# ls -ld /zones3
drwxrwxrwx 5 root root 512 Jul 15 12:30 /zones3
# chmod g-w,o-w /zones3
# ls -ld /zones3
drwxr-xr-x 5 root root 512 Jul 15 12:30 /zones3
Note:
It is possible to force the attach operation without performing the validation. You can do so
with the help of -F option
Be careful when using this option because it could lead to an incorrect configuration; and
an incorrect configuration could result in undefined behavior
https://www.techsupportpk.com/2012/12/oracle-solaris-10-zones-step-by-step.html 12/13
1/13/24, 1:26 AM Oracle Solaris 10 Zones Step-by-Step Guide - TechSupport
Tip: How to find out whether connected to the primary OS instance or the virtual instance?
If the command zonename returns global, then you are connected to the OS instance that was
booted from the physical hardware. If you see any string other than global, you might have
connected to the virtual OS instance.
Alternatively try running prstat -Z or zoneadm list -cv commands. If you see exactly one non-
zero Zone ID, it is an indication that you are connected to a non-global zone.
PREVIOUS NEXT
How to install RHEL 6 on IBM Power Blades Step-by-Step Guide of Oracle Solaris 11 Zones
p601/701 through kickstart:
No Comments:
Enter Comment
Set Up a Highly Available Database VMware VSphere IOS Set Up a Highly Available
PostgreSQL Cluster using Docker PostgreSQL Cluster using Docker
on Ubuntu 20.04 Active Directory Solaris PostgreSQL on Ubuntu 20.04
How To Set Up SSO in Apache Open Stack Patroni LDAP How To Set Up SSO in Apache
using Mellon and Azure AD on using Mellon and Azure AD on
CentOS8 PowerVM Solaris 10 OTRS CentOS8
NAS OpenLDAP
https://www.techsupportpk.com/2012/12/oracle-solaris-10-zones-step-by-step.html 13/13