http://thegeekdiary.com/how-to-create-and-configure-solaris-10-zones/

Solaris zones enables a software partitioning of solaris 10 OS to support multiple independent, secure OS environments to run in the same OS. Each environment has separate process space, resource allocation and users. Zones is widely used in production environments as it is easy to setup and doesn’t require any special hardware like ldoms does.

Zone types

Global zone – every installed OS acts like a global zone, which is present by default. All non-global zones can only be intalled, configured and administered from global zone.
Non-global zone – They share the functioning of the kernel booted under the global zone. All the software and other resources are inherited from the global zone.
Whole Root zone (Big zone) – It gets their own writable copy of all the file systems like /opt, /usr. It takes more disk space.
Sparse root zone (Small zone) – File systems like /opt, /usr are shared from global zone as loopback file-system (you only have a read-only access to these directories in non-global zone). It takes very less disk space.
Branded zones – These are solaris 8 or solaris 9 zones on the solaris 10 global zones.

Configuring a zone with minimal settings

Let us create a new zone with a minimal resources and settings required to get it up and running. We’ll see how to add other resources like cpu, memory, file system etc later in this post.We would be creating a sparse root zone in this case. To create a whole root zone we just have to use create -b instead of just create in the configuration prompt.

global# mkdir -p /zones/zone01
global# chmod 700 /zones/zone01
global# zonecfg -z zone01
zone01: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone01> create
zonecfg:zone01> set zonepath=/zones/zone01
zonecfg:zone01> set autoboot=true
zonecfg:zone01> verify
zonecfg:zone01> commit
zonecfg:zone01> exit
Install and boot the zone

Now install the zone and boot it. Upon booting we can login into the console of the zoen to configure it.

global# zoneadm -z zone01 verify
global# zoneadm -z my-zone install
global# zoneadm -z my-zone list -ivc
ID NAME STATUS PATH BRAND IP
0 global running / native shared
- zone01 installed /zones/zone01 native shared
global# zoneadm -z my-zone boot
global# zoneadm list -v
ID NAME STATUS PATH BRAND IP
0 global running / native shared
1 my-zone running /zones/zone01 native shared
global# zlogin -C zone01
global # zlogin zone01

-C here connects you to the console of the zone. This has to be done only once to get the zone configured with hostname, timezone and other basic settings.

Resource configuration examples

Below are some most commonly used examples of resource configuration in a zone.

CPU

1. Dedicated CPU

To see the CPU information in the global zone you can use

global# psrinfo -v
global# psrinfo -vp

After you have confirmed the CPUs you want to use, you can add a fixed no of CPUs to the zone.

zonecfg:zone01> add dedicated-cpu
zonecfg:zone01:dedicated-cpu> set ncpus=1-2
zonecfg:zone01:dedicated-cpu> set importance=10 (optional, default is 1)
zonecfg:zone01:dedicated-cpu> end

Memory

Capped Memory

zonecfg:my-zone> add capped-memory
zonecfg:zone01:capped-memory> set physical=50m [max memory that can be used by this zone]
zonecfg:zone01:capped-memory> set swap=100m
zonecfg:zone01:capped-memory> set locked=30m [memory locked for use by this zone]
zonecfg:zone01:capped-memory> end

File system

a. Loopback FS

zonecfg:zone01> add fs
zonecfg:zone01:fs> set dir=/usr/local
zonecfg:zone01:fs> set special=/opt/zones/my-zone/local
zonecfg:zone01:fs> set type=lofs
zonecfg:zone01:fs> end

here /usr/local will be readable and writable in non-global zone

b. Normal file system

zonecfg:zone01> add fs
zonecfg:zone01:fs> set dir=/data01
zonecfg:my-zone01:fs> set special=/dev/dsk/c1t1d0s0
zonecfg:my-zone01:fs> set raw=/dev/rdsk/c1t1d0s0
zonecfg:my-zone01:fs> add options [logging, nosuid] (optional)
zonecfg:my-zone01:fs> end

ZFS dataset

When we delegate a dataset to a non-global zone we can do any operation on that dataset inside of the zone without requiring global zone to configure it all the time.

zonecfg:zone01> add dataset
zonecfg:zone01> set name=tank/sales
zonecfg:zone01> end

Inherit package (sparse root zone only)

Now in case of sparse root zone we can inherit some of the packages from the global zone.

zonecfg:my-zone> add inherit-pkg-dir
zonecfg:my-zone:inherit-pkg-dir> set dir=/opt/sfw
zonecfg:my-zone:inherit-pkg-dir> end

NOTE: These resources can not be modified once the zone is installed

IP

We can either give an exclusive IP using a dedicated interface to a non-global zone or use an existing interface in the global zone to share it with the non-global zone. When we configure an exclusive IP we have to configure IP address inside of the non-global zone and not during the configuration.

a. Exclusive IP

zonecfg:my-zone> set ip-type=exclusive
zonecfg:zone01> add net
zonecfg:zone01:net> set physical=hme0

NOTE: No need to specify IP here you can control everything from inside of the non-global zone

b. Shared IP

In this case zone uses a shared interface which is already plumbed and being used in the global zone.

zonecfg:zone01> add net
zonecfg:zone01:net> set address=192.168.1.2
zonecfg:zone01:net> set physical=hme0
zonecfg:zone01:net> set defrouter=10.0.0.1 [optional]
zonecfg:zone01:net> end

Device

We can also directly assign a physical device like disk to a non-global disk.

zonecfg:zone01> add device
zonecfg:zone01:device> set match=/dev/rdsk/c0t1d0
zonecfg:zone01:device> end

Comments

In case you want to add some comments like function of the non-global zone or anything else for that matter.

zonecfg:zone01> add attr
zonecfg:zone01:attr> set name=comment
zonecfg:zone01:attr> set type=string
zonecfg:zone01:attr> set value="Hello World. This is my zone"
zonecfg:zone01:attr> end

Other

Other settings like scheduling class of the CPU in the non-global zone can also be configured from the global zone.

zonecfg:zone01> set limitpriv="default,sys_time"
zonecfg:zone01> set scheduling-class=FSS
Other administrative commands
To reboot a zone :                 # zoneadm -z  reboot
To halt a zone : # zoneadm -z zone halt
To uninstalling a zone : # zoneadm -z zone uninstall -F
To delete an uninstalled zone : # zoneadm -z zone delete -F
Get all configuration info : # zonecfg -z zone info
login into a zone in safe mode : # zlogin -S zone
prstat on all zones : # prstat -Z
prstat on a single zone : # prstat -z zone

如何创建和配置Solaris10 zones (ZT)的更多相关文章

  1. Servlet过滤器,Servlet过滤器创建和配置

    第一:Servlet的过滤器的创建和配置,创建一个过滤器对象需要实现javax.servlet.Filter接口,同时实现Filter的3个方法.        第一方法是过滤器中的init()方法用 ...

  2. IIS负载均衡-Application Request Route详解第二篇:创建与配置Server Farm(转载)

    IIS负载均衡-Application Request Route详解第二篇:创建与配置Server Farm 自从本系列发布之后,收到了很多的朋友的回复!非常感谢,同时很多朋友问到了一些问题,有些问 ...

  3. Acitivity创建与配置

    •Activity的创建和配置 –Activity提供了和用户交互的可视化界面.创建一个Activity一般是继承Activity(当然也可以继承ListActivity.MapActivity等), ...

  4. 什么是Servlet,Servlet的作用,生命周期,如何创建、配置Servlet

    什么是Servlet,作用是? servlet是一个基于java技术的WEB组件,运行在服务器端,我们利用 sevlet可以很轻松的扩展WEB服务器的功能,使它满足特定的应用需要.servlet由se ...

  5. ios中pch文件的创建与配置

     PCH文件(Precompile Prefix Header File),也就是预编译头文件,其作用就是,方便你一次性导入在多个文件中同时用到的头文件.宏或者URL地址等(全局使用),可以有效的帮你 ...

  6. IDEA如何创建及配置Web项目(多图)

    正文之前 在学习Java Web时,第一个遇到的问题就是如何创建或配置Web项目了,今天,就用IntelliJ IDEA 来进行Web项目配置: 创建Web项目 配置web项目 正文 创建Web项目 ...

  7. Spring Boot 多模块项目创建与配置 (一) (转)

    Spring Boot 多模块项目创建与配置 (一) 最近在负责的是一个比较复杂项目,模块很多,代码中的二级模块就有9个,部分二级模块下面还分了多个模块.代码中的多模块是用maven管理的,每个模块都 ...

  8. Spring Boot 多模块项目创建与配置 (一)

    最近在负责的是一个比较复杂项目,模块很多,代码中的二级模块就有9个,部分二级模块下面还分了多个模块.代码中的多模块是用maven管理的,每个模块都使用spring boot框架.之前有零零散散学过一些 ...

  9. hyper-v 用户无法再 创建外部配置存储 0x80070005

    windows server 2008R2 刚安装的hyper-v 重启过. 修改配置文件到d:\Hyper-V目录下, hyper-V 创建 服务器遇到错误 操作失败 创建外部配置存储:一般性拒绝访 ...

随机推荐

  1. Spark常用算子-KeyValue数据类型的算子

    package com.test; import java.util.ArrayList; import java.util.List; import java.util.Map; import or ...

  2. hadoop hdfs java api操作

    package com.duking.util; import java.io.IOException; import java.util.Date; import org.apache.hadoop ...

  3. Android 6.0运行时权限第三方库的使用-----RxPermissions

    运行时权限的讲解在前一篇博客已经算是说的比较清楚了,这里就不说了,如果对6.0这个新特性不是很了解的朋友建议先看看(地址:http://blog.csdn.net/qq_33923079/articl ...

  4. AppStore审核2.1被拒大礼包过审经历

    本团队的iOS端迭代至今,经历过AppStore审核的数次调整,包括审核时长.严厉程度等,尝过各种花式的拒绝理由,但从没有像2018年初这次来得猛烈和漫长.从首次提交到最后过审几乎花费一个月的时间,下 ...

  5. iOS耗电量测试方法及其数据收集

    常用的电量测试方法: 硬件测试(硬件要求比较高,成本比较大,这里介绍软件测试方法) 软件工具检测 几个典型的耗电场景如下: 定位,尤其是调用GPS定位 网络传输,尤其是非Wifi环境 cpu频率 内存 ...

  6. 利用ChromeOptions()加载用户配置

    一. 如何绕过页面登录 我们在登录网站的时候,通常需要输入用户名.密码和验证码,那么有没有办法绕过登录环节呢? 有两种方法可以解决这个问题,一种是利用chrome浏览器的用户配置,一种是利用cooki ...

  7. C#面向对象(二):封装和继承

    前文链接:C#面向对象(一):明确几个简单的概念作为开胃菜 面向对象开发有三大特性(特点 / 特征) : 封装, 继承, 多态.我们今天主要讨论封装和继承,多态会在下篇中讨论. 一.封装: 所谓封装, ...

  8. LeetCode Beautiful Arrangement II

    原题链接在这里:https://leetcode.com/problems/beautiful-arrangement-ii/description/ 题目: Given two integers n ...

  9. linux下ioctl遇到的坑

    在驱动编程里面经常会用到ioctl的系统调用,发现cmd = 2的时候,用户ioctl直接返回-1. 原因在于在linux-x.xx/fs/ioctl.c定义的do_vfs_ioctl函数 int d ...

  10. 下载安装tomcat至服务器

    1.安装JDK之后,下载Tomcat:http://tomcat.apache.org/download-70.cgi选择下载32-bit/64-bit Windows Service Install ...