<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Solaris 10: tips and tricks for system administration - Zones</title>
    <link>http://solaris.reys.net/english</link>
    <description>How to use DTrace, ZFS, Solaris Zones and other technologies in Solaris</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.1-alpha7 - http://www.s9y.org/</generator>
    
    

<item>
    <title>Solaris 8 Migration Assistant (Project Etude)</title>
    <link>http://solaris.reys.net/english/2007/11/solaris-8-migration-assitant</link>
            <category>Zones</category>
    
    <comments>http://solaris.reys.net/english/2007/11/solaris-8-migration-assitant#comments</comments>
    <wfw:comment>http://solaris.reys.net/wfwcomment.php?cid=166</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://solaris.reys.net/rss.php?version=2.0&amp;type=comments&amp;cid=166</wfw:commentRss>
    

    <author>nospam@example.com (Gleb Reys)</author>
    <content:encoded>
    I&#039;ve finally completed my first successful experiment with &lt;b&gt;Solaris 8 Migration Assistant&lt;/b&gt; (&lt;b&gt;S8MA&lt;/b&gt;) today - a new product from Sun which allows you to run Solaris 8 branded zones. It&#039;s a fully and officially supported solution (for an extra price), but you can download the free 90-day trial to play with it and understand how really cool it is.&lt;br /&gt;
&lt;br /&gt;
First of all, just a few words about the niche for this product. Many companies are rather conservative about their Solaris upgrades. Most systems are still running Solaris 8, if not something older. Quite often this is also dictated by third-party software dependencies - products which were bought and configured for Solaris 8, which are now so tightly integrated that there isn&#039;t an easy way to migrated them into Solaris 10. Such systems are doomed for slow but very expensive death. Expensive, because with every year the hardware support for servers capable of running Solaris 8 raises again and again.&lt;br /&gt;
&lt;br /&gt;
That&#039;s where the Solaris 8 zones come in. It&#039;s very easy, really: you create a flar-copy fo your existing physical server under Solaris 8, then create a Solaris 8 zone, import your flar-archive and get a virtual copy of your Solaris 8 environment, with all your processes, programs and startup scripts. &lt;br /&gt;
&lt;br /&gt;
To make things easier, it&#039;s even possible to configure your &lt;b&gt;hostid&lt;/b&gt; in Solaris 8 zone to match the one of the physical Solaris 8 system, this way no programs running in the zone will even guess that they&#039;ve been virtualized. &lt;br /&gt;
&lt;br /&gt;
Who knows, maybe I&#039;ll tell you more about this technology some other day, but for now - just the simplest list of actions and commands for your S8MA proof of concept:&lt;br /&gt;
&lt;br /&gt;
1. Find and prepare a sparc box with Solaris 10u4. It is important to have the latest Solaris 10 update. Preparations are usually limited to applying a kernel patch, 127111-01 in my case. &lt;br /&gt;
&lt;br /&gt;
2. Download the Solaris 8 Migration Assitant (current version is 1.0) from this location: &lt;a href=http://www.sun.com/download/products.xml?id=470c4a45&gt;Solaris 8 Migration Assistant&lt;/a&gt;. The 3 packages in archive are dead easy to install using standard &lt;b&gt;pkgadd&lt;/b&gt;. &lt;br /&gt;
&lt;br /&gt;
Here are the packages you&#039;ll get:&lt;br /&gt;
&lt;div class=code&gt;&lt;br /&gt;
&lt;b&gt;SUNWs8brandr&lt;/b&gt;     Solaris 8 Migration Assistant: solaris8 brand support (Root)&lt;br /&gt;
&lt;b&gt;SUNWs8brandu&lt;/b&gt;     Solaris 8 Migration Assistant: solaris8 brand support (Usr)&lt;br /&gt;
&lt;b&gt;SUNWs8p2v&lt;/b&gt;       Solaris 8 p2v Tool&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
3. Make a flar-archive of your Solaris 8 system&lt;br /&gt;
&lt;br /&gt;
Log onto your Solaris 8 box, and run the command. In this and all the following examples, solaris8 is nothing but an arbitrary name I&#039;ve chosen for my zone. You might as well call it anything you like.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=code&gt;bash-3.00# &lt;b&gt;flarcreate -S -n solaris8 solaris8.flar&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
4. Create the basic Solaris 8 zone. &lt;br /&gt;
&lt;br /&gt;
Here&#039;s how you do it:&lt;br /&gt;
&lt;div class=code&gt;bash-3.00# &lt;b&gt;zonecfg -z solaris8&lt;/b&gt;&lt;br /&gt;
solaris8: No such zone configured&lt;br /&gt;
Use &#039;create&#039; to begin configuring a new zone.&lt;br /&gt;
zonecfg:solaris8-system&gt; &lt;b&gt;create -t SUNWsolaris8&lt;/b&gt;&lt;br /&gt;
zonecfg:solaris8&gt; &lt;b&gt;set zonepath=/export/solaris8&lt;/b&gt;&lt;br /&gt;
zonecfg:solaris8&gt; &lt;b&gt;add net&lt;/b&gt;&lt;br /&gt;
zonecfg:solaris8:net&gt; &lt;b&gt;set address=172.21.7.155/24&lt;/b&gt;&lt;br /&gt;
zonecfg:solaris8:net&gt; &lt;b&gt;set physical=ce0&lt;/b&gt;&lt;br /&gt;
zonecfg:solaris8:net&gt; &lt;b&gt;end&lt;/b&gt;&lt;br /&gt;
zonecfg:solaris8&gt; &lt;b&gt;commit&lt;/b&gt;&lt;br /&gt;
zonecfg:solaris8&gt; &lt;b&gt;exit&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Naturally, your IP and network device name will be different. As of now, our zone is fully &lt;i&gt;configured&lt;/i&gt;, but not yet &lt;i&gt;installed&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
5. Install the Solaris 8 zone using our flar-archive&lt;br /&gt;
&lt;br /&gt;
&lt;div class=code&gt;bash-3.00# &lt;b&gt;zoneadm -z solaris8 install -u -a /export/solaris8.flar&lt;/b&gt;&lt;br /&gt;
      Log File: /var/tmp/solaris8.install.13597.log&lt;br /&gt;
        Source: /export/solaris8.flar&lt;br /&gt;
    Installing: This may take several minutes...&lt;br /&gt;
Postprocessing: This may take several minutes...&lt;br /&gt;
WARNING: zone did not finish booting.&lt;br /&gt;
&lt;br /&gt;
        Result: Installation completed successfully.&lt;br /&gt;
      Log File: /export/solaris8/root/var/log/solaris8.install.13597.log&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
In my case the Solaris 8 zone got stuck on &lt;b&gt;sys-unconfig&lt;/b&gt;, and so I had to connect to the virtual console of the zone to help it move on:&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how you connect to a zone&#039;s console:&lt;br /&gt;
&lt;/div class=code&gt;bash-3.00# &lt;b&gt;zlogin -C solaris8&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
That&#039;s it! The rest was easy - just a few minutes of configuring the network parameters and DNS/NIS settings. Finally, I was able to ssh into the new zone and run &lt;b&gt;uname&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=code&gt;solaris8 #&lt;b&gt;uname -a&lt;/b&gt;&lt;br /&gt;
SunOS solaris8 5.8 Generic_Virtual sun4u sparc SUNW,Sun-Fire-V490&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I liked &lt;b&gt;Solaris 8 Migration Assistant&lt;/b&gt; very much. It&#039;s an incredibly quick and easy way to have a whole bunch of Solaris 8 systems virtualized and running under on one of the most advanced servers with the most advanced OS - Solaris 10u4. 
    </content:encoded>

    <pubDate>Wed, 21 Nov 2007 14:22:56 +0300</pubDate>
    <guid isPermaLink="false">http:/solaris.reys.net/english/2007/11/solaris-8-migration-assitant</guid>
    <category>s8ma</category>
<category>solaris 10</category>
<category>solaris 8</category>
<category>solaris 8 migration</category>
<category>solaris 8 migration assistant</category>
<category>solaris zone</category>
<category>zone</category>
<category>s8ma</category>
<category>solaris 10</category>
<category>solaris 8</category>
<category>solaris 8 migration</category>
<category>solaris 8 migration assistant</category>
<category>solaris zone</category>
<category>zone</category>

</item>
<item>
    <title>Zones in Solaris 10: part three - sparse root and whole root</title>
    <link>http://solaris.reys.net/english/2005/03/solaris_10_zones_sparse_root_whole_root</link>
            <category>Zones</category>
    
    <comments>http://solaris.reys.net/english/2005/03/solaris_10_zones_sparse_root_whole_root#comments</comments>
    <wfw:comment>http://solaris.reys.net/wfwcomment.php?cid=58</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://solaris.reys.net/rss.php?version=2.0&amp;type=comments&amp;cid=58</wfw:commentRss>
    

    <author>nospam@example.com (Gleb Reys)</author>
    <content:encoded>
    Today I&#039;ll tell you about root filesystem models for non-global zones in Solaris.&lt;br /&gt;
&lt;br /&gt;
As you probably know, there are two such models in Solaris 10: &lt;b&gt;sparse root&lt;/b&gt; and &lt;b&gt;whole root&lt;/b&gt;. The former approach means that the newly created non-global zone&#039;s root filesystem will only partially consist of actually copied into it packages and files, the rest will be inherited from the global zone. Such a model needs approximately 100Mb of disk space per zone, which is obviously much less than a full Solaris 10 installation, which happens in a case of a &lt;b&gt;whole root&lt;/b&gt; approach. I&#039;ve already mentioned this &lt;a href=&quot;http://solaris.reys.net/exit.php?url=aHR0cDovL3NvbGFyaXMucmV5cy5uZXQvZW5nbGlzaC9hcmNoaXZlcy81Ny1Tb2xhcmlzLTEwLmh0bWw=&amp;amp;entry_id=58&quot; title=&quot;http://solaris.reys.net/english/archives/57-Solaris-10.html&quot;  onmouseover=&quot;window.status=&#039;http://solaris.reys.net/english/archives/57-Solaris-10.html&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;earlier&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
By default, there are four directories of your global zone&#039;s root filesystem which are accessible to a non-global zone via &lt;b&gt;sparse root&lt;/b&gt; model: /lib, /platform, /sbin and /usr. &lt;br /&gt;
&lt;br /&gt;
If a non-global zone is created with at least one resource of &lt;b&gt;inherit-pkg-dir&lt;/b&gt; type, such a zone is said to be a &lt;b&gt;sparse root&lt;/b&gt; one.&lt;br /&gt;
&lt;br /&gt;
If you look at the zone&#039;s description, you can easily see how exactly such an access is configured:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;zonecfg -z zone1 export&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;...&lt;br /&gt;
add&amp;#160;inherit-pkg-dir&lt;br /&gt;
set&amp;#160;dir=/lib&lt;br /&gt;
end&lt;br /&gt;
add&amp;#160;inherit-pkg-dir&lt;br /&gt;
set&amp;#160;dir=/platform&lt;br /&gt;
end&lt;br /&gt;
add&amp;#160;inherit-pkg-dir&lt;br /&gt;
set&amp;#160;dir=/sbin&lt;br /&gt;
end&lt;br /&gt;
add&amp;#160;inherit-pkg-dir&lt;br /&gt;
set&amp;#160;dir=/usr&lt;br /&gt;
end&lt;br /&gt;
...&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Remember:&lt;/b&gt; resources of this type can only be created when a zone is in a &lt;b&gt;configured&lt;/b&gt; state, in other words - when it&#039;s set up, but no Solaris 10 installation copied any packages into it just yet. Thus, if you decide to alter these resources for an existing zone, you&#039;re going to have to &lt;b&gt;uninstall&lt;/b&gt; it first (by doing something like &lt;b&gt;zonecfg -z zone1 uninstall&lt;/b&gt;).&lt;br /&gt;
&lt;br /&gt;
A &lt;b&gt;sparse root&lt;/b&gt; model does the following: when installing Solaris 10 into your non-global zone, only the most necessary files are copied - the ones from packages where SUNW_PKGTYPE parameter is set to &lt;b&gt;root&lt;/b&gt;. All the rest packages won&#039;t be installed into the non-global zone, and later files from these packages will be accessible from withing the zone via loopback filesystems (lofs) in a read-only mode. Imagine how much space is saved with such an approach!&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t know anything about &lt;b&gt;lofs&lt;/b&gt;, please read &lt;b&gt;man lofs&lt;/b&gt;, and most things will probably clear up ;)&lt;br /&gt;
&lt;br /&gt;
As an example, do the following:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;mkdir&amp;#160;/var/tmp/hey&lt;br /&gt;
mount&amp;#160;-F&amp;#160;lofs&amp;#160;-o&amp;#160;ro&amp;#160;/usr&amp;#160;/var/tmp/hey&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Now, if you cd inot /var/tmp/hey and try to create or remove any file, you won&#039;t be able to, simply because /var/tmp/hey is a read-only mounted filesystem view of a /usr directory.&lt;br /&gt;
&lt;br /&gt;
Just to sum it all up: if a non-global zone doesn&#039;t have any &lt;b&gt;inherit-pkg-dir&lt;/b&gt; resources, such a zone is said to be a &lt;b&gt;whole root&lt;/b&gt; one, since all of the Solaris 10 packages are properly and fully copied into it. Such a mode takes up much more space, but you gain a great deal of flexibility - inside such a zone you can easily remove any files and packages, which isn&#039;t always possible within a zone with &lt;b&gt;inherit-pkg-dir&lt;/b&gt; resources. 
    </content:encoded>

    <pubDate>Thu, 31 Mar 2005 20:43:00 +0400</pubDate>
    <guid isPermaLink="false">http:/solaris.reys.net/english/2005/03/solaris_10_zones_sparse_root_whole_root</guid>
    
</item>
<item>
    <title>Zones in Solaris 10: part two - types of resources</title>
    <link>http://solaris.reys.net/english/2005/03/solaris_10_zones_resources</link>
            <category>Zones</category>
    
    <comments>http://solaris.reys.net/english/2005/03/solaris_10_zones_resources#comments</comments>
    <wfw:comment>http://solaris.reys.net/wfwcomment.php?cid=59</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://solaris.reys.net/rss.php?version=2.0&amp;type=comments&amp;cid=59</wfw:commentRss>
    

    <author>nospam@example.com (Gleb Reys)</author>
    <content:encoded>
    Now that we know how to create non-global zones in Solaris, it&#039;s probably time to learn some basics of zones configuration. Most work is done with &lt;b&gt;zonecfg&lt;/b&gt; which has been mentioned in my &lt;a href=&quot;http://solaris.reys.net/exit.php?url_id=855&amp;amp;entry_id=59&quot; title=&quot;http://solaris.reys.net/archives/57-Solaris-10.html&quot;  onmouseover=&quot;window.status=&#039;http://solaris.reys.net/archives/57-Solaris-10.html&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;previous entry&lt;/a&gt; already.&lt;br /&gt;
&lt;br /&gt;
For starters, let&#039;s have a look at the full configuration of our zone. You&#039;ve probably guessed by now, that we only specified the minimal number of parameters when creating our zone. Now I&#039;ll show you how to get a full view of our zone&#039;s configuration, and I&#039;ll also talk a bit about types of resources you can allocate to a non-global zone.&lt;br /&gt;
&lt;br /&gt;
Start &lt;b&gt;zonecfg&lt;/b&gt; with &lt;b&gt;export&lt;/b&gt; command to get a full configuration (&lt;b&gt;export&lt;/b&gt; is a command line parameter in my example, but if you like, you can do &lt;b&gt;zonecfg -z zone1&lt;/b&gt; and then type &lt;b&gt;export&lt;/b&gt; when prompted for a command):&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;zonecfg -z zone1 export&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;create&amp;#160;-b&lt;br /&gt;
set&amp;#160;zonepath=/sr/zones/1&lt;br /&gt;
set&amp;#160;autoboot=false&lt;br /&gt;
add&amp;#160;inherit-pkg-dir&lt;br /&gt;
set&amp;#160;dir=/lib&lt;br /&gt;
end&lt;br /&gt;
add&amp;#160;inherit-pkg-dir&lt;br /&gt;
set&amp;#160;dir=/platform&lt;br /&gt;
end&lt;br /&gt;
add&amp;#160;inherit-pkg-dir&lt;br /&gt;
set&amp;#160;dir=/sbin&lt;br /&gt;
end&lt;br /&gt;
add&amp;#160;inherit-pkg-dir&lt;br /&gt;
set&amp;#160;dir=/usr&lt;br /&gt;
end&lt;br /&gt;
add&amp;#160;net&lt;br /&gt;
set&amp;#160;address=192.168.0.5&lt;br /&gt;
set&amp;#160;physical=bge0&lt;br /&gt;
end&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
As you can guess from the name of the command - &lt;b&gt;export&lt;/b&gt;, we&#039;re getting a full list of commands for &lt;b&gt;zonecfg&lt;/b&gt; to create a similar zone. We&#039;re exporting the config. I&#039;ll talk about this a bit more some other time.&lt;br /&gt;
&lt;br /&gt;
Lookinf at the output, you can recognize some of the commands we&#039;ve actually typed following the instructions from my previous entry, but there are also few new commands. Particularly, they are the file-system (packages) related ones. I&#039;ll definitely have a separate blog entry on file systems in zones, but for now I&#039;ll just talk about resources for zones.&lt;br /&gt;
&lt;br /&gt;
Each non-global zone can be allocated any resources you have on your actual system. Resources are added with an &lt;b&gt;add&lt;/b&gt; command, which you can see now in the output I&#039;ve given. This commands takes a parameter - a resource type.&lt;br /&gt;
&lt;br /&gt;
Solaris 10 ones could have resources of the following types:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;net&lt;/b&gt; - a network interface. As you remember, when adding such a resource, you have to specify a physically present network adapter card you have in your box, and zone&#039;s network interface will be a virtual interface on this network adapter. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;device&lt;/b&gt; - any additional device. Using device names mask (for instance, /dev/pts*), you can allow a non-global zone access any devices you have on your actual system.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;fs&lt;/b&gt; - a file system. You can grant access to a physical disk or any directory of your actual system to any non-global zone. You can specify a file system type along with mount options, which is very convenient.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;inherit-pkg-dir&lt;/b&gt; - a globa zone root filesystem directory which is inherited by a non-global zone. Specifying a directory name, you&#039;re pointing to the fact that all the files from this directory of your actual system (global zone) will not be physically copied into the non-global zone, but insteal will be inherited. The fact is, files from these directories will be accessible through a read-only loopback filesystem in your non-global zone (thanks, &lt;a href=|http://solaris.reys.net/archives/57-Solaris-10.html#c106&quot;&gt;Dan&lt;/a&gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;attr&lt;/b&gt; - an attribute. With resources of this type you can create text comments for your zones - these comments might come in handy when you get back to reconfiguring your zone some time later. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;rctl&lt;/b&gt; - a zone-wide resource control. At this stage, there are only two parameters of this type - &lt;b&gt;zone.cpu-shares&lt;/b&gt; and &lt;b&gt;zone.max-lwps&lt;/b&gt;, but there will be more in the future. These parameters allow you to limit a CPU time given to a zone, and limit a max number of lwp processes which can be created in a zone. 
    </content:encoded>

    <pubDate>Wed, 30 Mar 2005 16:05:59 +0400</pubDate>
    <guid isPermaLink="false">http:/solaris.reys.net/english/2005/03/solaris_10_zones_resources</guid>
    
</item>
<item>
    <title>Zones in Solaris 10: part one - a working example</title>
    <link>http://solaris.reys.net/english/2005/03/solaris_10_zones_working_example</link>
            <category>Zones</category>
    
    <comments>http://solaris.reys.net/english/2005/03/solaris_10_zones_working_example#comments</comments>
    <wfw:comment>http://solaris.reys.net/wfwcomment.php?cid=57</wfw:comment>

    <slash:comments>15</slash:comments>
    <wfw:commentRss>http://solaris.reys.net/rss.php?version=2.0&amp;type=comments&amp;cid=57</wfw:commentRss>
    

    <author>nospam@example.com (Gleb Reys)</author>
    <content:encoded>
    Many of you have already heard about Solaris 10 zones - it&#039;s a virtualization technology which allows you to create isolated and secure environments for running applications. For end-users these environments look just like separate abstract machines with Solaris 10 installed on them. Inside each zone, all the processes don&#039;t see anything happening in all the other zones on a system. Isolation is done on such a level that processes of one zone can&#039;t see or affect processes of any other zone.&lt;br /&gt;
&lt;br /&gt;
All of this is done on a software level, and by default every Solaris 10 machine has a global zone - only from this zone you can view processes of all the rest zones on your system. You probably didn&#039;t even notice, but upon the completion of your Solaris 10 install, you&#039;re immediately put into the global zone. It&#039;s very easy to see this zone:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;bash-3.00$&amp;#160;zoneadm&amp;#160;list&amp;#160;-vc&lt;br /&gt;
&amp;#160;&amp;#160;ID&amp;#160;NAME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;STATUS&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;PATH&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;0&amp;#160;global&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;running&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;/&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
To create a non-global zone, just plan some hard drive space for it, and work away! You&#039;re going to need a &lt;b&gt;zonecfg&lt;/b&gt; command. You must specify a zone name as a command line parameter:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;zonecfg -z zone3&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If the zone specified doesn&#039;t exist, you&#039;ll see a message about it, and zonecfg will put you into it&#039;s command interface, where you can manage or create zones. Type the following (line by line):&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;bash-3.00#&amp;#160;zonecfg&amp;#160;-z&amp;#160;zone3&lt;br /&gt;
zone3&amp;#58;&amp;#160;No&amp;#160;such&amp;#160;zone&amp;#160;configured&lt;br /&gt;
Use&amp;#160;&#039;create&#039;&amp;#160;to&amp;#160;begin&amp;#160;configuring&amp;#160;a&amp;#160;new&amp;#160;zone.&lt;br /&gt;
zonecfg&amp;#58;zone3&amp;#62;&amp;#160;create&lt;br /&gt;
zonecfg&amp;#58;zone3&amp;#62;&amp;#160;set&amp;#160;zonepath=/sr/zones/3&lt;br /&gt;
zonecfg&amp;#58;zone3&amp;#62;&amp;#160;set&amp;#160;autoboot=false&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;br /&gt;
zonecfg&amp;#58;zone3&amp;#62;&amp;#160;add&amp;#160;net&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;br /&gt;
zonecfg&amp;#58;zone3&amp;#58;net&amp;#62;&amp;#160;set&amp;#160;address=192.168.0.7&lt;br /&gt;
zonecfg&amp;#58;zone3&amp;#58;net&amp;#62;&amp;#160;set&amp;#160;physical=bge0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;br /&gt;
zonecfg&amp;#58;zone3&amp;#58;net&amp;#62;&amp;#160;end&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;br /&gt;
zonecfg&amp;#58;zone3&amp;#62;&amp;#160;verify&lt;br /&gt;
zonecfg&amp;#58;zone3&amp;#62;&amp;#160;exit&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This set of commands will create you a simple zone. There aren&#039;t that many parameters initially, as you can see:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;zonepath&lt;/b&gt; is the full path to the directory where the specified zone&#039;s files will reside&lt;br /&gt;
&lt;b&gt;autoboot&lt;/b&gt; is a flag used to determine whether a non-global zone should be automatically booted up every time your actual system (with your global zone) boots.&lt;br /&gt;
&lt;br /&gt;
Further on, we&#039;re assigning one network interface to our zone, and give it an IP address. You should specify the name of the real network interface present in your global zone. For the zone you&#039;re creating, zonecfg will have a virtual interface based off the real one you specify.&lt;br /&gt;
&lt;br /&gt;
Now it&#039;s time to &lt;b&gt;verify&lt;/b&gt; your config - this command makes sure all the necessary parameters have got their values set. After this, we&#039;re done.&lt;br /&gt;
&lt;br /&gt;
Now, if you look at the list of your zones again, you&#039;re going to see a newly created zone as well:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;bash-3.00#&amp;#160;zoneadm&amp;#160;list&amp;#160;-vc&lt;br /&gt;
&amp;#160;&amp;#160;ID&amp;#160;NAME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;STATUS&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;PATH&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;0&amp;#160;global&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;running&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;/&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;-&amp;#160;zone3&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;configured&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;/sr/zones/3&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Right now our zone is in a &quot;configured&quot; state - it can&#039;t be used until we install OS onto it and it gets its unique ID. Obviously, you won&#039;t be able to boot your zone unless it has installed OS.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a list of the states a non-global zone can be in:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;configured&lt;/b&gt; - our zone is configured, but it&#039;s yet to have its initial boot&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;incomplete&lt;/b&gt; - zoneadm command sets a zone&#039;s state to this value while installing and uninstalling a zone. When the operation is completed, zone&#039;s status is changed.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;installed&lt;/b&gt; - zone is fully configured, OS packages have been installed. It&#039;s a ready-to-use zone, all you have to do is to boot it. The zone has no virtual platform associated yet.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;ready&lt;/b&gt; - the zone is ready. It already has a virtual platform established, the kernel has created a &lt;b&gt;zsched&lt;/b&gt; process, all the network interfaces are plumbed, devices are configured and file systems are mounted. No processes have been started yet, but since the zone is ready it already has a unique ID assigned to it. We normally don&#039;t see a zone in this state, and it always moves one to the next one - running.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;running&lt;/b&gt; - the zone is up and running. You can connect to the zone. It&#039;s a fully working environment now.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;shutting down&lt;/b&gt; and &lt;b&gt;down&lt;/b&gt; are short-term states which are shown when the zone is being halted. Upon completion of halt, the zone gets back into installed state.&lt;br /&gt;
&lt;br /&gt;
Now, it&#039;s time to continue configuring our zone. We should install it. It is done with the following command:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;zoneadm -z zone3 install&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
After this you can watch the process of packages installation for your zone, and when all the packages are installed, you&#039;ll get the location of the OS installation log file. That&#039;s it! Our zone is ready, and you can boot it:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;zoneadm -z zone3 boot&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Wonderful. But we still can&#039;t log in... Why? Because we&#039;ve yet to configure the OS inside our zone - just like we would configure any box we&#039;ve just installed with Solaris. As you&#039;ve noticed, the order of OS installation is slightly different - in real life you have to configure the box first, and then you get to watch all the packages installing on it, with zones it&#039;s the other way around - first copy all the stuff, then configure the OS.&lt;br /&gt;
&lt;br /&gt;
What we need now is connect to the zone&#039;s console and answer all the standard Configuration Assistant&#039;s questions, one of them is the root password. After this, your zone will want to reboot, and you&#039;ll be able to log in as root on your console. If you want to allow remote root logins, you&#039;ll obviously need to add the &lt;b&gt;CONSOLE=/dev/console&lt;/b&gt; line to /etc/default/login.&lt;br /&gt;
&lt;br /&gt;
To reach a zone&#039;s console, you should use &lt;b&gt;zlogin&lt;/b&gt; command, &lt;b&gt;-C&lt;/b&gt; means &quot;console&quot;:&lt;br /&gt;
&lt;b&gt;zlogin -C zone3&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
You can disconnect from the console using the standard combination: &quot;~.&quot; (tilda dot)&lt;br /&gt;
&lt;br /&gt;
One more thing. Since non-global zones will share the physical network interface with your global zone - you&#039;ve got to make sure your system (your global zone) can see your non-global zones networks.&lt;br /&gt;
&lt;br /&gt;
For instance, here&#039;s the &lt;b&gt;ifconfig -a&lt;/b&gt; from my laptop:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;bge0&amp;#58;1&amp;#58;&amp;#160;flags=1000843&amp;#60;UP,BROADCAST,RUNNING,MULTICAST,IPv4&amp;#62;&amp;#160;mtu&amp;#160;1500&amp;#160;index&amp;#160;2&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;zone&amp;#160;zone2&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;inet&amp;#160;192.168.0.6&amp;#160;netmask&amp;#160;ffffff00&amp;#160;broadcast&amp;#160;192.168.0.255&lt;br /&gt;
bge0&amp;#58;2&amp;#58;&amp;#160;flags=1000843&amp;#60;UP,BROADCAST,RUNNING,MULTICAST,IPv4&amp;#62;&amp;#160;mtu&amp;#160;1500&amp;#160;index&amp;#160;2&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;inet&amp;#160;192.168.0.2&amp;#160;netmask&amp;#160;ffffff00&amp;#160;broadcast&amp;#160;192.168.0.255&lt;br /&gt;
bge0&amp;#58;3&amp;#58;&amp;#160;flags=1000843&amp;#60;UP,BROADCAST,RUNNING,MULTICAST,IPv4&amp;#62;&amp;#160;mtu&amp;#160;1500&amp;#160;index&amp;#160;2&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;zone&amp;#160;zone1&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;inet&amp;#160;192.168.0.5&amp;#160;netmask&amp;#160;ffffff00&amp;#160;broadcast&amp;#160;192.168.0.255&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, interfaces assigned to zones are marked with the &quot;zone&quot; parameter. I had to create a virtual interface (bge0:2) from the same subnet as the IPs of my zones. This way, I can ping interfaces assigned to each of the zones configured.&lt;br /&gt;
&lt;br /&gt;
One more thing I wanted to mention: software packages, installed in a zone. Most curious of you have probably looked inside the installation log file, and noticed, that most of the standard Solaris 10 packages have been installed in our zone. At the same time, the directory with our zone&#039;s files takes up roughly 70mb... Such an incostistancy is explained by one of the key features of the zones virtualization: non-global zones can easily share files with the global zone. Thus, you can specify for each zone, that some files (packages), when required by the installer, should not be actually copied and installed, but just borrowed from the global zone - every time you&#039;ll want to access some of these files in your non-global zone, they&#039;ll be taken from the ones in your actual system - from your global zone. Obviously, all the files inherited in such a way by non-global zone, will be read-only.This technique allows you save lots of space, and by default all the files from /lib, /platform, /usr and /sbin directories are shared with the global zone. It is important to undestand that this happens only to the standard packages. So, if you&#039;ve added some files of yours in the abovenamed directories, they will obviously NOT be shared with non-global zones.&lt;br /&gt;
&lt;br /&gt;
Well, I guess it&#039;s enough for the part one of my notes on Solaris zones - with any luck you should now have a working zone which you can access remotely - log in, manage services, do whatever you want. &lt;br /&gt;
&lt;br /&gt;
I&#039;ll add more stuff whenever I have a minute to spare.... 
    </content:encoded>

    <pubDate>Mon, 07 Mar 2005 17:53:57 +0300</pubDate>
    <guid isPermaLink="false">http:/solaris.reys.net/english/2005/03/solaris_10_zones_working_example</guid>
    <category>opensolaris</category>
<category>solaris</category>
<category>solaris zones</category>
<category>opensolaris</category>
<category>solaris</category>
<category>solaris zones</category>

</item>

</channel>
</rss>