Search

Chapter 15. Managing system upgrades with snapshots

download PDF

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 by using the Boom Boot Manager.

Prerequisites

  • You are running Red Hat Enterprise Linux 7.9.
  • You have installed the current version of the lvm2-python-boom package (version lvm2-python-boom-1.2-2.el7_9.5 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.
Note

Additional file systems 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
       Logical volume "root_snapshot_before_changes" created.

      Here:

      • -s creates the snapshot.
      • rhel/root copies the file system to the logical volume.
      • -kn automatically activates LV at boot time.
      • -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
       Logical volume "root_snapshot_before_changes" created.

      In this command:

      • -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. Enable boom by using the GRUB 2 bootloader

    # grub2-mkconfig > /boot/grub2/grub.cfg
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-3.10.0-1160.118.1.el7.x86_64
    Found initrd image: /boot/initramfs-3.10.0-1160.118.1.el7.x86_64.img
    Found linux image: /boot/vmlinuz-3.10.0-1160.el7.x86_64
    Found initrd image: /boot/initramfs-3.10.0-1160.el7.x86_64.img
    Found linux image: /boot/vmlinuz-0-rescue-f9f6209866c743739757658d1a4850b2
    Found initrd image: /boot/initramfs-0-rescue-f9f6209866c743739757658d1a4850b2.img
    done
  3. Create the profile:

    # boom profile create --from-host --uname-pattern el7
    Created profile with os_id f150f3d:
      OS ID: "f150f3d6693495254255d46e20ecf5c690ec3262",
      Name: "Red Hat Enterprise Linux Server", Short name: "rhel",
      Version: "7.9 (Maipo)", Version ID: "7.9",
      Kernel pattern: "/vmlinuz-%{version}", Initramfs pattern: "/initramfs-%{version}.img",
      Root options (LVM2): "rd.lvm.lv=%{lvm_root_lv}",
      Root options (BTRFS): "rootflags=%{btrfs_subvolume}",
      Options: "root=%{root_device} ro %{root_opts}",
      Title: "%{os_name} %{os_version_id} (%{version})",
      Optional keys: "grub_users grub_arg grub_class id", UTS release pattern: "el7"
  4. 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
    Created entry with boot_id bfef767:
      title Root LV snapshot before changes
      machine-id 7d70d7fcc6884be19987956d0897da31
      version 3.10.0-1160.114.2.el7.x86_64
      linux /vmlinuz-3.10.0-1160.114.2.el7.x86_64.boom0
      initrd /initramfs-3.10.0-1160.114.2.el7.x86_64.img.boom0
      options root=/dev/rhel/root_snapshot_before_changes ro rd.lvm.lv=rhel/root_snapshot_before_changes
      grub_users $grub_users
      grub_arg --unrestricted
      grub_class kernel

    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.

  5. Upgrade to Red Hat Enterprise Linux 8 using the Leapp utility:

    # leapp upgrade
    ==> Processing phase `configuration_phase`
    ====> * ipu_workflow_config
            IPU workflow config actor
    ==> Processing phase `FactsCollection`
    ...
    ============================================================
                          REPORT OVERVIEW
    ============================================================
    
    Upgrade has been inhibited due to the following problems:
        1. Btrfs has been removed from RHEL8
        2. Missing required answers in the answer file
    
    HIGH and MEDIUM severity reports:
        1. Packages available in excluded repositories will not be installed
        2. GRUB2 core will be automatically updated during the upgrade
        3. Difference in Python versions and support in RHEL 8
        4. chrony using default configuration
    
    Reports summary:
        Errors:                      0
        Inhibitors:                  2
        HIGH severity reports:       3
        MEDIUM severity reports:     1
        LOW severity reports:        3
        INFO severity reports:       4
    
    Before continuing consult the full report:
        A report has been generated at /var/log/leapp/leapp-report.json
        A report has been generated at /var/log/leapp/leapp-report.txt
    
    ============================================================
                       END OF REPORT OVERVIEW
    ============================================================

    Review and resolve any blockers indicated by the leapp upgrade command report. For detailed instructions on the report, see Assessing upgradability from the command line.

  6. Reboot into the upgrade boot entry:

    # leapp upgrade --reboot
    ==> Processing phase `configuration_phase`
    ====> * ipu_workflow_config
            IPU workflow config actor
    ==> Processing phase `FactsCollection`
    ...

    Select the Red Hat Enterprise Linux Upgrade Initramfs entry from the GRUB boot screen.

    Note

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

Verification

  • After completing the upgrade, the system automatically reboots. The GRUB screen shows the upgraded (Red Hat Enterprise Linux 8) and the previous version of the available operating system. The upgraded system version is the default selection.

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 while evaluating the result of the upgrade.
  • 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.

Procedure

  1. Reboot the system:

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

Verification

  • Verify that the selected boot volume is displayed:

    # cat /proc/cmdline
    BOOT_IMAGE=(hd0,msdos1)/vmlinuz-3.10.0-1160.118.1.el7.x86_64.boom0 root=/dev/rhel/root_snapshot_before_changes ro rd.lvm.lv=rhel/root_snapshot_before_changes

Additional resources

  • boom(1) man page

15.4. Deleting the logical volume snapshot after a successful upgrade

If you have successfully upgraded your system by using the Boom Boot Manager, you can remove the snapshot boot entry and the logical volume (LV) snapshot to use the upgraded system.

Important

You cannot perform any further operations with the LV snapshot after you delete it.

Prerequisites

Procedure

  1. Boot into Red Hat Enterprise Linux 8 from the GRUB boot loader screen.
  2. After the system loads, view the available boot entries. The following output shows the snapshot boot entry in the list of boom boot entries:

    # boom list
    WARNING - Options for BootEntry(boot_id=cae29bf) do not match OsProfile: marking read-only
    BootID  Version                      Name                            RootDevice
    e0252ad 3.10.0-1160.118.1.el7.x86_64 Red Hat Enterprise Linux Server /dev/rhel/root_snapshot_before_changes
    611ad14 3.10.0-1160.118.1.el7.x86_64 Red Hat Enterprise Linux Server /dev/mapper/rhel-root
    3bfed71- 3.10.0-1160.el7.x86_64 Red Hat Enterprise Linux Server /dev/mapper/rhel-root _cae29bf 4.18.0-513.24.1.el8_9.x86_64 Red Hat Enterprise Linux        /dev/mapper/rhel-root

    The warning is expected, you cannot change or delete these entries by using boom because the kernel and grubby packages manage them.

  3. Delete the snapshot entry by using the BootID value:

    # boom delete --boot-id e0252ad
    Deleted 1 entry

    This deletes the boot entry from the GRUB menu.

  4. 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
  5. Complete the remaining post-upgrade tasks. For details, see Upgrade from RHEL 7 to RHEL 8.

Additional resources

  • boom(1) man page

15.5. Creating a rollback boot entry after an unsuccessful upgrade

To revert the operating system upgrade back to the previous state of the system after an unsuccessful upgrade, use a rollback boot entry. This can also be helpful if you find a problem with the upgraded environment, for example, incompatibility with in-house software.

To prepare the rollback boot entry, use the snapshot environment.

Prerequisites

Procedure

  1. Merge the snapshot with the original volume:

    # lvconvert --merge rhel/root_snapshot_before_changes
      Logical volume rhel/root_snapshot_before_changes contains a filesystem in use.
      Delaying merge since snapshot is open.
      Merging of thin snapshot rhel/root_snapshot_before_changes will occur on next activation of rhel/root.
    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:

    # boom create --backup --title "RHEL Rollback" --rootlv rhel/root
    Created entry with boot_id 1e6d298:
      title RHEL Rollback
      machine-id f9f6209866c743739757658d1a4850b2
      version 3.10.0-1160.118.1.el7.x86_64
      linux /vmlinuz-3.10.0-1160.118.1.el7.x86_64.boom0
      initrd /initramfs-3.10.0-1160.118.1.el7.x86_64.img.boom0
      options root=/dev/rhel/root ro rd.lvm.lv=rhel/root
      grub_users $grub_users
      grub_arg --unrestricted
      grub_class kernel
  3. Reboot your machine to restore the operating system state:

    # reboot
    • After the system reboots, select the RHEL Rollback boot entry from the GRUB screen.
    • When the root logical volume is active, the system automatically starts the snapshot merge operation.

      Important

      When the merge operation starts, the snapshot volume is no longer available. After successfully booting the RHEL 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. 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:

      # rm -f /boot/loader/entries/*.el8*
      # rm -f /boot/*.el8*
      # grub2-mkconfig -o /boot/grub2/grub.cfg
      Generating grub configuration file ...
      Found linux image: /boot/vmlinuz-3.10.0-1160.118.1.el7.x86_64.boom0
      ....
      done
    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 snapshot and rollback boot entries:

    # boom list -o+title
    BootID  Version                      Name                            RootDevice                             Title
    a49fb09 3.10.0-1160.118.1.el7.x86_64 Red Hat Enterprise Linux Server /dev/mapper/rhel-root                  Red Hat Enterprise Linux (3.10.0-1160.118.1.el7.x86_64) 8.9 (Ootpa)
    1bb11e4 3.10.0-1160.el7.x86_64       Red Hat Enterprise Linux Server /dev/mapper/rhel-root                  Red Hat Enterprise Linux (3.10.0-1160.el7.x86_64) 8.9 (Ootpa)
    e0252ad 3.10.0-1160.118.1.el7.x86_64 Red Hat Enterprise Linux Server /dev/rhel/root_snapshot_before_changes Root LV snapshot before changes
    1e6d298 3.10.0-1160.118.1.el7.x86_64 Red Hat Enterprise Linux Server /dev/rhel/root                         RHEL Rollback
    # boom delete e0252ad
    Deleted 1 entry
    # boom delete 1e6d298
    Deleted 1 entry

Additional resources

  • boom(1) man page
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.