12.08.2006

Sun LU (LiveUpgrade) koolness

I recently started playing with LiveUpgrade since i wanted at least 2 boot environments residing on a single-disk system which i could easily boot from so it was time for a little HowTo :)

This HowTo describes the process to create a 2nd BE (Boot Environment) using the
LU (LiveUpgrade) suite of tools on a single-disk system and to use that 2nd BE to upgrade to a later nevada build to boot from.

Note: We initially install snv_52 and create the 2nd BE with the goal to luupgrade(1M) that 2nd BE to snv_53.

First when creating your system, reserve some diskspace for a slice to actually ho
ld the 2nd BE (this slice needs to be equal or bigger in size than the root slice of the install you're about to commit to).

I tend to create the following disk scheme during the initial install of the 1st BE:

c1d0s0 / 15g
c1d0s1 swap 2g

All the remaining disk space can then be later allocated via format(1M)

So once you're done with the whole installation process and have a running nevada instance it's time to prepare the 2nd BE.

We run format(1M) and create a 15g slice to house the 2nd BE on slice 7 (c1d0s7) and label the disk.
Now that we've got this slice we can use this as the destination slice for lucreate(1M) the 2nd BE into.

snv_52 comes with the SUNWlu packages installed (5 in total) but when upgrading to a later nevada build it's always advised to use the SUNWlu packages from the build you're upgrading to since they tend to be a bit more recent!

So first pkgrm(1M) the following packages:

# pkgrm SUNWlucfg SUNWlur SUNWluu SUNWluxop SUNWluzone

I downloaded the snv_53 x86 ISO and mounted it via lofiadm(1M) as so:

# lofiadm -a /path/to/sol-nv-b53-x86-dvd.iso /dev/lofi/1
# mount -F hsfs -o ro /dev/lofi/1 /mnt

Now that the nevada image is mounted on /mnt it's time to install the newer versions of the SUNWlu packages.
# pkgadd -d /mnt/Solaris_11/Product/ SUNWlur SUNWluu SUNWlucfg SUNWluxop SUNWluzone

Now comes the part where you lucreate(1M) your current BE to the new BE.

# lucreate -c snv_current -m /:/dev/dsk/c1d0s7:ufs -n snv_53

This populates the c1d0s7 slice by copying the current contents of the active BE onto this new slice.
Once this process has successfully ended, verify thru lustatus(1M) whether the new BE has been created.

# lustatus
Boot Environment Is Active Active Can Copy
Name Complete Now On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
snv_current yes yes yes no -
snv_53 yes no no yes -

Next we upgrade the newly created BE (snv_53 which still holds a snv_52 image) to the snv_53 nevada build:
# luupgrade -u -n snv_53 -s /mnt/

Again we wait for this process to finish so we can luactivate(1M) this BE.
If everything went smoothly no warnings/errors should've been mentioned.

The kool thing about using the lu tools in this manner is that parts of the initial BE are shared into the new BE so user accounts and their home directories will simply be available when switching to the new BE !

# luactivate snv_53

No tinkering with grub(5)'s bootfile is required by using bootadm(1M).
Luactivate(1M) takes care of populating grub(5)'s menu with the appropriate entries and making the snv_53 BE the default boot choice.

Now the only thing left to do is to either shutdown(1M) or init(1M) to boot into the new BE.

Note: DO NOT use reboot(1M) or the new BE will not be booted from !!

That's it, we now have 2 BE's on the same disk which we can boot from.
Reverting back to the snv_52 build is as simple as running luactivate(M) passing the old BE as its argument and rebooting again via shutdown(1M) or init(1M).

# luactivate snv_current

Should the luupgrade(1M) leave you with an unbootable system the following sequence of events will revert your system back to the initial BE:

- boot from dvd and bring the system to single user
# mount -F ufs /dev/dsk/c1d0s0 /mnt
- luactivate (without args)
- exit single user and reboot (use shutdown(1M) or init(1M))

w00t!