Red Hat Training

A Red Hat training course is available for RHEL 8

Chapter 12. Managing system upgrades with snapshots

As a system administrator, you can perform rollback-capable upgrades of Red Hat Enterprise Linux systems using the Boom boot manager, the Leapp utility, and OS modernization framework.

The procedures mentioned in this user story have following limitations:

  • It does not work on multiple file systems in your system tree, for example, a separate /var or /usr partition.
  • It does not work for the RHUI systems. Instead of using the Boom utility, consider creating snapshots of your VMs.
  • Currently, this user story covers only on premises systems with Legacy BIOS and the Intel architecture. You can use it only with Red Hat Enterprise Linux 7 systems that use the BIOS for booting.

12.1. Overview of the Boom process

Using Boom, you can create boot entries, which can then be accessed and selected from the GRUB 2 boot loader menu. By creating boot entries, the process of preparing for a rollback capable upgrade is now simplified.

The following are the different boot entries, which are part of the upgrade and rollback process:

Upgrade boot entry
Boots the Leapp upgrade environment. Use the leapp utility to create and manage this boot entry. This boot entry is automatically removed in the course of the leapp upgrade.
Red Hat Enterprise Linux 8 boot entry
Boots the upgraded system environment. Use the leapp utility to create this boot entry after a successful upgrade process.
Snapshot boot entry
Boots the snapshot of the original system and can be used to review and test the previous system state following a successful or unsuccessful upgrade attempt. Before upgrading the system, use the boom command to create this boot entry.
Rollback boot entry
Boots the original system environment and rolls back any upgrade to the previous system state. Use boom command to create this boot entry when initiating a rollback of the upgrade procedure.

Rollback-capable upgrades are done using the following process without editing any configuration files:

  1. Create a snapshot or copy of the root file system.
  2. Use the boom command to create a boot entry for the current (older) environment.
  3. Upgrade your Red Hat Enterprise Linux system.
  4. Reboot the system, and select the version that you want to use.

The Red Hat Enterprise Linux 8, snapshot, and rollback entries should be cleaned up at the end of the procedure depending on the outcome of the update process:

  • If you want to keep the updated Red Hat Enterprise Linux 8 system, remove the created snapshot and rollback entries using the boom command, and remove snapshot logical volumes with the lvremove command. For more information, see Section 12.4, “Deleting the snapshot”.
  • If you want to rollback to the original system state, merge the snapshot and rollback boot entry, and after rebooting the system remove the unused snapshot and rollback boot entries. For more information, see Section 12.5, “Creating rollback boot entry”.

Additional resources

  • The boom man page.

12.2. Upgrading to another version using Boom

In addition to Boom, the following Red Hat Enterprise Linux components are used in this upgrade process:

  • Logical volume manager (LVM)
  • GRUB 2 boot loader
  • Leapp upgrade tool

This procedure describes how to upgrade from Red Hat Enterprise Linux 7 to Red Hat Enterprise Linux 8 using the boom command.

Prerequisites

  • Install the boom package:

    # yum install lvm2-python-boom

    Ensure that the lvm2-python-boom package’s version is at least boom-0.9 (ideally boom-1.2).

    Note

    If you want to install boom package on Red Hat Enterprise Linux 8, execute the following command:

    # yum install boom-boot
  • Sufficient space must be available for the snapshot. Use the following commands to find the free space on the volume groups and logical volumes:

    # vgs
    VG  #PV  #LV  #SN  Attr  VSize    VFree
    rhel 4 2 0 wz--n- 103.89g 29.99g
    
    # lvs
    LV     VG    Attr     LSize  Pool Origin Data% Meta% Move Log Cpy%Sync Convert
    root rhel -wi-ao--- 68.88g
    swap rhel -wi-ao--- 5.98g

    Here, rhel is the system volume group, and root and swap are the system logical volumes.

  • Find all the mounted logical volumes:

    # mount | grep rhel
    
    /dev/mapper/rhel-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
    Note

    If more than one entry is present and the mount points of the additional entries include '/usr' or '/var', the mentioned steps cannot be followed without executing additional steps that are beyond the scope of this user story.

  • The Leapp package is installed and the software repositories are enabled. For more information, see the Preparing a RHEL 7 system for the upgrade section, to download the required packages for the upgrade.

Procedure

  1. Create a snapshot of your root logical volume:

    • If your root file system uses thin provisioning, create a thin snapshot:

      While creating a thin snapshot, do not define the snapshot size. Snapshot is allocated from the thin pool.

      # lvcreate -s rhel/root -n root_snapshot_before_changes

      Here:

      • -s is used to create the snapshot
      • rhel/root is the file system being copied in the logical volume
      • -n root_snapshot_before_changes is the name of the snapshot
    • If your root file system uses thick provisioning, create a thick snapshot:

      While creating a thick snapshot, define the snapshot size that is able to hold all the changes during the upgrade.

      # lvcreate -s  rhel/root -n root_snapshot_before_changes -L 25g

      Here:

      • -s is used to create the snapshot
      • rhel/root is the file system being copied
      • -n root_snapshot_before_changes is the name of the snapshot
      • -L 25g is the snapshot size. This snapshot must be able to hold all the changes during the upgrade

        Important

        After creating the snapshot, any additional system changes are not included.

  2. Create the profile:

    # boom profile create --from-host --uname-pattern el7
    Note

    If you want to create the boom profile on Red Hat Enterprise Linux 8, use the el8 as the uname-pattern.

  3. Create a snapshot boot entry of the original system, using backup copies of the original boot images:

    1. For the boom-1.2 or later version:

      # boom create --backup --title "Root LV snapshot before changes" --rootlv rhel/root_snapshot_before_changes

      Here:

      • --title Root LV snapshot before changes is the name of the boot entry, which displays in the list during system startup
      • --rootlv is the root logical volume that corresponds to the new boot entry
    2. For the boom-1.1 or earlier version:

      # cp /boot/vmlinuz-$(uname r) /boot/vmlinuz$(uname -r).bak
      
      # cp /boot/initramfs-$(uname r).img /boot/initramfs$(uname -r).img.bak
      
      # boom create -title "Root LV snapshot before changes" --rootlv rhel/root_snapshot_before_changes --linux /boot/vmlinuz$(uname r).bak --initrd /boot/initramfs$(uname -r).img.bak

      If you execute the boom create command for the first time, the following message displays:

      WARNING - Boom configuration not found in grub.cfg
      
      WARNING - Run 'grub2-mkconfig > /boot/grub2/grub.cfg' to enable

      To enable Boom in GRUB 2:

      # grub2-mkconfig > /boot/grub2/grub.cfg
  4. Upgrade to Red Hat Enterprise Linux 8 using the Leapp utility:

    # leapp preupgrade

    Review and address if any blockers indicated in the leapp preupgrade command report.

  5. After resolving the blockers identified in the pre-upgrade reports, re-run the upgrade command with the --reboot option:

    # leapp upgrade --reboot

    This command reboots into the upgraded boot entry created by the leapp utility and proceeds to execute the in-place upgrade to Red Hat Enterprise Linux 8. The reboot argument initiates an automatic system restart after the upgrade process.

    During reboot, the GRUB 2 screen is displayed:

    GRUB2 display
    Note

    If you are on the Red Hat Enterprise Linux 8 system, the Snapshots sub-menu from the GRUB2 boot screen is not available.

Verification steps

  • Select the RHEL Upgrade Initramfs entry and press ENTER. The upgrade continues and new Red Hat Enterprise Linux 8 RPM packages are installed. After the upgrade is complete, the system automatically reboots and the GRUB 2 screen displays the upgraded and the older version of the available system. The upgraded system version is the default selection.

    switching between new and old versions

    Additionally, the created Root LV snapshot before changes boot entry is present, which provides an instant access to the system state prior to the upgrade.

Additional resources

12.3. Switching between new and old Red Hat Enterprise Linux versions

The Boom boot manager reduces the risks associated with upgrading a system and also helps to reduce hardware downtime. For example, you can upgrade a Red Hat Enterprise Linux 7 system to Red Hat Enterprise Linux 8, while retaining the original Red Hat Enterprise Linux 7 environment. This ability to switch between environments allows you to:

  • Quickly compare both environments in a side-by-side fashion and switch between them with minimal overhead.
  • Recover the older file system’s content.
  • Continue accessing the old system while the upgraded host is running.
  • Halt and revert the update process at any time, even while the update itself is running.

This procedure describes how to switch between the new and the old Red Hat Enterprise Linux versions after the upgrade is complete.

Prerequisites

Procedure

  1. Reboot the system:

    # reboot
  2. Select the desired boot entry from the GRUB 2 boot loader screen.

    switching between new and old versions

Verification steps

  • Verify that the selected boot volume is displayed:

    # cat /proc/cmdline
    
    root=/dev/rhel/root_snapshot_before_changes ro rd.lvm.lv=rhel/root_snapshot_before_changes rd.lvm.lv=vg_root/swap rhgb quiet

Additional resources

  • The boom man page.

12.4. Deleting the snapshot

Snapshot boot entry boots the snapshot of the original system and can be used to review and test the previous system state following a successful or unsuccessful upgrade attempt. This procedure describes steps to delete the snapshot.

Prerequisites

Procedure

  1. Boot into Red Hat Enterprise Linux 8 from the GRUB 2 entry. The following output confirms that the new snapshot is selected:

    # boom list
    BootID  Version                    Name                            RootDevice
    6d2ec72 3.10.0-957.21.3.el7.x86_64 Red Hat Enterprise Linux Server /dev/rhel/root_snapshot_before_changes
  2. Delete the snapshot entry using the BootID value:

    # boom delete --boot-id 6d2ec72

    This deletes the entry from the GRUB 2 menu.

  3. Remove the LV snapshot:

    # lvremove rhel/root_snapshot_before_changes
    Do you really want to remove active logical volume rhel/root_snapshot_before_changes? [y/n]: y
          Logical volume "root_snapshot_before_changes" successfully removed

    Additional resources

    • The boom man page.

12.5. Creating rollback boot entry

Rollback boot entry boots the original system environment and rolls back any upgrade to the previous system state. Reverting the upgraded and rollback boot entry to the original environment after reviewing it, is now available via the snapshot boot entry.

A rollback boot entry may be prepared either from the upgraded system or from the snapshot environment.

Prerequisites

Procedure

  1. Merge the snapshot:

    # lvconvert --merge rhel/root_snapshot_before_changes
  2. Create a rollback boot entry for the merged snapshot:

    1. For the boom-1.2 or later version:

      boom create --backup --title "RHEL Rollback" --rootlv rhel/root
    2. For the boom-1.1 or earlier version:

      boom create --title "RHEL Rollback" --rootlv rhel/root --linux /boot/vmlinuz$(uname r).bak --initrd /boot/initramfs$(uname -r).img.bak
  3. Optional: Boot rollback environment and restore the system state:

    # reboot

    Once the system is rebooted, select the RHEL Rollback boot entry using the arrow keys and press Enter to boot this entry.

    The system automatically starts the snapshot merge operation once the root logical volume is activated.

    Note

    Once the merge operation is started, the snapshot volume is no longer available. After successfully booting the RHEL Rollback boot entry, the Root LV snapshot before changes boot entry no longer works because it is now merged into the original logical volume. Merging a snapshot logical volume, destroys the snapshot and restores the prior state of the origin volume.

  4. Optional: Once the merge operation is completed, remove the unused entries and restore the original boot entry:

    1. Remove the unused Red Hat Enterprise Linux 8 boot entries from the /boot file system and refresh the Grub2 configuration:

      # rm -f /boot/el8
      # grub2-mkconfig -o /boot/grub2/grub.cfg
    2. Restore the original Red Hat Enterprise Linux 7 boot entry:

      # new-kernel-pkg --update $(uname -r)
  5. After successful rollback to the system, delete the boom boot entry:

    # boom list
    # boom delete boot-id

Additional resources

  • The boom man page.