What Is It?
Live upgrade is a feature of solaris (since version 2.6 - this tutorial has been tested on Solaris 9 and 10) that allows the operating system to be cloned to an offline partition (or partitions), which can then be upgraded with new OS patches, software, or even a new version of the operating system. The system administrator can then reboot the system on the newly upgraded partition. In case of problems, it is easy to revert back to the original partition / version via a single live upgrade command followed by a reboot. Live upgrade is especially useful because Sun does not officially support installing OS patches to active partitions - patching while in single user mode or to a non-active live upgrade partition.How It Works
Live Upgrade requires you to have multiple partitions on your boot drive - one set of partitions is "active" and the other is "inactive". These sets of partitions are known as "boot environments", or BE's. The lucreate command is used to create and initially populate the secondary partition(s). The lumake command can be used to subsequently populate (clone) a boot environment. Luactivate is used to choose which boot environment will be active upon next reboot. Lastly, the lumount command can be used to mount live upgrade partitions / boot environments so that they can be patched or otherwise upgraded.An Example:
This example assumes that your boot drive (or drives - this will also work in conjunction with ODS / Online Disk Suite) are partitioned as follows:Current partition table (original):
Total disk cylinders available: 38307 + 2 (reserved cylinders)
Part Size
0 9.77GB
1 5.86GB
2 74.53GB
3 3.91GB
4 41.31GB
5 9.77GB
6 3.91GB
7 13.95MB
You'll notice that slices 0 and 5 are both 9.77GB, and slices 3 and 6 are both 3.91GB. We'll use 9.77GB partitions for the root partition (/), and use the 3.91GB partition for /var.
Slice 1 will be used for swap space, but will not be part of live upgrade, and slice 4 is our user data and applications, also not part of live upgrade.
Here are the actual steps we'll follow. This example assumes 1 disk in the system (c0t0) with s0 mounted as the root partition (/) and s3 mounted as /var:
1. Initialize live upgrade (all steps are run as root user):
lucreate -c config0 -n config1 -m /:/dev/dsk/c0t0d0s5:ufs -m /var:/dev/dsk/c0t0d0s6:ufs
This will run for several minutes, depending on the speed of your machine and the size of your partitions. What's happening at this point is live upgrade is copying all the data from /dev/dsk/c0t0d0s0 to /dev/dsk/c0t0d0s5, and from /dev/dsk/c0t0d0s3 to /dev/dsk/c0t0d0s6.
2. After the lucreate is finished, you'll be able to see the status with
lustatus
Boot Environment Is Active Active Can Copy
Name Complete Now On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
config0 yes yes yes no -
config1 yes no no yes -
config0 is our s0 and s3, and config1 is s5 and s6. config0 is the currently active partition, and will still be the active partition upon reboot.
3. To switch to the config1 boot environment (BE), simple run:
luactivate config1
and reboot with
init 6
***NOTE*** do NOT reboot with the "reboot" command.
This will reboot the machine, but will not switch to config1
4. To switch back, simply run
luactivate config0
init 6
Other useful items:
You can refresh the non-active partition with the lumake
command. IE: if you're currently running on config1
and you want to mirror this to config0, run
"lumake -n config0".
You can mount the non-active boot environment (BE) partitions. Assuming
config0 is your active BE, run
"lumount config1". You can use "df -kl" to see the config1 partitions
mounted as
/.alt.config1
and
/.alt.config1/var
Once you're mounted the
non-active BE, you can apply OS patches to it:
patchadd -R /.alt.config1 /tmp/patches/114731-07
Now, to boot off the patched OS:
luunmount config1
luactivate config1
init 6