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:
- Global/Parent Zone (Base OS)
- 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:
- 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.
- 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:
- /usr: Uses all programs from the Global Zone; removing a program here doesn't affect the Global Zone.
- /lib: Utilizes the OS libraries from the Global Zone.
- /sbin: Accesses superuser binaries from the Global Zone.
- /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:
- Configure
- Install
- 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
- Create a directory for the zone:
-bash-3.00# mkdir /solzone -bash-3.00# chmod 700 /solzone
- 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>
- Create the zone:
zonecfg:solzone> create
- Set the zone path:
zonecfg:solzone> set zonepath=/solzone/
- Configure it to boot on startup:
zonecfg:solzone> set autoboot=true
- 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
- 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
- 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
Post a Comment