Welcome Vivek's Weblog

Tuesday May 20, 2008

 

Zone Creation in Solaris 10 is very fast, simple and easy. Following is an example on creating a zone (Virtual OS) on your Solaris 10. This example shows the creation of 'testzone':



# zonecfg -z testzone

testzone: No such zone configured

Use 'create' to begin configuring a new zone.

zonecfg:testzone> create

zonecfg:testzone> set autoboot=true

zonecfg:testzone> set zonepath=/test/zones/testzone
zonecfg:testzone> add inherit-pkg-dir

zonecfg:testzone:inherit-pkg-dir> set dir=/opt

zonecfg:testzone:inherit-pkg-dir> end

zonecfg:testzone> info

zonename: testzone

zonepath: /test/zones/testzone

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

inherit-pkg-dir:

        dir: /opt

zonecfg:testzone> add net

zonecfg:testzone:net> set address=10.1.1.1

zonecfg:testzone:net> set physical=bge0

zonecfg:testzone:net> end

zonecfg:testzone> verify

zonecfg:testzone> commit

zonecfg:testzone> exit


 

We have added "/opt" directory as well, so that it will not be replicated for zones. This will make zone installation faster.

Now, List the zones:



# zoneadm list -cv

  ID NAME             STATUS         PATH                         

   0 global           running        /                            

   - testzone           configured     /test/zones/testzone

 

The newly created zone is now listed, and is in configured state. The configuration information is stored in an XML file within /etc/zones. The zone can’t be used, until it is “installed.”

Here is the step to install my testzone:



bash-3.00#  zoneadm -z testzone install

Preparing to install zone <testzone>.

Creating list of files to copy from the global zone.

Copying <2383> files to the zone.

Initializing zone product registry.

Determining zone package initialization order.

Preparing to initialize <1032> packages on the zone.

Initialized <1032> packages on zone.

Zone <testzone> is initialized.

Installation of <1> packages was skipped.

The file </test/zones/testzone/root/var/sadm/system/logs/install_log> contains a log of the zone installation.

 

It took less than 5 mins to install the testzone on my system. List the zones now:

 

bash-3.00# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   - testzone         installed  /test/zones/testzone           native   shared

 

You can see that zone status is installed. After installing zone, you have to boot it for the first time setup, and also answer boot-time questions. For this, log into the zone console from another terminal:

 

 zlogin -C testzone

 

This will let you into the zone console (no password req)

Now from the main terminal, boot the zone:

 

zoneadm -z testzone boot

 

On the console, the installation will ask set-up related questions. Answer them appropriately.

Check the Zone status:

 

bash-3.00# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   2 testzone         running    /test/zones/testzone           native   shared

 

The Zone is now started running, and is ready to use.

 

Comments:

Yes, you configured it but you might be leaving your readers at a loss if you ignore these next two steps

zoneadm -z testzone install

zoneadm -z testzone boot

Posted by Jim Laurent on May 20, 2008 at 06:39 PM IST #

zlogin -C testzone

Answer the questions presented by the boot process.

Then the zone is ready for use.

Posted by Jim Laurent on May 20, 2008 at 06:40 PM IST #

Yes, I am in process of adding more data and formating it.
Thanks for pointing this out :)

Posted by vivek jain on May 20, 2008 at 07:04 PM IST #

After I am connected to the console,no questions are asked.
After hitting return key, login prompt appears.
Please tell the procedure in detail to configure the environment after getting connected to console.
Thanks & Regards,
Karanvir

Posted by karanvir on May 21, 2008 at 07:26 PM IST #

Did you logged in to console before executing "zoneadm -z testzone boot" or after?

Posted by Vivek on May 21, 2008 at 07:40 PM IST #

I logged after executing "zoneadm -z testzone boot"

Posted by karanvir on May 21, 2008 at 08:48 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed