IUX - Golden images
There are two possible types of Golden Archives, the "newconfig state" and the "recovery state" golden archives.
The "newconfig state" golden archive replaces the system configuration files for default versions on "/usr/newconfig" during archive creation and includes every volume group and logical volume of the system.
The "recovery state" golden archive allows to customize the volume groups [ and | or ] file systems that will be included on the golden archive. Nonetheless, disable the capacity to change the configuration files to newconfig state.
Contents
Prepare the required space
Enough space to save the golden archive is required on the system. The storage file system should support file larger than 2 GB ("-o argefiles" using VxFS). It may be required to create logical volumes and filesystems as needed.
Example:
# lvcreate -L 4200 -n golden_depot /dev/vg00
Logical volume "/dev/vg00/golden_depot" has been successfully created with
character device "/dev/vg00/rgolden_depot".
Logical volume "/dev/vg00/golden_depot" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
# mkdir /image_depot
# /usr/sbin/newfs -F vxfs -o largefiles /dev/vg00/rgolden_depot
version 4 layout
524288 sectors, 524288 blocks of size 1024, log size 1024 blocks
unlimited inodes, largefiles not supported
524288 data blocks, 523072 free data blocks
16 allocation units of 32768 blocks, 32768 data blocks
# mount -o largefiles /dev/vg00/golden_depot /image_depot
Creating a "newconfig state" Golden Image
1. To determinine the required space to storage a "newconfig state" golden archive you need to evaluate the current utilize space of the mounted file systems. This script can help to obtained the data:
export total=0
for used in $(bdf | grep -v used | awk '{print $3}')
do
total=$(expr $total + $used)
done
printf "Total: %d KB\nEstimate archive size (2:1 compression): %d KB\n" \
$(expr $total \/ 1024) $(expr $total \/ 1024 \/ 2)
Example:
# export total=0
# for used in $(bdf | grep -v used | awk '{print $3}')
> do
> total=$(expr $total + $used)
> done
# printf "Total: %d KB\n\Estimate archive size (2:1 compression): %d KB\n" \
> $(expr $total \/ 1024) $(expr $total \/ 1024 \/ 2)
Total: 8644 KB
Estimate archive size (2:1 compression): 4322 KB
2. Use the "make_sys_image" command to create the golden image. Use the following command sintax: "/opt/ignite/data/scripts/make_sys_image -v -s local -d /<destiny>"
- -v verbose
- -s hostname of the server to send the archive to or local if the destination is a local file system
- -d destination directory
- <destiny>: [ directory | file system ] to store the golden archive.
Example:
# /opt/ignite/data/scripts/make_sys_image -v -s local -d /image_depot
3. Verify the created golden archive.
# ls -l /image_depot
total 2668736
-rw-r--r-- 1 root sys 1366377086 Jun 20 12:16 delta.gz
drwxr-xr-x 2 root root 96 Jun 20 11:53 lost+found
-rw-r--r-- 1 root sys 6564 Jun 20 12:16 make_sys_image.log
Creating a "recovery state" Golden Image
1. Create the file_content
To include volume groups in the "file_content" use the "inc_entire <vgname> statement. Volume group vg00 is normally included because is the default place for the operating system.
inc_entire <vg_name>
Use the "exclude <mount_point>" statement to exclude specific file systems from the golden archive.
exclude <mount_point>
For additional information check "Including and Excluding From Archive" section of the document.
Example:
# vi /golden_image/file_content
inc_entire vg00
exclude /var/tmp/image
exclude /software
:wq
- Note: Include other volume groups or file systems only if desired to add to the golden archive.
2. Preview the file_content
Make sure the volume groups and file system are included.
# /opt/ignite/lbin/list_expander -d -f /var/tmp/image/file_content
In? dsk/vg name minor# Associated disks
1 v /dev/vg00 0x00 /dev/dsk/c3t6d0 /dev/dsk/c3t5d0
0 v /dev/vg01 0x01 /dev/dsk/c5t6d0
- 1 = included
- 0 = not included.
3. Preview the space needed for the golden image.
Check that the space available allow us to create the golden archive. This will needed for the "-a" flag of the "make_sys_image" command later.
# /opt/ignite/lbin/list_expander -s -f /var/tmp/image/file_content
5727790
- Note: Keep in mind the number it will be use later on. This number is in KB
4. Create the file_list
Use the following command to create the file_list. This file content the list all the files that will be added to the image.
The file is create when redirecting standard output in to a some file (in this case file_list)
# /opt/ignite/lbin/list_expander \
-f /var/tmp/image/file_content > /var/tmp/image/file_list
5. Preview the golden image to for see errors
This command allow us to check for errors or problems.
# /opt/ignite/data/scripts/make_sys_image \
-s local -d <path> -R -g <path_to_file>/file_list \
-a <size_of_image> -p -u
- -s = source, local for current server
- -d = destination <path>, of the image
- -R = for make a recovery image
- -g = file_list <path_to_file>
- -a = the size of the image, look step 3.
- -p = To make just a preview of the process
- -u = To check if there is enough capacity
Example:
# /opt/ignite/data/scripts/make_sys_image \
-s local -d /var/tmp/image/archives -R -g /var/tmp/image/file_list \
-a 5727790 -p -u
* Preparing to preview the creation of a system archive.
* Testing for necessary pax patch.
* LIF boot disk /dev/dsk/c3t5d0 is ready to be archived.
The LIF files to be archived are:
AUTO
* The root disk's LIF volume will be copied.
* The archive is estimated to reach 2863895 kbytes.
* Free space on /var/tmp/image/archives
after archive should be about 5521535 kbytes.
+===================================+
| |
| PREVIEW MODE, NO ARCHIVE CREATED. |
| |
+===================================+
* Archiving contents of c3650 via tar to
/var/tmp/image/archives/c3650.gz.
* Preview of the creation of a system archive complete.
6. Create Golden Image
/opt/ignite/data/scripts/make_sys_image \
-s local -d <path> -R -g <path_to_file>/file_list \
-a <size_of_image> -w <path_to_file>/$(hostname).log
- -s = source, local for current server
- -d = destination <path>
- -R = for make a recovery image
- -g = file_list <path_to_file>
- -a = the size of the image, look at step #3.
- -u = To check if there is enough capacity
- -w = To make a log of the Image Creation
Example:
# /opt/ignite/data/scripts/make_sys_image \
-s local -d /var/tmp/image/archives -R -g /var/tmp/image/file_list \
-a 5727790 -w /var/tmp/image/$(hostname).log
* Preparing to create a system archive.
* Testing for necessary pax patch.
* Archiving contents of c3650 via tar to
/golden_image/c3650.gz.
* Creation of system archive complete.
NOTE: The following files are in the list of files that were on the
system, but they are no longer present. These files are not
included in the backup:
/opt/hpws/apache/logs/httpd.pid
/var/opt/iexpress/mysql/c3650.pid
Including and Excluding From Archive
man make_tape_recovery
Including and Excluding From Archive
The contents of the archive may be controlled from the contents file
(see -f). The full path for the contents file is
/var/opt/ignite/clients/0xLLA/recovery/archive_content on the Ignite-
UX Server. This file consists of keyword identifiers which specify
the inclusion of files, directories, or entire disks and volume
groups. The keyword identifiers also instruct make_tape_recovery
whether to follow mount points when creating the system recovery
archive. The contents file has the following keyword identifiers:
include filename | directory
Includes the specified filename or directory and all
subdirectories and associated files. Mount points are not
crossed and symbolic links are not followed. Note, file
names may NOT end with a space.
inc_cross filename | directory
Include the specified filename or directory and all
subdirectories and files contained underneath
subdirectories. Local mount points are crossed but symbolic
links are not followed. Note, file names may NOT end with a
space.
inc_entire volume group | disk
Include the entire specified volume group (e.g., "vg00") or
disk (block device - e.g., "/dev/dsk/c0t5d0"). Do not
specify a disk if it is part of a volume group.
inc_all_affected
Is equivalent to using -A option. Based on the files that
are specified for inclusion, this option determines which
disk(s) and/or volume group(s) contain those specified
files, and includes all files from those disk(s) and/or
volume group(s) in the archive.
exclude filename | directory
Exclude the specified filename or directory and all
subdirectories and files contained under the subdirectories.
Note, file names may NOT end with a space.
Reference
- Ignite-UX Administration Guide for HP-UX 11i (5992-3336) - Chapter 9 Golden Images
http://docs.hp.com/en/5992-3336/5992-3336.pdf
- man make_sys_image
Return Ignite-UX_Handbook