Automatically
Mirroring the Boot Disk with Custom JumpStart
Matthew Cheek
One of the unsung heroes of the Solaris Operating Environment
(OE) is the Custom JumpStart facility. This powerful framework permits
a Solaris systems administrator to automatically install or upgrade
multiple systems based on pre-defined Profiles. This is especially
valuable in environments with many, similarly (or identically) configured
servers as it can result in absolute consistency across machines.
Once the JumpStart server components are properly provisioned, a
completely automated, hands-free Solaris installation is possible.
In addition to automating the basics of a Solaris installation,
such as partitioning disks, selecting software groups, and configuring
network interfaces, Custom JumpStart also provides for the execution
of pre-installation and post-installation scripts, which permits
absolute customization of the install process.
Due to a requirement to quickly and consistently install and deploy
many dozens of similar servers, we implemented a Custom JumpStart
environment and developed a suite of custom post-installation (or
Finish) scripts to complete local customization, such as installing
additional packages and patches, configuring the automounter, disable
unnecessary services, etc. Because our standard configuration is
a mirrored boot disk using Solaris Volume Manager, we also wanted
a solution for automating this via the Custom JumpStart framework.
Unfortunately, Custom JumpStart for Solaris 9 12/03 or earlier does
not natively support the automatic mirroring of a system's boot
disk with the Solaris Volume Manager as part of a Custom JumpStart
installation. Thus, further manual administrative work was necessary
at the conclusion of the Custom JumpStart installation to implement
a mirrored boot configuration. Ultimately, a Custom JumpStart Finish
script was developed for this purpose.
Sun finally recognized this longstanding deficiency and, with
the release of Solaris 9 4/04 (Update 6), Custom JumpStart now supports
automatic creation of mirrored filesystems using the Solaris Volume
Manager during a Custom JumpStart installation.
This article will introduce and describe this new Custom JumpStart
feature. It is assumed that the reader is already familiar with
the configuration, provisioning, and use of a Custom JumpStart environment.
In the May 2000 issue of Sys Admin, Peter van der Weerd's
article "Building a JumpStart Server for Solaris" (http://www.samag.com/documents/s=1165/sam0005a/)
provided an excellent introduction to JumpStart for the uninitiated.
For more detailed coverage, see the References at the end of the
article or review the Installation Guide for your specific Solaris
release. Solaris 9 on SPARC will be the subject OE for this discussion,
but Solaris x86 OE is also applicable.
Finally, for those environments still using versions of Solaris
earlier than Solaris 9 4/04, our previously developed Custom JumpStart
Finish script to automatically mirror the boot disk using SVM will
be presented. Extending this script for Veritas Volume Manager (VxVM)
boot disk mirroring will be left as an exercise to the reader.
Automatic Mirroring with Custom JumpStart Profiles
Sun added support for automatically mirroring filesystems during
a Custom JumpStart installation by extending the Custom JumpStart
Profile mechanism. More specifically, there is a brand new metadb
Profile keyword and the filesys Profile keyword was enhanced
to permit the system administrator to specify the location of the
required SVM state database replicas and which filesystems to mirror.
Consider this straightforward example Custom JumpStart Profile:
# profile keyword profile value(s)
# --------------- ----------------
install_type initial_install
system_type server
cluster SUNWCall
partitioning explicit
filesys c0t0d0s0 free /
filesys c0t0d0s1 512 swap
filesys c0t0d0s3 1024 /var
This profile will result in the initial server installation of the
entire distribution of the Solaris OE using the first disk on the
first (or only) SCSI channel as the boot disk. Further, the boot disk
will be explicitly partitioned with a 512-MB swap partition, a 1024-MB
/var partition, and all the remaining space assigned to the root partition.
The two resulting partitions (i.e., / and /var) will be the standard
Solaris UFS filesystem and not be mirrored automatically, regardless
of whether there are other suitable disks in the system. When the
following two commands are run on a system installed from this example
profile, the result is obvious:
# df -F ufs -k
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c0t0d0s0 15847503 756024 14933004 5% /
/dev/dsk/c0t0d0s3 1018191 7183 949917 1% /var
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0t0d0s1 32,1 16 1050752 1050752
Before Solaris 9 4/04, it would then be necessary for the administrator
to manually configure SVM to complete any desired mirroring including
the additional requisite reboot to mirror the root partition. (Alternatively,
the Custom JumpStart Finish script presented later in this article
could be used to automatically mirror filesystems.)
Simply by making a few modifications to our example Profile, however,
Custom JumpStart on Solaris 9 4/04 and later will automatically
mirror our filesystems:
# profile keyword profile value(s)
# --------------- ----------------
install_type initial_install
system_type server
cluster SUNWCall
partitioning explicit
filesys mirror c0t0d0s0 c0t1d0s0 free /
filesys mirror c0t0d0s1 c0t1d0s1 512 swap
filesys mirror c0t0d0s3 c0t1d0s3 1024 /var
metadb c0t0d0s7
metadb c0t1d0s7
This profile will do exactly the same as before, but with the additional
entries the resulting system will have all three partitions (the /
and /var filesystems and the swap partition) mirrored with SVM. Additionally,
the required SVM state database replicas will be placed on slice seven
of the specified disks. To show the results of this profile, the following
commands are run:
# df -F ufs -k
Filesystem kbytes used avail capacity Mounted on
/dev/md/dsk/d6 15847503 756001 14933027 5% /
/dev/md/dsk/d3 1018191 7177 949923 1% /var
# swap -l
swapfile dev swaplo blocks free
/dev/md/dsk/d0 85,0 16 1050752 1050752
# metastat -p
d6 -m d7 d8 1
d7 1 1 c0t0d0s0
d8 1 1 c0t1d0s0
d3 -m d4 d5 1
d4 1 1 c0t0d0s3
d5 1 1 c0t1d0s3
d0 -m d1 d2 1
d1 1 1 c0t0d0s1
d2 1 1 c0t1d0s1
# metadb
flags first blk block count
a m p luo 16 8192 /dev/dsk/c0t0d0s7
a p luo 8208 8192 /dev/dsk/c0t0d0s7
a p luo 16400 8192 /dev/dsk/c0t0d0s7
a p luo 16 8192 /dev/dsk/c0t1d0s7
a p luo 8208 8192 /dev/dsk/c0t1d0s7
a p luo 16400 8192 /dev/dsk/c0t1d0s7
These filesys and metadb Profile keyword/value examples demonstrate
their minimum form. Both keywords have additional, optional parameters
that provide greater configurability to the administrator. For instance,
in the previous example profile, Custom JumpStart automatically assigned
SVM metadevice names to the mirrors and sub-mirrors starting with
d0 and incrementing sequentially. This is the default behavior and,
in many cases, may be acceptable. However, it may be desirable to
name the mirrors explicitly and the following profile fragment demonstrates
how:
filesys mirror:d10 c0t0d0s0 c0t1d0s0 free /
filesys mirror:d20 c0t0d0s1 c0t1d0s1 512 swap
filesys mirror:d30 c0t0d0s3 c0t1d0s3 1024 /var
This profile will name the /, swap, and /var SVM mirror metadevices
d10, d20, and d30, respectively. Unfortunately, Custom JumpStart does
not provide the ability to explicitly name the sub-mirrors and their
names will be automatically assigned as before, starting with the
first unused d- number (in this case, d0). The resulting configuration
will be:
# metastat -p
d10 -m d7 d8 1
d7 1 1 c0t0d0s0
d8 1 1 c0t1d0s0
d30 -m d4 d5 1
d4 1 1 c0t0d0s3
d5 1 1 c0t1d0s3
d20 -m d1 d2 1
d1 1 1 c0t0d0s1
d2 1 1 c0t1d0s1
Furthermore, without specifying any optional parameters, the metdb
profile keyword creates three SVM replicas that are 4 MB in size.
If fewer (or more) replicas and/or a different size are desired, use
a metadb command similar to the following:
metadb c0t0d0s7 size 16384 count 5
This will create five replicas on an 8-MB slice 7. (The size value
is specified in 512-byte disk blocks.)
Note that Custom JumpStart only permits the creation of SVM
single-slice concatenations (RAID 0) and mirrors of single-slice
concatenations (RAID 1). Creation of other SVM objects via Custom
JumpStart -- such as multiple-slice concatenations (Stripes) and
RAID5 volumes -- are not supported.
As a final example, here is a more complex profile:
# profile keyword profile value(s)
# --------------- ----------------
install_type initial_install
system_type server
cluster SUNWCprog
partitioning explicit
metadb c0t0d0s7 size 16384 count 4
metadb c0t1d0s7 size 16384 count 4
filesys mirror:d10 c0t0d0s0 c0t1d0s0 auto /
filesys mirror:d20 c0t0d0s1 c0t1d0s1 512 swap
filesys mirror:d30 c0t0d0s3 c0t1d0s3 2048 /usr
filesys mirror:d40 c0t0d0s4 c0t1d0s4 1024 /var
filesys mirror:d100 c0t0d0s5 c0t1d0s5 free /export/home
This profile will result in an initial server installation of the
Solaris developer system support software group. Four replicas each
of the SVM state database are created on an 8-MB slice 7 of the specified
disks. Additionally, Custom JumpStart will create a mirrored root,
swap, /usr, /var, and /export/home partition named d10, d20, d30,
d40, and d100, respectively. The swap, /usr, and /var partitions are
explicitly sized; the root partition is automatically sized by JumpStart
based on the selected software, and all remaining unused space is
assigned to the /export/home partition.
Automatic Mirroring with a Custom JumpStart Finish Script
If you are unable to take advantage of the new automatic mirroring
features introduced in the Solaris 9 4/04 edition of Custom JumpStart,
the only option for automatic mirroring is a Custom JumpStart Finish
script. Such a Finish script will automatically execute the steps
necessary to implement the desired SVM mirrored configuration. To
simplify this Finish script, the strategy we adopted was to define
a reference configuration with regard to partitioning, filesystem
layout, and SVM layout and then code the script to implement that
configuration. Here is a summary of that reference configuration
codified in the svm.finish script in Listing 1:
The root filesystem resides on slice 0 of the boot disk.
The swap partition resides on slice 1 of the boot disk.
The /var filesystem resides on slice 3 of the boot disk.
The next available disk is selected as the mirror disk.
Three SVM state database replicas are placed on each slice
7 of the boot and mirror disk.
The boot/system metadevice naming convention is as follows:
Partition |
Mirror |
Submirrors |
root |
d10 |
d11, d12 |
primary swap |
d20 |
d21, d22 |
var |
d30 |
d31, d32 |
The use of this Finish script depends on a properly configured
Profile and rules file plus several additional rules file entries.
Assuming the target client is a Sun Enterprise 250 server with
a pair of internal disks, our previously introduced example profile
is suitable:
# Profile Name: e250.profile
#
# profile keyword profile value(s)
# --------------- ----------------
install_type initial_install
system_type server
cluster SUNWCall
partitioning explicit
filesys c0t0d0s0 free /
filesys c0t0d0s1 512 swap
filesys c0t0d0s3 1024 /var
filesys c0t0d0s7 16
Notice that we must explicitly reserve slice 7 for the SVM state
database replicas. By not specifying a filesystem mount point or
type for this slice, the partition is defined as a raw slice without
a filesystem.
The associated Custom JumpStart rules entry for the above example
is:
model SUNW,Ultra-250 - e250.profile svm.finish
In addition to specifying the Finish script in the entry, it is
necessary to add the following probe commands to the beginning of
the rules file:
probe disks
probe rootdisk
Once these Custom JumpStart files are provisioned on the JumpStart
server and the Finish script is in place, add the install client
with the add_install_client command and start the Custom JumpStart
installation. After completing the normal Custom JumpStart installation
process, our Finish script will be run, which does the following
steps:
- A set of variables define the slices and SVM metadevice names.
- The BOOTDISK variable is assigned with the cWtXdY value of
the rootdisk.
- The DISKLIST variable is assigned with a space-delimited
list of all the disks on the install client.
- The first non-rootdisk is selected as the mirrordisk. This
script may fail if the selected mirrordisk is smaller than the
rootdisk.
- A Solaris boot script to do the initial SVM configuration
is created using the "here document" technique. This first boot
script's purpose is to:
- Copy the rootdisk's partition layout to the mirrordisk.
- Create three SVM state database replicas on slice 7 of the
rootdisk and mirror disk.
- Create the SVM submirror and mirror metadevices for swap
and /var.
- Update the client's vfstab to reflect the new device names.
- Create the secondary Solaris boot script to attach the SVM
mirrors after the subsequent reboot.
- Create and activate the root SVM submirror and mirror metadevices.
- Move the script out of the way and reboot.
Summary
This article has presented two methods for automatically mirroring
an install client's boot disk via the Sun Solaris Custom JumpStart
framework. Later versions of Custom JumpStart natively support
this automatic mirroring, albeit with some limitations. Through
the use of a custom Finish script, a Solaris systems administrator
may completely control the mirror process. In fact, the Finish
script presented here works without change within the latest Custom
JumpStart version framework.
I hope this article will encourage you to consider the use of
Custom JumpStart within your environment, especially as a method
of automating Solaris installations. The example Finish script
demonstrates some useful scripting techniques that you may be
able to apply to Finish scripts of your own.
Legal Statement
This work represents the view of the author and does not necessarily
represent the views of the University of Pittsburgh Medical Center.
UPMC does not endorse, warrant, or otherwise take responsibility
for the contents of this work.
References
John S. Howard and Alex Noordergraaf, JumpStart Technology:
Effective Use in the Solaris Operating Environment, Prentice
Hall PTR, 2001.
Paul Anthony Kasper and Alan L. McClellan, Automating Solaris
Installations: A Custom JumpStart Guide, Prentice Hall PTR,
1995.
Chris Josephes, A Framework for JumpStart Begin/Finish Scripts,
Sys Admin Oct 2001 (vol 10, no. 10)
Matthew Cheek is a senior Unix systems administrator with
experience in the healthcare, telecommunications, software development,
and manufacturing industries and has installed, configured, managed,
and written about Unix systems since 1988. He is the lead author
of Tru64 UNIX System Administrator's Guide from Digital Press.
Matt is currently at the University of Pittsburgh Medical Center
(UPMC) in Pittsburgh, Pennsylvania and can be reached at: cheekmp@upmc.edu.
He spends his free time with his wife, Sondra, and their three
children, Stephanie, Nickolas, and Nathan.
|