Red Hat Training

A Red Hat training course is available for RHEL 8

Chapter 15. Managing system upgrades with snapshots

Perform rollback capable upgrades of Red Hat Enterprise Linux systems to return to an earlier version of the operating system. You can use the Boom Boot Manager and the Leapp operating system modernization framework.

Before performing the operating system upgrades, consider the following aspects:

  • System upgrades with snapshots do not work on multiple file systems in your system tree, for example, a separate /var or /usr partition.
  • System upgrades with snapshots do not work for the Red Hat Update Infrastructure (RHUI) systems. Instead of using the Boom utility, consider creating snapshots of your virtual machines (VMs).

15.1. Overview of the Boom process

Create boot entries using the Boom boot manager so you can select and access these entries from the GRUB boot loader menu. Creating boot entries simplifies the process of preparation for a rollback capable upgrade.

The following boot entries are part of the upgrade and rollback processes:

  • Upgrade boot entry

    Boots the Leapp upgrade environment. Use the leapp utility to create and manage this boot entry. The leapp upgrade process automatically removes this entry.

  • Red Hat Enterprise Linux 8 boot entry

    Boots the upgrade 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. Use it to review and test the previous operating system state, following a successful or unsuccessful upgrade attempt. Before upgrading the operating 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 the boom command to create this boot entry when initiating a rollback of the upgrade procedure.

Additional resources

  • boom(1) man page

15.2. Upgrading to another version using Boom Boot Manager

Perform an upgrade of your Red Hat Enterprise Linux operating system using the Boom boot manager.

Prerequisites

  • You are running a current version of Red Hat Enterprise Linux.
  • You have installed the current version of the boom-boot package (version boom-0.9, ideally boom-1.3-2. or later).
  • You have sufficient space available for the snapshot. Make a size estimate based on the size of the original installation. List all the mounted logical volumes.
  • You have installed the leapp package.
  • You have enabled software repositories.
  • You have activated the snapshot volume. If it is not active, the boom command fails.
Note

Additional boot entries might include /usr or /var.

Procedure

  1. Create a snapshot of your root logical volume:

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

      # lvcreate -s rhel/root -kn -n root_snapshot_before_changes

      Here:

      • -s creates the snapshot.
      • rhel/root copies the file system to the logical volume.
      • -n root_snapshot_before_changes shows the name of the snapshot.

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

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

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

      Here:

      • -s creates the snapshot.
      • rhel/root copies the file system to the logical volume.
      • -n root_snapshot_before_changes shows the name of the snapshot.
      • -L 25g is the snapshot size. Make a size estimate based on the size of the original installation.

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

        Important

        The created snapshot does not include any additional system changes.

  2. Create the profile:

    # boom profile create --from-host --uname-pattern el8
  3. Create a snapshot boot entry of the original system using backup copies of the original boot images:

    # 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, that shows in the boot entry list during system startup.
    • --rootlv is the root logical volume that corresponds to the new boot entry.
    • After you complete the previous step, you have a boot entry that enables access to the original system, before the upgrade.
  4. Upgrade to Red Hat Enterprise Linux 8 using the Leapp utility:

    # leapp upgrade
    • Review and resolve any indicated blockers from the leapp upgrade command report.
  5. Reboot into the upgraded boot entry:

    # leapp upgrade --reboot
    • Select the Red Hat Enterprise Linux Upgrade Initramfs entry from the GRUB boot screen.
    • The leapp utility creates the upgrade boot entry. Run the above mentioned command to reboot into the upgrade boot entry, and proceed to execute the in-place upgrade to Red Hat Enterprise Linux 8. After the upgrade process, the reboot argument initiates an automatic system restart. The GRUB screen shows during reboot.

      Note

      The Snapshots submenu from the GRUB boot screen is not available in Red Hat Enterprise Linux 8.

Verification steps

  • Continue the upgrade and install the new Red Hat Enterprise Linux 8 RPM packages. After completing the upgrade, the system automatically reboots. The GRUB screen shows the upgraded and the older version of the available operating system. The upgraded system version is the default selection.
  • Check if the Root LV snapshot before changes boot entry is in the GRUB menu. If present, it provides instant access to the operating system state, prior to the upgrade.

15.3. Switching between Red Hat Enterprise Linux versions

Access simultaneously current and previous Red Hat Enterprise Linux versions on your machine. Using the Boom Boot Manager to access different operating system versions reduces the risk associated with upgrading an operating system, and also helps reduce hardware downtime. With this ability to switch between environments, you can:

  • quickly compare both environments in a side-by-side fashion.
  • switch between environments with minimal overhead.
  • recover older content of the file system.
  • 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.

Prerequisites

  • You are running a current version of Red Hat Enterprise Linux.

Procedure

  1. Reboot the system:

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

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

15.4. Deleting the Logical Volume snapshot

Creating a snapshot of your current operating system enables you to access, review and test in the previous state of the operating system. After you finish work with the operating system snapshot, you can delete it to free up storage space.

Important

You cannot perform any further operations with the Logical Volume (LV) snapshot after you delete it.

Prerequisites

  • You are running a current version of Red Hat Enterprise Linux.

Procedure

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

    # boom list
    BootID    Version                  Name                             RootDevice
    6d2ec72 3.10.0-957.21.3.el8.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 boot entry from the GRUB 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

15.5. Creating a rollback boot entry

Use the rollback boot entry to access the operating system environment in the state before the upgrade. Additionally, you can revert any operating system upgrades.

Prepare the rollback boot entry either from the upgraded system, or from the snapshot environment.

Prerequisites

  • You are running a current version of Red Hat Enterprise Linux.

Procedure

  1. Merge the snapshot with the original volume (the origin):

    # lvconvert --merge rhel/root_snapshot_before_changes
    Warning

    After you merge the snapshot, you must continue with all the remaining steps in this procedure to prevent data loss.

  2. Create a rollback boot entry for the merged snapshot:

    • For boom-0.9:

      boom create --title "RHEL Rollback" --rootlv rhel/root
    • For boom-1.2, or later versions:

      boom create --backup --title "RHEL Rollback" --rootlv rhel/root
  3. Optional: Reboot your machine to restore the operating system state:

    # reboot
    • Once the system is rebooted, select the Red Hat Enterprise Linux Rollback boot entry from the GRUB screen.
    • Once the root logical volume is active, the system automatically starts the snapshot merge operation.

      Important

      Once the merge operation starts, the snapshot volume is no longer available. After successfully booting the Red Hat Enterprise Linux Rollback boot entry, the Root LV snapshot boot entry no longer works. Merging the snapshot logical volume destroys the Root LV snapshot and restores the prior state of the original volume.

  4. Optional: After you complete the merge operation, 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 rebuild the grub.cfg file for the changes to take effect:

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

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

    # boom list
    # boom delete boot-id

Additional resources