Solaris ZFS Administration Guide

Using Solaris Live Upgrade to Migrate to a ZFS Root File System


Example 5–2 Using Solaris Live Upgrade to Migrate a UFS Root File System to a ZFS Root File System

The following example shows how to create a BE of a ZFS root file system from a UFS root file system. The current BE, c1t1d0s0, containing a UFS root file system, is identified by the -c option. The new BE, zfsnv109BE, is identified by the -n option. A ZFS storage pool must exist before the lucreate operation. The ZFS storage pool must be created with slices rather than whole disks to be upgradeable and bootable.


# zpool create mpool mirror c1t0d0s0 c1t2d0s0
# lucreate -c ufsnv109BE -n zfsnv109BE -p mpool
Analyzing system configuration.
No name for current boot environment.
Current boot environment is named <ufsnv109BE>.
Creating initial configuration for primary boot environment <ufsnv109BE>.
The device </dev/dsk/c1t1d0s0> is not a root device for any boot environment; cannot get BE ID.
PBE configuration successful: PBE name <ufsnv109BE> PBE Boot Device </dev/dsk/c1t1d0s0>.
Comparing source boot environment <ufsnv109BE> file systems with the file 
system(s) you specified for the new boot environment. Determining which 
file systems should be in the new boot environment.
Updating boot environment description database on all BEs.
Updating system configuration files.
The device </dev/dsk/c1t0d0s0> is not a root device for any boot environment; cannot get BE ID.
Creating configuration for boot environment <zfsnv109BE>.
Source boot environment is <ufsnv109BE>.
Creating boot environment <zfsnv109BE>.
Creating file systems on boot environment <zfsnv109BE>.
Creating <zfs> file system for </> in zone <global> on <mpool/ROOT/zfsnv109BE>.
Populating file systems on boot environment <zfsnv109BE>.
Checking selection integrity.
Integrity check OK.
Populating contents of mount point </>.
Copying.
Creating shared file system mount points.
Creating compare databases for boot environment <zfsnv109BE>.
Creating compare database for file system </mpool/ROOT>.
Creating compare database for file system </>.
Updating compare databases on boot environment <zfsnv109BE>.
Making boot environment <zfsnv109BE> bootable.
Creating boot_archive for /.alt.tmp.b-0ob.mnt
updating /.alt.tmp.b-0ob.mnt/platform/sun4u/boot_archive
Population of boot environment <zfsnv109BE> successful.
Creation of boot environment <zfsnv109BE> successful.

After the lucreate operation completes, use the lustatus command to view the BE status. For example:


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

Then, review the list of ZFS components. For example:


# zfs list
NAME                    USED  AVAIL  REFER  MOUNTPOINT
mpool                  9.95G  41.2G    21K  /mpool
mpool/ROOT             7.45G  41.2G    19K  /mpool/ROOT
mpool/ROOT/zfsnv109BE  7.45G  41.2G  7.45G  /tmp/.alt.luupdall.5232
mpool/dump                2G  43.2G    16K  -
mpool/swap              517M  41.7G    16K  -

Next, use the luactivate command to activate the new ZFS BE. For example:


# luactivate zfs1009BE
A Live Upgrade Sync operation will be performed on startup of boot environment <zfs1009BE>.

**********************************************************************

The target boot environment has been activated. It will be used when you 
reboot. NOTE: You MUST NOT USE the reboot, halt, or uadmin commands. You 
MUST USE either the init or the shutdown command when you reboot. If you 
do not use either init or shutdown, the system will not boot using the 
target BE.

**********************************************************************
.
.
.
Modifying boot archive service
Activation of boot environment <zfs1009BE> successful.

# luactivate zfsnv109BE

**********************************************************************

The target boot environment has been activated. It will be used when you 
reboot. NOTE: You MUST NOT USE the reboot, halt, or uadmin commands. You 
MUST USE either the init or the shutdown command when you reboot. If you 
do not use either init or shutdown, the system will not boot using the 
target BE.

**********************************************************************

In case of a failure while booting to the target BE, the following process 
needs to be followed to fallback to the currently working boot environment:

1. Enter the PROM monitor (ok prompt).

2. Change the boot device back to the original boot environment by typing:

     setenv boot-device /pci@1f,700000/scsi@2/disk@1,0:a

3. Boot to the original boot environment by typing:

     boot

**********************************************************************

Modifying boot archive service
Activation of boot environment <zfsnv109BE> successful.

Next, reboot the system to the ZFS BE.


# init 6

Confirm that the ZFS BE is active.


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

If you switch back to the UFS BE, you will need to re-import any ZFS storage pools that were created while the ZFS BE was booted because they are not automatically available in the UFS BE.

If the UFS BE is no longer required, you can remove it with the ludelete command.



Example 5–3 Using Solaris Live Upgrade to Create a ZFS BE From a ZFS BE

Creating a ZFS BE from a ZFS BE in the same pool is very quick because this operation uses ZFS snapshot and clone features. If the current BE resides on the same ZFS pool mpool, for example, the -p option is omitted.

If you have multiple ZFS BEs on a SPARC based system, you can use the boot -L command to identify the available BEs and select a BE from which to boot by using the boot -Z command. On an x86 based system, you can select a BE from the GRUB menu. For more information, see Example 5–6.


# lucreate -n zfsnv1092BE
Analyzing system configuration.
Comparing source boot environment <zfsnv109BE> file systems with the file 
system(s) you specified for the new boot environment. Determining which 
file systems should be in the new boot environment.
Updating boot environment description database on all BEs.
Updating system configuration files.
Creating configuration for boot environment <zfsnv1092BE>.
Source boot environment is <zfsnv109BE>.
Creating boot environment <zfsnv1092BE>.
Cloning file systems from boot environment <zfsnv109BE> to create boot environment <zfsnv1092BE>.
Creating snapshot for <mpool/ROOT/zfsnv109BE> on <mpool/ROOT/zfsnv109BE@zfsnv1092BE>.
Creating clone for <mpool/ROOT/zfsnv109BE@zfsnv1092BE> on <mpool/ROOT/zfsnv1092BE>.
Setting canmount=noauto for </> in zone <global> on <mpool/ROOT/zfsnv1092BE>.
Population of boot environment <zfsnv1092BE> successful.
Creation of boot environment <zfsnv1092BE> successful.


Example 5–4 Upgrading Your ZFS BE (luupgrade)

You can upgrade your ZFS BE to a later build by using the luupgrade command. The following example shows how to upgrade a ZFS BE from build 109 to build 110.

The basic process is:


# luupgrade -n zfsnv109BE -u -s /net/install/export/nv/combined.nvs_wos/110
50687 blocks
miniroot filesystem is <lofs>
Mounting miniroot at </net/install/export/nv/combined.nvs_wos/110/Solaris_11/Tools/Boot>
Validating the contents of the media </net/install/export/nv/combined.nvs_wos/110>.
The media is a standard Solaris media.
The media contains an operating system upgrade image.
The media contains <Solaris> version <11>.
Constructing upgrade profile to use.
Locating the operating system upgrade program.
Checking for existence of previously scheduled Live Upgrade requests.
Creating upgrade profile for BE <zfsnv109BE>.
Determining packages to install or upgrade for BE <zfsnv109BE>.
Performing the operating system upgrade of the BE <zfsnv109BE>.
CAUTION: Interrupting this process may leave the boot environment unstable 
or unbootable.
Upgrading Solaris: 100% completed
Installation of the packages from this media is complete.
Adding operating system patches to the BE <zfsnv109BE>.
The operating system patch installation is complete.
INFORMATION: The file </var/sadm/system/logs/upgrade_log> on boot 
environment <zfsnv109BE> contains a log of the upgrade operation.
INFORMATION: The file </var/sadm/system/data/upgrade_cleanup> on boot 
environment <zfsnv109BE> contains a log of cleanup operations required.
INFORMATION: Review the files listed above. Remember that all of the files 
are located on boot environment <zfsnv109BE>. Before you activate boot 
environment <zfsnv109BE>, determine if any additional system maintenance 
is required or if additional media of the software distribution must be 
installed.
The Solaris upgrade of the boot environment <zfsnv109BE> is complete.