Innerhalb
Nach weiteren Dokumenten suchenSupport-Ressourcen | Dieses Buch im PDF-Format herunterladen (2917 KB)
Chapter 21 Creating Solaris Flash Archives (Tasks)This chapter provides the procedures for creating a Solaris Flash archive. These procedures include installing a master system and then creating a Solaris Flash archive from that master system. You can also create a differential archive if you have previously installed an archive on a clone system. When the differential archive is created, two images are compared: the unchanged master image and an updated image. The differential archive installs only the differences between the two images. Also, procedures to create scripts are provided to reconfigure or otherwise customize the archive. Task Map: Creating Solaris Flash ArchivesTable 21–1 Task Map: Creating a Solaris Flash Archive to Install With an Initial Installation
Table 21–2 Task Map: Creating a Solaris Flash Archive to Update a Clone System
Installing the Master SystemYou install the master system with the software configuration that you want other systems to have. You can install clone systems with an initial installation that overwrites all files on the system or with an update that only includes the differences between two images. For an initial installation, use any of the Solaris installation methods to install the Solaris operating environment on the master system. If you have previously installed an archive on a clone system, you can update that system with changes by using a differential archive. The changes are made to the original image such as installing patches, or adding and removing packages. The differential archive overwrites only the files specified in the archive. For the procedure for updating the original master image and creating a differential archive, see To Create a Solaris Flash Differential Archive With an Updated Master Image. To Install the Master System for an Initial Installation
Creating Customization ScriptsScripts can customize the archive. Use these scripts for the following purposes:
For guidelines on creating scripts, see Guidelines for Creating a Custom Script. To Create a Precreation ScriptThis script runs during archive creation. The script has various uses.
Example 21–1 Excerpts From a Precreation ScriptThe following examples are excerpts from a precreation script.
Example 21–2 Precreation Script#!/bin/sh echo "Test precreation script started" >> $FLASH_DIR/summary cat /opt/TestApp/critical_file_list | flcheck - if [ $? != 0 ]; then echo "Test precreation script failure" >> $FLASH_DIR/summary exit 1 fi echo "Test precreation script started" >> $FLASH_DIR/summary /opt/TestApplication/license_cloning $FLASH_DIR/predeployment/.TestApplicationLicenceTransfer \ $FLASH_DIR/custom_sections/TestApplicationLicenceCounter echo "Test precreation script finished" >> $FLASH_DIR/summary exit 0 Using a Precreation Script to Create a User-Defined Archive SectionA precreation script can create a user-defined section in the archive to provide specific application information. This section is intended for archive maintenance. The script must be put in the $FLASH_DIR/sections directory. The Solaris Flash archive does not process a user-defined section. For example, a section could contain a description of the archive or perhaps a script to check the integrity of an application. A user-defined section requires the following format.
To Create a Predeployment ScriptThis script is run before the installation of the archive. If the script is meant to validate the archive, it is kept in the archive. If the script is meant to preserve local configurations on the clone system, it is kept on the clone system. This script also can analyze and collect local data necessary for later customization. For example, client-specific information can be saved before being overwitten by files about to be extracted. This information can then be used in the final stage after extraction.
Example 21–3 Predeployment Script#!/bin/sh $FLASH_DIR/TestApplication/check_hardware if [ $? != 0 ]; then echo Unsupported hardware exit 1 fi $FLASH_DIR/TestApplication/check_licence_key if [ $? != 0 ]; then echo No license for this host exit 1 fi $FLASH_DIR/TestApplication/deploy_license_key \ $FLASH_DIR/TestApplication/.TestApplicationLicenceTransfer $FLASH_DIR/TestApplication/save_data_files $FLASH_DIR/flash exit 0 To Create a Postdeployment ScriptThis script is kept in the archive or stored in a local directory on the clone system and runs after installation. The script reconfigures a new system image on a clone system. If the script is stored in the archive, the changes affect all the clone systems. If the script is stored in a local directory on the clone system, the changes affect only the clone system. For example, client-specific information that is saved by a predeployment script can be applied to the clone environment, completing the installation. Postdeployment scripts can also be used to clean up files after the archive is installed. For example, log files such as those files in /var/adm can be cleaned out. Note – Not all log files need a script for cleanup. Log files in /var/tmp can be excluded when the archive is created.
Example 21–4 Postdeployment Script#!/bin/sh $FLASH_DIR/TestApplication/clone_reconfiguration $FLASH_DIR/TestApplication/restore_data $FLASH_DIR/flash To Create a Reboot ScriptThis script is kept in the archive and runs after the system is rebooted. The script does any final configuration after system reconfiguration. After you install the Solaris Flash archive on a clone system, some host-specific files are deleted and are re-created for the clone machine. The installation program uses the sys-unconfig(1M) command and the sysidtool(1M) programs to delete and re-create host-specific network configuration files. The files that are re-created include, for example, /etc/hosts, /etc/defaultrouter, and /etc/defaultdomain. You can use the reboot script for any final reconfiguration. Example 21–5 Creating a Reboot Script#!/bin/sh $FLASH_DIR/TestApplication/finalize_license Creating a Solaris Flash ArchiveYou can create an archive with an initial installation that overwrites all the files on the clone system, or you can create a differential archive that only overwrites the changes that are specified. For an overview of a differential archive, see Planning to Create the Solaris Flash Differential Archive for an Update. To Create a Solaris Flash Archive for an Initial InstallationAfter you install the master system, create a Solaris Flash archive to use to install other systems.
Examples—Creating an Archive for an Initial InstallFile systems can be copied exactly or can be customized by excluding some directories or files. You can achieve the same results by using different options. Use the options that best suit your environment. The file systems in the following examples have been greatly simplified for clarification. Rather than use file system names such as /var, /usr, or /opt, the master system file structure for these examples is the following:
Use the flar create file exclusion options with caution. If you exclude some directories, others that you were unaware of might be left in the archive, such as system configuration files. The system would then be inconsistent and the installation would not work. Excluding directories and files is best used with data that can easily be removed without disrupting the system, such as large data files. Example 21–6 Creating an Exact Duplicate ArchiveIn this example, the archive is named archive1. It is copied exactly from the master system and then compressed. The archive is an exact duplicate of the master system and stored in archive1.flar.
To check on the file structure of the archive, type the following.
Example 21–7 Creating an Archive and Excluding and Including Files and DirectoriesIn this example, the archive is named archive2. It is copied from the master system but is not an exact copy. The content under the /aaa directory is excluded, but the content in /aaa/bbb/ccc remains.
To check on the file structure of the archive, type the following. The excluded directories that include copied files appear, but only the files that were restored contain data.
Example 21–8 Creating an Archive Excluding and Including Files and Directories by Using ListsIn this example, the archive is named archive5. It is copied from the master system but is not an exact copy. The exclude file contains the following list:
The include file contains the following list:
The content under the /aaa directory is excluded, but the content in /aaa/bbb/ccc remains.
To check on the file structure of the archive, type the following. The excluded directories that include copied files appear, but only the files that were restored contain data.
Example 21–9 Creating an Archive Excluding Files and Directories by Using a List and Restoring a DirectoryYou can combine options -x, -y, -X and -f. In this example, options -X and -y are combined. The archive is named archive5. It is copied from the master system but is not an exact copy. The exclude file contains the following list:
The -y option restores the /aaa/bbb/ccc directory. The following command produces the archive.
To check on the file structure of the archive, type the following. The excluded directories that include copied files appear, but only the files that were restored contain data.
Example 21–10 Creating an Archive Excluding and Including Files and Directories by Using a List With the -z OptionIn this example, the archive is named archive3. It is copied from the master system but is not an exact copy. The files and directories to be selected are included in filter1 file. Within the files, the directories are marked with a minus (-) or a plus (+) to indicate which files to exclude and restore. In this example, the directory /aaa is excluded with a minus and the subdirectory /aaa/bbb/ccc is restored with a plus. The filter1 file contains the following list.
The following command produces the archive.
To check on the file structure of the archive, type the following command. The excluded directories that include copied files appear, but only the files that were restored contain data.
Example 21–11 Creating an Archive From an Alternate Boot EnvironmentIn this example, the archive is named archive4. It is copied exactly from the master system and then compressed. The archive is an exact duplicate of the master system and stored in archive4.flar. The -R option is used to create the archive from another directory tree.
Example 21–12 Creating an Archive and Adding Keywords to Describe the ArchiveIn this example, the archive is named archive3. This archive is copied exactly from the master system and then compressed. Options add descriptions to the archive identification section, which can help you to identify the archive later. For information on keywords, their values, and formats, see Solaris Flash Keywords.
After the archive is created, you can access the identification section that contains the detailed description. An example of an identification section follows.
To Create a Solaris Flash Differential Archive With an Updated Master ImageBefore creating a differential archive, you need two images to compare: an unchanged master image and an updated master image. One image is the unchanged master image that has been kept unchanged. This image was stored and needs to be accessed. The second image is the unchanged master image that is updated with minor changes. The root (/) file system is the default for the new image, but you can access this image if it has been stored elsewhere. After you have the two images, you can create a differential archive, which contains only the differences between the two images. The differential archive can then be installed on clones that were installed previously with the unchanged master image.
Examples—Creating a Differential ArchiveExample 21–13 Creating a Differential Archive With the New Master Image On the Master SystemIn this example, the directory for unchanged master image is named unchanged_master1. The new master image that contains changes is the root (/) directory. The new master image is compared to the unchanged master image and the resulting differential archive is then compressed. The differential archive is stored in diffarchive1.flar file. The archive contains files that are to be deleted, changed, or added when installed.
Example 21–14 Creating a Differential Archive With the Images Stored on an Inactive Boot EnvironmentIn this example, the unchanged master image, unchanged_master1, is stored on an inactive boot environment and is accessed by mounting the boot environment. The new master image is the root (/) directory. The new master image is compared to the unchanged master and the resulting differential archive is then compressed. The archive is stored in diffarchive4.flar. The archive contains files that are to be deleted, changed, or added when installed.
To Create a Solaris Flash Differential Archive By Using Solaris Live UpgradeTo manage system updates, you can use Solaris Live Upgrade to copy the operating environment, which creates a new boot environment. This copy can be compared to the master system that has been updated with minor changes. The resulting Solaris Flash differential archive can then be installed on clone systems. For more information about Solaris Live Upgrade, see Chapter 32, Solaris Live Upgrade (Topics).
Example 21–15 Creating a Differential Archive by Using Solaris Live UpgradeIn this example, master_BE is the name of the current boot environment. copy_BE is the name of the new boot environment. The file systems root (/) and /usr are placed on s0 and s3. The lustatus command reports that the new boot environment copy is complete. The SUNWman package is added to the master system. After the master system is updated by adding the SUNWman package, the flarcreate command creates a differential archive by comparing the changed master and the unchanged new boot environment.
Install the differential archive on clone systems. For procedures about installing an archive, see To Prepare to Install a Solaris Flash Archive With a Custom JumpStart Installation. Figure 21–1 shows the creation of the new boot environment by using the lucreate command. Figure 21–1 Creating a New Boot Environment by Using Solaris Live Upgrade
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||