Playing with Solaris Zones

Solaris supports operating system-level virtualization, allowing you to run only Solaris in virtual hosts, utilizing the same kernel copy as the parent OS. This results in high performance, with overhead degradation typically between 1-3%.

Zones

There are two types of zones:

  1. Global/Parent Zone (Base OS)
  2. Non-Global Zones

Key Points about Zones:

  • A single machine can host up to 8192 zones.
  • Zones do not support graphics.
  • Zones are not installed from DVD or other media; they are created from the parent OS.
  • It is common not to run services on the Global Zone, as its failure affects all Non-Global Zones.

Types of Non-Global Zones:

  1. Whole Root Zone: This contains a complete Solaris OS. It's slower and generally not recommended for production as it acts as a full replica of the Global Zone.
  2. Spare Root Zone: This type shares parts of the Solaris OS with the parent zone, offering faster performance since only essential components are loaded.

Inheritance in Spare Root Zones

Spare Root Zones inherit four key directories from the Global Zone:

  1. /usr: Uses all programs from the Global Zone; removing a program here doesn't affect the Global Zone.
  2. /lib: Utilizes the OS libraries from the Global Zone.
  3. /sbin: Accesses superuser binaries from the Global Zone.
  4. /platform: Downloads platform-independent modules from the Global Zone.

Zone States

A zone can exist in several states:

  • Configured: Initial configuration is set, but the zone isn't installed and cannot be booted.
  • Incomplete: Indicates the zone is being installed or uninstalled.
  • Installed: The zone is configured, packages are installed, and it is ready to be booted.
  • Ready: The zone is prepared for use, with a scheduled process and plumbed interfaces, ready to transition to a running state.
  • Running: The zone is active and can be used.
  • Shutting Down/Down: Indicates the zone is in the process of being halted.

Configuring a Spare Root Zone

To configure a spare root zone, follow these steps:

  1. Configure
  2. Install
  3. Boot

Commands for Managing a Spare Root Zone

To check the current zone name (default is the Global Zone):

-bash-3.00# zonename
global

To list the zones on the machine:

-bash-3.00# zoneadm list
global

To view zone information:

-bash-3.00# cat /etc/zones/index

Creating a Zone

  1. Create a directory for the zone:
    -bash-3.00# mkdir /solzone
    -bash-3.00# chmod 700 /solzone
  2. Start configuring the zone:
    -bash-3.00# zonecfg -z solzone
    solzone: No such zone configured
    Use 'create' to begin configuring a new zone.
    zonecfg:solzone>
  3. Create the zone:
    zonecfg:solzone> create
  4. Set the zone path:
    zonecfg:solzone> set zonepath=/solzone/
  5. Configure it to boot on startup:
    zonecfg:solzone> set autoboot=true
  6. Set up the network interface:
    zonecfg:solzone> add net
    zonecfg:solzone:net> set address=192.168.56.200
    zonecfg:solzone:net> set physical=e1000g1
    zonecfg:solzone:net> end
  7. Limit memory usage:
    zonecfg:solzone> add capped-memory
    zonecfg:solzone:capped-memory> set physical=512m
    zonecfg:solzone:capped-memory> set swap=512m
    zonecfg:solzone:capped-memory> end
  8. Verify and commit the configuration:
    zonecfg:solzone> verify
    zonecfg:solzone> commit
    zonecfg:solzone> exit

Installing the Zone

-bash-3.00# zoneadm -z solzone install

Preparing the Zone for Booting

-bash-3.00# zoneadm -z solzone ready

Booting the Zone

-bash-3.00# zoneadm -z solzone boot

Logging into the Console

-bash-3.00# zlogin -C solzone

(Note: Using -C requires a password for root access.)

Uninstalling the Zone

-bash-3.00# zoneadm -z solzone uninstall

Checking the Zone List

-bash-3.00# zoneadm list -v

Reconfiguring the Zone

-bash-3.00# zonecfg -z solzone

Comments

Popular posts from this blog

Server should be SSL-aware but has no certificate configured [Hint: SSLCertificateFile] ((null):0)

Using a Self signed Certificate to Run Apache2 under SSL

IPS (Image Packaging system) in Solaris 10