Sun Certified System Administrator for Solaris 10 Study Guide Exams 310-XXX & 310-XXX

Certification Objective 15.05—Managing Solaris Zones

In the good old days of computing, there was one operating system such as DOS (disk operating system) running on a machine and managing resources for one application and one user at a time. However, UNIX has been a multiuser and multi-process operating system from the very beginning. This means one operating system running on one machine and managing resources for multiple applications running concurrently and multiple users logged into the system at the same time.

The main, advantages of running multiple applications on the same machine under one operating system are wise use of resources and ease of administration (it's easier to administer one machine as opposed to ten machines, for example). The main advantages of applications running on different machines under different copies (instances) of the same operating system such as Solaris are that the applications can communicate with each other only through network APIs. Hence, they are secured from each other, and a heavy use of resources by one application does not affect the performance of the other application on another machine.

Now that computer systems are increasingly becoming more powerful in resources such as disk space, memory, and CPU power, it makes sense to consolidate applications running on different systems to one system. The problem is that if you do that, the applications, though they may currently have no resource shortage, will lose the other benefits of running in an isolated environment. So the question is: how can I run multiple applications on the same machine and still provide each application (or a group of applications) the isolated environment as if it were running on a machine of its own? That means having more than one operating system environment on one machine. So the computing model we are talking about now is: multiple instances of an operating system running on the same machine, each instance providing an isolated environment to the processes running under it as if they were running on a machine of their own. These isolated environments are provided by Solaris 10 and are called zones.

Understanding Zones

Exam Objective 6.1: Explain consolidation issues, features of Solaris zones, and decipher between the different zone concepts including zone types, daemons, networking, command scope, and given a scenario, create a Solaris zone.

A Solaris zone is a virtual operating system environment created by one instance of the Solaris operating system. There may be more than one zone on the same machine, and processes running in one zone cannot monitor or affect the processes running in other zones. Processes running in different zones can interact with each other only through network APIs. In other words, the processes running in a zone are isolated from processes in other zones, as though each zone were a machine (box) on its own. Actually, zone technology provides an abstract layer that separates applications from the physical attributes of the machine, such as physical device paths, on which they are deployed.

On the Job 

The maximum number of zones that you can create on a system is 8192. However, the number of zones that you can practically host on a system depends on the resources offered by the system and the resource requirements of the applications running in the zones.

Before diving into the details of zone technology, you should understand the basic concepts described here:

Table 15-3: Characteristics of global and non-global zones compared

Characteristic

Global Zone

Non-Global Zone

ID

Assigned ID 0 by the system.

Assigned a zone ID by the system when the zone is booted.

Kernel

Provides the single instance of the Solaris kernel that is bootable and running on the system.

Shares operation under the Solaris kernel booted from the global zone.

Transparency

Aware of all devices, file systems, and the existence of other zones on the machine.

Not aware of physical device paths, and not aware of the existence of other zones.

Management

Other zones can be managed (configured, installed, and uninstalled) from this zone.

No zone (including itself) can be managed from this zone.

Configuration information

Holds the configuration information specific to this zone only such as the global zone host name and the file system table.

Holds the configuration information specific to this zone only such as the non-global zone host name and the file system table

Software

Contains a complete installation of the Solaris system software packages. Can contain additional software packages, and additional software—that is, files and directories not installed through packages—for other data.

Contains a subset of the complete installed Solaris Operating System software. Can contain additional Solaris software packages shared from the global zone, as well as the packages not shared from the global zone, Can contain additional software packages, and additional software: files and directories not installed through packages, for other data.

Product database

Provides a complete and consistent product database that contains information about all software components installed in this zone, the global zone.

Provides a complete and consistent product database that contains information about all the software components installed on this zone—that is, those components present entirely on this non-global zone and those that are shared (read-only) from the global zone.

A natural question to ask at this point is: how are the zones created and managed? The administrator for the global zone, referred to as the global administrator, has superuser privileges for the whole system. The global administrator, who has the primary administrator role, uses the zonecfg command to configure the zone and the zoneadm command to install software in the zone and to boot the zone. The global administrator can also assign a zone-management profile to a zone administrator whose privileges would be confined to that specific zone.

You can create a zone and delete a zone. At a given moment in its life cycle, a non-global zone can be in one of the following six states:

The benefits provided by the non-global zones are discussed here in terms of features:

Before you can install a zone and use it, it must be configured,

Configuring a Zone

Exam Objective 6.2: Given a zone configuration scenario, identify zone components and zonecfg resource parameters, allocate file system space, use the zonecfg command, describe the interactive configuration of a zone, and view the zone configuration file.

You can use the zonecfg utility to set up the zone configuration, which includes creating and modifying the zone configuration. Configuring a zone includes configuring zone components—its resources and properties. A property may belong to the zone (a global property) or to a particular resource. The zone configuration consists of resources described here:

Once you include a resource in a zone, you also need to assign appropriate properties to the resource. You can also assign properties to the zone, called global properties. The zone configuration contains the following properties:

The zonecfg command can be used in any of the three available modes: interactive mode, command-line mode, or command-file mode.

You can use the zonecfg command to get through the following three stages of configurations:

You can start the interactive session with the zonecfg utility by issuing the following command from the global zone:

zonecfg -z <zoneName>

The <zoneName> argument specifies the name of the zone to be created. Then, on the zonecfg command prompt you can issue appropriate subcommands to perform various configuration tasks, as shown in Table 15-4.

Table 15-4: Subcommands that can be used during an interactive session with the zonecfg utility

Subcommand

Description

create

Create an in-memory configuration for the zone. Without any option, it applies the Sun default settings. Use the -t option to use the configuration in a template, the -F option to overwrite the existing configuration, and the -b option to create a blank configuration with nothing set.

set

Set the value of a property, such as:

set autoboot=true.

add

When used in the zone scope (global scope), adds a resource to the zone, and when used in the resource scope, adds a property (name and value) to the resource.

remove

When used in the zone scope, removes a resource type from the zone, and when used in the resource scope, removes a property (name and value) from the resource.

delete

Delete the configuration from the memory and from the storage. Must be used with the -F option.

info

Display information about the current configuration. If the resource is specified, only the information about that resource type is displayed.

verify

Check the correctness of the current configuration. Make sure all the required properties for a resource type have been set.

export

Print the configuration to the standard output, or to the specified file in the form that can be used in a command file.

revert

Roll back the configuration to the last committed state.

commit

Save the current configuration from memory in permanent storage.

end

End the resource specification.

exit

Exit the zonecfg session.

Exam Watch

Note the difference between the remove and delete subcommands; The remove command removes a resource type or properties of a resource type, whereas delete destroys the entire zone configuration.

Note the following important points related to the zone configuration:

The following exercise demonstrates how to use the zonecfg command in its interactive mode.

Exercise 15-1: Configuring a Zone

This exercise demonstrates how to use the zoncefg command and some of its subcommands to configure a zone.

  1. Become superuser in the global zone. If you have not created any zone yet, you are in the global zone.

  2. Create a zone named senate-zone (as an example) by issuing the following command:

    # zonecfg -z senate-zone

    If you are configuring this zone for the first time, the following system message will appear:

    senate-zone: No such zone configured Use 'create' to begin configuring a new zone.

  3. Create the configuration for the senate-zone by issuing the create command at the zone prompt:

    zonecfg:senate-zone> create

  4. Set the zone path to, for example, /export/home/senate-zone:

    zonecfg:senate-zone> set zonepath=/export/home/senate-zone

  5. Set the value of the autoboot property so that the zone is automatically booted when the global zone is booted.

    zonecfg:senate-zone> set autoboot=true

  6. Add the virtual network interface to the zone senate-zone.

    1. Start setting up the interface with the following command:

      zonecfg:senate-zone> add net

    2. Assign the IP address 192.168.1.1 to the network interface.

      zonecfg:senate-zone:net> set address=192.168.1.1

    3. Set the physical device type for the network interface, such as hme0.

      zonecfg:senate-zone:net> set physical=hme0

  7. End this specification for the resource net:

    zonecfg:senate-zone:net> end

    The prompt returns back to the zone level:

    zonecfg:senate-zone>

  8. Exit the zonecfg command:

    zonecfg:senate-zone> exit

Note that once you exit the zonecfg command, the configuration will be automatically committed even if you did not use the commit command.

After you have configured a non-global zone, you can install it after verifying that the zone can be installed safely on your system's configuration. After that, you can perform other administration tasks on the zone.

Administering a Zone

Exam Objective 6.3: Given a scenario, use the zoneadm command to view, install, boot, halt, reboot, and delete a zone.

For each zone that is in the ready, running, or shutting-down state, there is one zone administration daemon, zoneadmd, running to manage the zone, which includes booting and shutting down in addition to other tasks. If the daemon is not running for any reason, an invocation of the zoneadm command will start it. Although the daemon does the work, you use the zoneadm command to administer the zone.

You can use the zoneadm command from the global zone to install and administer non-global zones. By using the zoneadm command, you can perform the following tasks:

The subcommands used with the zoneadm command to perform zone administration tasks are shown in Table 15-5. These subcommands have very trivial names. However, the trick here is to understand the conditions under which each of these commands can be issued. In other words, before issuing any of these subcommands you have to ask two questions:

Table 15-5: Subcommands with the zoneadm command to perform various tasks (commands are issued from the global zone)

Task

The zoneadm Command

Verify a configured zone.

zoneadm -z <zoneName> verify

Install a configured zone.

zoneadm -z <zoneName> install

Get information about zones.

zoneadm -z <zoneNarne> list <option>

Without any option, all running zones are listed. The option -c means display all configured zones, -i means display all installed zones, -v means display verbose information: zone ID, current state, and root directory.

Uninstall a zone.

zoneadm -z <zoneName> uninstall

Transition an installed zone to the ready state.

zoneadm -z <zoneName> ready

Boot a zone that is in an installed state or a ready state. Booting puts a zone into the running state.

zoneadm -z <zoneName> boot

Halt a running zone.

zoneadm -z <zoneName> halt

To understand in which zone state a specific subcommand can be applied, you need to understand the states we described previously in this section. The relationships of the states of a zone with each other defined by the transition of states by using the subcommands (with the zoneadm command) are shown in Figure 15-3, where the arrows indicate the transitions between states.

Figure 15-3: Various zone states in the life cycle of a zone (the create and delete subcommands are used with the zonecfg command, and the other subcommands shown are used with the zoneadm command)

After a zone has been installed, you can log into the zone by using the zlogin command to complete its application environment. The zlogin command can also be used to shut down the zone as shown, here:

zlogin <zoneName> shutdown

If you want to delete a zone, it must be put back into the configured state—that is, if it is running, it must be shut down either by using the halt command or by using the shutdown command, and then it must be uninstalled. Exercise 15-2 demonstrates how to delete a non-global zone.

Exercise 15.2: Deleting a Non-Global Zone

This exercise shows you how to delete a running zone named senate-zone, as an example. All the commands in this exercise are issued from the global zone.

  1. Shut down the zone senate-zone by issuing the following command from the global zone:

    zlogin senate-zone shutdown

  2. Uninstall the root file system for senate-zone by issuing the following command:

    zoneadm -z senate-zone uninstall -F

  3. Delete the configuration for senate-zone by issuing the following command:

    zonecfg -z senate-zone delete -F

  4. Verify the zone deletion. To verify that senate-zone is not listed, issue the following command:

    zoneadm list -iv

    The output of this command will be like the following:

    ID NAME STATE PATH 0 global running /

The three most important takeaways from this chapter are:

Категории