Setting up a noninteractive restore entails more work, but it can help quite a bit
during recovery. In addition to allowing the recovery to complete without interaction, a
noninteractive restore can also add the following features:
Noninteractive Setup Files
Jumpstart has been used for many years to automate the installation of Solaris.
Flash archive uses some of the same technology as Jumpstart; for example, it uses the
concept of the profile, rules, and sysidcfg files to provide
for a noninteractive restore from a flash archive image. Therefore, in addition to
creating your flash archive, you need to create these files to prepare for a
noninteractive restore. After creating these files, ensure that root is the owner of
each file and that permission on each is set to 644.
A
profile file specifies the filesystems
to be created, the disks they are created on, and the install method used during the
recovery. The profile can be named anything as long as the name of the profile is
specified in the rules file. Profiles can be
static or created dynamically via a begin script. Profiles that
are created dynamically by a begin script are called derived
profiles.
Here is an example of a static profile. A static profile contains several rows of
parameters followed by values, separated by whitespace. When creating a static
profile, ensure root owns the file and that permissions on the profile are set to 644.
The following parameters should be included in every profile created for use with
flash archive:
install_type
-
This should say flash_install
to indicate
this is a flash recovery. (Remember profiles are used for other things, such as
Jumpstart.)
archive_location
-
Specify where this unattended restore gets its data from. This can be either
local_tape
device_name file_#
or nfs
nfserver:/path/imagefile
.
partitioning
-
Since we are restoring from a flash archive, use explicit partitioning so
that you can create filesystems that support your flash recovery as well as your
overall recovery plan. When using the explicit
option, use the filesys
keyword to define and partition available disk space.
filesys
-
Specify one or more lines containing the names of the filesystems (and swap)
partitions. Each line must contain the keywords filesys
diskname
size
mountpoint
:
install_type flash_install
archive_location local_tape /dev/rmt/0n 1
partitioning explicit
filesys c0t0d0s0 7000 /
filesys c0t0d0s1 2000 swap
While this example shows an existing static profile that is copied to tape, a
begin script that can create a derived or custom profile on the fly during the
recovery process provides increased flexibility when restoring to systems with
dissimilar hardware. Examples of this flexibility include probing system devices,
prompting for user input when selecting and partitioning disks, and selecting which
tape drive will be used.
Like the profile, this script can be named
anything; it just has to be named in the rules
file.
#!/bin/sh
echo "install_type flash_install" > ${SI_PROFILE}
echo "archive_location local tape /dev/rmt/0n 1" >> ${SI_PROFILE}
echo "partitioning explicit" >> ${SI_PROFILE}
echo "filesys c0t0d0s0 7000 / " >> ${SI_PROFILE}
echo "filesys c0t0d0s1 2000 swap" >> ${SI_PROFILE}
Tip
When creating a begin script, you must use the ${SI_PROFILE}
variable as shown here.
Again, this is very basic, and there wouldn’t be much point to creating a script
like this one because it creates a profile just like our static example. However, with
a little creative scripting, you can turn a begin script into a very useful tool that
can probe system devices, check minimum disk sizes, and request user input for unknown
variables. For example, it can display a list of tape drive devices and ask the user
to specify which one she wants to use. More information on creating a begin script can
be found in the flash archive recovery documentation.
The
rules file specifies which profile,
begin scripts, and finish scripts are used during the restore process. A rules.ok file is created automatically after running the
check
command against your rules file. The layout of this file is as follows:
[keyword(s)] [keyword(s) value] [begin script] [profile] [finish script]
For example:
any - - standard -
This example states that any (or every) system should use the standard profile to
configure the restored system, with no begin or finish scripts. Jumpstart rules files can be a lot more complex and powerful. While
a rules file requires only one rule, you can
specify many rules for setting up systems based on configuration, architecture, and
more.
The
sysidcfg file contains information used
to configure the system during the restore process. Though not shown in the following
example (and generally not recommended from a security perspective), an encrypted root
password can also be included in the sysidcfg
file. For more information on using this option, refer to the Solaris Installation
documentation.
Here is an example of a sysidcfg file. The
keywords and their meanings are relatively straightforward.
system_locale=C
timezone=US/Pacific
network_interface=primary {hostname=sun2
default_route=192.168.1.253
ip_address=192.168.1.34
netmask=255.255.255.0
protocol_ipv6=no}
security_policy=NONE
name_service=NONE
timeserver=localhost
Creating a Noninteractive Tape Image
Once the image has been created, you can create a tape that can be used to perform a
bare-metal recovery. The following steps create a flash archive image on disk and copy
it to tape:
-
Create sysidcfg, rules, and profile (or begin script) files.
-
Run check
against the rules file to create rules.ok.
-
Create flash image on disk, using flar
create
.
Tip
If the check
script is not on your local
server, it can be run from or copied from the Solaris CD/DVD.
-
tar
sysidcfg, rules, rules.ok, and profile (or begin
script) files to the tape.
-
dd
the flash image to tape. Alternatively,
you can follow steps 1–4, then create the flash archive image directly to tape using
the flar
create
command.
The following is an example of this process starting with step 4:
# tar cvf /dev/rmt/0n rules rules.ok sysidcfg standard.profile
a rules 1 tape blocks
a rules.ok 1 tape blocks
a sysidcfg 1 tape blocks
a standard.profile 1 tape blocks
#dd if=sun2.flar of=/dev/rmt/0n obs=1024000