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 |
Description |
For Instructions |
---|---|---|
Install your chosen software configuration on the master system |
Determine the configuration that meets your needs and use any of the Solaris installation methods to install the master system. | |
(Optional) Create customization scripts |
Determine if you need to create scripts to do the following:
| |
Create the Solaris Flash archive |
Use the flarcreate command to create an archive. |
To Create a Solaris Flash Archive for an Initial Installation |
(Optional) Save a copy of the archive |
Keep a copy of the archive for future comparison to update a clone system with a differential archive. |
To Create a Solaris Flash Archive for an Initial Installation |
Table 3–2 Task Map: Creating a Solaris Flash Archive to Update a Clone System
Task |
Description |
For Instructions |
---|---|---|
Prepare master image |
Make changes to the unchanged master image such as adding or deleting packages or installing patches. | |
(Optional) Create customization scripts |
Determine if you need to create scripts to do the following:
| |
Create the Solaris Flash differential archive |
|
To Create a Solaris Flash Differential Archive With an Updated Master Image |
You 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 OS 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 that is for updating the original master image and creating a differential archive, see To Create a Solaris Flash Differential Archive With an Updated Master Image.
Identify the system configuration that you want to install.
With the use of the Solaris installation programs, install the Solaris OS on the master system. For a discussion of the different installation program , refer to Choosing a Solaris Installation Method in Solaris Express Installation Guide: Planning for Installation and Upgrade.
Customize your Solaris installation in any of the following ways:
Delete software.
Add software.
Modify configuration files.
Add support for peripheral devices on the clone system.
You can create custom scripts or use the flarcreate command to create the archive.
To create custom scripts, see Creating Customization Scripts.
To create the archive, see Creating a Solaris Flash Archive.
Scripts can customize the archive. Use these scripts for the following purposes:
A precreation script validates the archive at creation time and prepares the archive for later customization, especially differential archives. This script also can create a user-defined section in the archive.
A predeployment script validates the archive during installation and prepares the archive for later customization.
A postdeployment script reconfigures a new system image on a clone system.
A reboot script processes a final reconfiguration after the system is rebooted.
For guidelines about creating scripts, see Guidelines for Creating a Custom Script.
This script runs during archive creation. The script has various uses.
Validates the contents and the integrity of the software. The script fails the archive creation if the integrity is broken.
Prepares products for later customization on clone system.
Registers other installation scripts dynamically during archive creation.
Adds a message to the flash-creation summary file. The message must be short and record only that scripts were started and finished and the results. You can view the results in the summary section.
Create the precreation script. Follow the guidelines that are described in Guidelines for Creating a Custom Script.
Store the script in the /etc/flash/precreation directory.
The following examples are excerpts from a precreation script.
To log the start time in the summary section, use the following example:
echo "MyApp precreation script started">> $FLASHDIR/summary
To check the software integrity, use the flcheck command. This command cannot be used at the command line. The syntax for this command is as follows:
flcheck software component files and directories ...| - |
For example, to validate the files and directories, use the following example:
flcheck software component files and directories If Not in selection - refuse creation echo "Myapp Integrity Damage">>$FLASHDIR/summary
Or, to keep new files and directories that are unexpected and not fail the archive creation, use the following example:
flcheck software component files and directories If Not in selection include by force flinclude software component
To register deployment scripts and data, use the following example:
To see application-specific data in a user-defined section, use the following example:
cp custom section $FLASHDIR/custom_sections/MyApp
To log the success of the installation in the summary section, use the following example:
echo "product one flash preparation started." >>$FLASH_DIR/summary ... echo "product one flash preparation finished successfully">>$FLASH_DIR/summary
#!/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
A 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.
Must be line oriented
Must terminate with newline (ASCII 0x0a) characters
Can have unlimited length of individual lines
Must encode binary data by using base64 or a similar algorithm
This 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.
Create the predeployment script. Follow the guidelines that are described in Guidelines for Creating a Custom Script.
Store the script in one of the following directories.
For archive validation, store in the /etc/flash/predeployment directory.
If you are referencing with a precreation script, store in the $FLASH_DIR/preinstall directory.
If you are preserving configurations on a clone system, provide the path to the script that is stored on the clone system with the local_customization keyword in the JumpStart profile.
#!/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
This 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.
Not all log files need a script for cleanup. Log files in /var/tmp can be excluded when the archive is created.
Create the postdeployment script. Follow the guidelines that are described in Guidelines for Creating a Custom Script.
Store the script in one of the following directories.
To affect all clone systems, store the script in the /etc/flash/postdeployment directory.
To affect only a local clone system, provide the path to the script that is stored on the clone system with the local_customization keyword in the JumpStart profile.
#!/bin/sh $FLASH_DIR/TestApplication/clone_reconfiguration $FLASH_DIR/TestApplication/restore_data $FLASH_DIR/flash
This 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.
#!/bin/sh $FLASH_DIR/TestApplication/finalize_license
You 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.
A Solaris Flash archive cannot be properly created when a non-global zone is installed. The Solaris Flash feature is not compatible with the Solaris Zones partitioning technology. If you create a Solaris Flash archive, the resulting archive is not installed properly when the archive is deployed under these conditions:
The archive is created in a non-global zone
The archive is created in a global zone that has non-global zones installed
After you install the master system, create a Solaris Flash archive to use to install other systems.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.
Boot the master system and run it in as inactive a state as possible.
When possible, run the system in single-user mode. If that is not possible, shut down any applications that you want to archive and any applications that require extensive operating system resources.
You can create a Solaris Flash archive while the master system is running in multiuser mode, single-user mode, or while booted from one of the following:
Solaris Operating System DVD.
Solaris Software - 1 CD.
An image of the Solaris Software. If you are using CD media, the image could include the Solaris Languages CDs if needed.
To create the archive, use the flarcreate command.
# flarcreate -n name options path/filename |
The name that you give the archive. The name you specify is the value of the content_name keyword.
For a description of options, see flar Command.
The path to the directory in which you want to save the archive file. If you do not specify a path, flarcreate saves the archive file in the current directory.
The name of the archive file.
If the archive creation is successful, the flarcreate command returns an exit code of 0.
If the archive creation fails, the flarcreate command returns a nonzero exit code.
Make a copy of the archive and save it. The copy can be used in the future to update a clone system with a differential archive.
File 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:
/aaa/bbb/ccc/ddd /aaa/bbb/fff /aaa/eee /ggg |
Use the flarcreate 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.
In this example, the archive is named archive1. This archive is copied exactly from the master system and then compressed. The archive is an exact duplicate of the master system and is stored in archive1.flar.
# flarcreate -n archive1 -c archive1.flar |
To check the file structure of the archive, type the following.
# flar info -l archive1.flarlost+found export export/home export/home/lost+found var var/sadm var/sadm/install var/sadm/install/admin var/sadm/install/admin/default var/sadm/install/logs var/sadm/install/contents var/sadm/install/.lockfile var/sadm/install/.pkg.lock var/sadm/pkg var/sadm/pkg/SUNWocfd var/sadm/pkg/SUNWocfd/install var/sadm/pkg/SUNWocfd/install/copyright var/sadm/pkg/SUNWocfd/save var/sadm/pkg/SUNWocfd/save/pspool var/sadm/pkg/SUNWocfd/save/pspool/SUNWocfd ..... ..... usr/bin/sparcv7 usr/bin/sparcv7/savecore usr/bin/sparcv7/gcore .... .... usr/lib/diff3prog usr/lib/madv.so.1 usr/lib/mpss.so.1 usr/lib/cpu usr/lib/cpu/sparcv8plus .... .... devices/pseudo/udp6@0:udp6 devices/pseudo/udp@0:udp devices/pseudo/tcp@0:tcp devices/pseudo/iwscn@0:iwscn devices/pseudo/wc@0:wscons devices/pseudo/tcp6@0:tcp6 devices/pseudo/sctp6@0:sctp6 var/fm/fmd/ckpt var/fm/fmd/rsrc kernel/drv/st.conf kernel/drv/st.conf kernel/drv/st.conf kernel/drv/st.conf # |
In this example, the archive must be a cpio archive because of backward compatibility issues. The default pax copy method is not used, but the -L cpio option is used to create a cpio archive. When you use the -L cpio option, individual files cannot be over 4 Gbytes. The archive is named archive1. This archive is copied exactly from the master system and then compressed. The archive is an exact duplicate of the master system and is stored in archive1.flar.
# flarcreate -L cpio -n archive1 -c archive1.flar |
To check the file structure of the archive, type the following.
# flar info -l archive1.flar aaa aaa/bbb aaa/bbb/ccc aaa/bbb/ccc/ddd aaa/bbb/fff aaa/eee aaa/eee ggg |
In this example, the archive is named archive4. This archive is copied exactly from the master system and then compressed. The archive is an exact duplicate of the master system and is stored in archive4.flar. The -R option is used to create the archive from another directory tree.
# flarcreate -n archive4 -c -R /x/yy/zz archive4.flar |
In 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 about keywords, their values, and formats, see Solaris Flash Keywords.
# flarcreate -n archive3 -i 20000131221409 -m pumbaa \ -e "Solaris 8 Print Server" -a "Mighty Matt" -U "Internal Finance" \ -T server archive3.flar |
After the archive is created, you can access the archive identification section that contains the detailed description. An example of an archive identification section follows.
section_begin=identification files_archived_method=pax files_compressed_method=compress files_archived_size=259323342 files_unarchived_size=591238111 creation_date=20000131221409 creation_master=pumbaa content_name=Finance Print Server content_type=server content_description=Solaris 8 Print Server content_author=Mighty Matt content_architectures=sun4u creation_node=pumbaa creation_hardware_class=sun4u creation_platform=SUNW,Sun-Fire creation_processor=sparc creation_release=5.9 creation_os_name=SunOS creation_os_version=s81_49 x-department=Internal Finance |
In this example, the archive is named archive2. This archive 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.
# flarcreate -n archive2 -x /aaa -y /aaa/bbb/ccc archive2.flar |
To check 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.
# flar info -l aaa aaa aaa/bbb/ccc aaa/bbb/ccc/ddd aaa/bbb ggg |
In this example, the archive is named archive5. This archive is copied from the master system but is not an exact copy.
The exclude file contains the following list:
/aaa |
The include file contains the following list:
/aaa/bbb/ccc |
The content under the /aaa directory is excluded, but the content in /aaa/bbb/ccc remains.
# flarcreate -n archive5 -X exclude -f include archive5.flar |
To check about 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.
# flar info -l archive5.flar aaa aaa/bbb/ccc aaa/bbb/ccc/ddd aaa/bbb ggg |
You can combine options -x, -y, -X and -f. In this example, options -X and -y are combined. The archive is named archive5. This archive is copied from the master system but is not an exact copy.
The exclude file contains the following list:
/aaa |
The -y option restores the /aaa/bbb/ccc directory. The following command produces the archive.
# flarcreate -n archive5 -X exclude -y /aaa/bbb/ccc archive5.flar |
To check about 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.
# flar info -l archive5.flar aaa aaa/bbb aaa/bbb/ccc aaa/bbb/ccc/ddd ggg |
In 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.
- /aaa + /aaa/bbb/ccc |
The following command produces the archive.
# flarcreate -n archive3 -z filter1 archive3.flar |
To check 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.
# flar info -l archive3.flar aaa aaa/bbb aaa/bbb/ccc aaa/bbb/ccc/ddd ggg |
Before 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.
Prepare the master system with changes. Before changes are made, the master system should be running a duplicate of the original archive.
A copy of the unchanged master image must be kept protected from changes and available for mounting later.
Update the unchanged master image with any of the following changes.
Delete packages.
Add packages or patches.
Modify configuration files.
Add support for peripheral devices on the clone system.
(Optional) Create custom scripts. See Creating Customization Scripts.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.
Deliver the unchanged master image in a mount point.
If the unchanged master image is stored on an inactive boot environment, retrieve it by using the lumount command.
# lumount BE_name mountpoint |
Specifies the boot environment name where the unchanged master image is stored
Specifies a root (/) file system where the image is stored
In the following example, the inactive boot environment is named unchanged_master1. The mount point is the directory /a on the master system.
# lumount unchanged_master1 /a |
If the image is stored on a clone, mount the clone by using NFS.
On the master system, share the clone's root (/) file system and give the master root permissions on the clone system.
Use either the sharemgr utility or the share command as follows.
Starting with the 5/07 Developer release, the sharemgr utility introduces the concept of share groups. See sharemgr Command in System Administration Guide: Network Services.
# share -F nfs -o rw,root=master_system "/"
# sharemgr add-share -d master_system -s "/" default
# sharemgr set -P nfs -S sys -p rw="*" -s "/" default
# sharemgr set -P nfs -S sys -p root=master_system -s "/" default
master_system is the name of the master system.
On the master system, mount the clone.
# mount -F nfs clone_system:/ master_dir |
Specifies the name of the system to be mounted
Specifies the directory where the unchanged master image is stored
If you saved the image with the ufsdump command, use the ufsrestore command to retrieve a copy. For information about how to use these commands, see Chapter 27, UFS Backup and Restore Commands (Reference), in System Administration Guide: Devices and File Systems.
Create the differential archive.
# flarcreate -n archive_name -A unchanged_master_image_dir \ options path/filename |
Specifies the name that you give the archive. The archive_name you specify is the value of the content_name keyword. The name is listed in the archive-identification section.
Creates a differential archive by comparing a new system image with the image that is specified by the unchanged_master_image_dir argument. By default, the new system image is root (/). You can change the default with the -R option. unchanged_master_image_dir is a directory where the unchanged system image is stored or mounted through UFS, NFS, or the lumount command.
You can include and exclude some files by using the options for contents selection. For a list of options, see flar Command.
For a description of options, see flar Command.
Specifies the path to the directory in which you want to save the archive file. If you do not specify a path, flarcreate saves the archive file in the current directory.
Specifies the name of the archive file.
If the differential archive creation is successful, the flarcreate command returns an exit code of 0.
If the differential archive creation fails, the flarcreate command returns a nonzero exit code.
For procedures about installing an archive, see To Prepare to Install a Solaris Flash Archive With a Custom JumpStart Installation in Solaris Express Installation Guide: Custom JumpStart and Advanced Installations.
In 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.
# flarcreate -n diffarchive1 -A /a/unchanged_master1 -c diffarchive1.flar |
In 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.
# lumount unchanged_master1 /a # flarcreate -n diffarchive4 -A /a -c diffarchive4.flar |
To manage system updates, you can use Solaris Live Upgrade to copy the OS, 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 2, Solaris Live Upgrade (Overview), in Solaris Express Installation Guide: Solaris Live Upgrade and Upgrade Planning.
From the unchanged master system, create a new boot environment by using the lucreate command.
This new boot environment is an exact copy of the master system and can be used to create the differential archive.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.
Check the status of the two boot environments.
# lustatus copy_BE boot environment Is Active Active Can Copy Name Complete Now OnReboot Delete Status ------------------------------------------------------------------------ master_BE yes yes yes no - copy_BE yes no no yes - |
Update the master image with any of the following changes.
Delete packages.
Add packages or patches.
Modify configuration files.
Add support for peripheral devices on the clone system.
(Optional) Create custom scripts. See Creating Customization Scripts.
Create the differential archive.
Mount the newly created boot environment.
# lumount BE_name /a |
Create the differential archive by comparing the master system to the boot environment.
# flarcreate -n archive_name -A new_BE_dir\ options path/filename |
Specifies the name that you give the archive.
Creates a differential archive by comparing a new system image with the image that is specified by the new BE_dir argument.
For a list of options, see flar Command.
Specifies the path to the directory in which you want to save the archive file. If you do not specify a path, flarcreate saves the archive file in the current directory.
Specifies the name of the archive file.
Unmount the new boot environment.
# luumount copy_BE |
The flarcreate command returns an exit code.
If the creation is successful, an exit code of 0 is returned.
If a failure occurs, a nonzero exit code is returned.
Install the Solaris Flash differential archive by using a JumpStart profile.
The clone systems that are to be installed must be a duplicate of the original master system or the installation fails.
The following example profile installs a differential archive, test.diff, on the device c1t1d0s0.
JumpStart profile ----------------------- install_type flash_update archive_location http server /rw/test.diff root_device c1t1d0s0 |
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.
# lucreate -c master_BE -m /:/dev/dsk/c0t1d0s0:ufs \ -m /usr:/dev/dsk/c0t1d0s3:ufs -n copy_BE # lustatus # pkgadd SUNWman # lumount copy_BE /a # flarcreate -n test.diff -c -A /a /net/server/export/test.diff # luumount copy_BE |
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 in Solaris Express Installation Guide: Custom JumpStart and Advanced Installations.
The following image shows the creation of the new boot environment by using the lucreate command.