How to add a zone in Solaris
With the introduction of the new Solaris OS 9/10 a hot new feature was the Virtualization. And the Solaris virtualization use a concept called zones. In this post I'm about to describe how to configure a zone in Solaris OS. In order to configure, it is needed to be installed Solaris OS on the server so called Global zone.
creating a zone
* gather = zonename and zonepath
* dedicate cpu resource or capped cpu resource
1.) To create the role and assign the role to a user "solaris Management tools
with RBAC" in Basic administration guide
2.) Setup a zone configuration with a zone name (eg: my-zone)
#zonecfg -z my-zone
will get an error if the first time and ask to create.
3.) create new zone configuration
zonecfg:my-zone> create
4.) set the zone path, /export/home/my-zone
zonecfg:my-zone> set zonepath=/export/home/my-zone
5.) set the autoboot value( set true to autoboot the zone) make sure
svc:/system/zones:default is enabled
zonecfg:my-zone> set autoboot=true
6.) Set persistent boot argument for a zone
zonecfg:my-zone> set bootargs="-m verbose"
7.) Dedicated one CPU to this zone
zonecfg:my-zone> add dedicated-cpu
a. Set the number of CPUs.
zonecfg:my-zone:dedicated-cpu> set ncpus=1-2
b. (Optional) Set the importance.
zonecfg:my-zone:dedicated-cpu> set importance=10
The default is 1
c. End the cpecification
zonecfg:my-zone:dedicated-cpu> end
8.) Revised the default set of privileges
zonecfg:my-zone> set limitpriv="default,sys_time"
This line adds the ability to set the system clock to the default set of privileges.
9.) Set the scheduling class to FSS.
zonecfg:my-zone> set scheduling-class=FSS
10.) Add a memory cap.
zonecfg:my-zone> add capped-memory
a. Set the memory cap.
zonecfg:my-zone:capped-memory> set physical=50m
b. Set the swap memory cap.
zonecfg:my-zone:capped-memory> set swap=100m
c. Set the locked memory cap.
zonecfg:my-zone:capped-memory> set locked=30m
d. End the memory cap specification.
zonecfg:my-zone:capped-memory> end
11.) Add a file system.
zonecfg:my-zone> add fs
a. Set the mount point for the file system,/usr/local in this procedure.
zonecfg:my-zone:fs> set dir=/usr/local
b. Specify that/opt/zones/my-zone/local in the global zone is to be mounted as /usr/local
in the zone being configured.
zonecfg:my-zone:fs> set special=/opt/zones/my-zone/local
In the non-global zone, the/usr/local file system will be readable and writable.
c. Specify the file system type,lofs in this procedure.
zonecfg:my-zone:fs> set type=lofs
The type indicates how the kernel interacts with the file system.
d. End the file system specification.
zonecfg:my-zone:fs> end
12.) This step can be performed more than once to add more than one file system.
(Optional) Set the hostid.
zonecfg:my-zone> set hostid=80f0c086
13.) Add a ZFS dataset named sales in the storage pool tank.
zonecfg:my-zone> add dataset
a. Specify the path to the ZFS data set sales.
zonecfg:my-zone> set name=tank/sales
b. End the data set specification.
zonecfg:my-zone> end
creating a zone
* gather = zonename and zonepath
* dedicate cpu resource or capped cpu resource
1.) To create the role and assign the role to a user "solaris Management tools
with RBAC" in Basic administration guide
2.) Setup a zone configuration with a zone name (eg: my-zone)
#zonecfg -z my-zone
will get an error if the first time and ask to create.
3.) create new zone configuration
zonecfg:my-zone> create
4.) set the zone path, /export/home/my-zone
zonecfg:my-zone> set zonepath=/export/home/my-zone
5.) set the autoboot value( set true to autoboot the zone) make sure
svc:/system/zones:default is enabled
zonecfg:my-zone> set autoboot=true
6.) Set persistent boot argument for a zone
zonecfg:my-zone> set bootargs="-m verbose"
7.) Dedicated one CPU to this zone
zonecfg:my-zone> add dedicated-cpu
a. Set the number of CPUs.
zonecfg:my-zone:dedicated-cpu> set ncpus=1-2
b. (Optional) Set the importance.
zonecfg:my-zone:dedicated-cpu> set importance=10
The default is 1
c. End the cpecification
zonecfg:my-zone:dedicated-cpu> end
8.) Revised the default set of privileges
zonecfg:my-zone> set limitpriv="default,sys_time"
This line adds the ability to set the system clock to the default set of privileges.
9.) Set the scheduling class to FSS.
zonecfg:my-zone> set scheduling-class=FSS
10.) Add a memory cap.
zonecfg:my-zone> add capped-memory
a. Set the memory cap.
zonecfg:my-zone:capped-memory> set physical=50m
b. Set the swap memory cap.
zonecfg:my-zone:capped-memory> set swap=100m
c. Set the locked memory cap.
zonecfg:my-zone:capped-memory> set locked=30m
d. End the memory cap specification.
zonecfg:my-zone:capped-memory> end
11.) Add a file system.
zonecfg:my-zone> add fs
a. Set the mount point for the file system,/usr/local in this procedure.
zonecfg:my-zone:fs> set dir=/usr/local
b. Specify that/opt/zones/my-zone/local in the global zone is to be mounted as /usr/local
in the zone being configured.
zonecfg:my-zone:fs> set special=/opt/zones/my-zone/local
In the non-global zone, the/usr/local file system will be readable and writable.
c. Specify the file system type,lofs in this procedure.
zonecfg:my-zone:fs> set type=lofs
The type indicates how the kernel interacts with the file system.
d. End the file system specification.
zonecfg:my-zone:fs> end
12.) This step can be performed more than once to add more than one file system.
(Optional) Set the hostid.
zonecfg:my-zone> set hostid=80f0c086
13.) Add a ZFS dataset named sales in the storage pool tank.
zonecfg:my-zone> add dataset
a. Specify the path to the ZFS data set sales.
zonecfg:my-zone> set name=tank/sales
b. End the data set specification.
zonecfg:my-zone> end
Comments
Post a Comment
Leave a message