Does boom support multi-volume snapshots?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9
  • Boom

Issue

  • Does boom entry support snapshot for multiple logical volumes?
  • We use separate filesystems for /, /var, /tmp, /var/log, /var/crash, /var/log/audit, /home, etc. When we take a snapshot before patching or another risky activity, we take snapshots of all of these LVs. It would be great to be able to use boom to add a boot entry for snapshots is a situation like above.
  • Can we take boom snapshots of /var if /var is not under root and then later rollback if needed?

Resolution

Red Hat Enterprise Linux 7-8
At this moment this feature is not part of RHEL 7/8

Red Hat Enterprise Linux 9.4
The feature to create boom entry with multiple snapshot is introduced in boom-boot-1.6.0-2.el9 package released in errata update RHBA-2024:2291.

Root Cause

  • There was a limitation in older version of boom package which prevented the use of multi-volume snapshots.
    This feature is added in RHEL 9.4 provided boom-boot-1.6.0-2.el9 package.

Diagnostic Steps

With RHEL 9.4 provided boom package, below steps could be used to setup snapshots for different LVs in root vg and create boom entry for them:

  • e.g. for a system with separate /var and /home LVs, create snapshots of rhel/root, rhel/var, and rhel/home:

    [root@localhost ~]# lvcreate -s -n root-snap -L 1g rhel/root
      Logical volume "root-snap" created.
    [root@localhost ~]# lvcreate -s -n var-snap -L 1g rhel/var
      Logical volume "var-snap" created.
    [root@localhost ~]# lvcreate -s -n home-snap -L 1g rhel/home
      Logical volume "home-snap" created.
    
  • Set up an OsProfile and create a boom boot entry for the snapshot volumes:

    [root@localhost ~]# boom profile create --from-host
    Created profile with os_id d5bded8:
      OS ID: "d5bded84c4f37fc29568e83ea2cb2b1dfc3d5789",
      Name: "Red Hat Enterprise Linux", Short name: "rhel",
      Version: "9.4 (Plow)", Version ID: "9.4",
      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} crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/swap rhgb quiet",
      Title: "%{os_name} %{os_version_id} (%{version})",
      Optional keys: "grub_users grub_arg grub_class id", UTS release pattern: "el9"
    
    [root@localhost ~]# boom create --title Snapshot --root-lv rhel/root-snap --no-fstab --mount /dev/rhel/var-snap:/var:xfs:defaults --mount /dev/rhel/home-snap:/home:xfs:defaults
    Created entry with boot_id 75aa619:
      title Snapshot
      machine-id a76538d60c5a4566912a3649744f2529
      version 5.14.0-427.13.1.el9_4.x86_64
      linux /vmlinuz-5.14.0-427.13.1.el9_4.x86_64
      initrd /initramfs-5.14.0-427.13.1.el9_4.x86_64.img
      options root=/dev/rhel/root-snap ro rd.lvm.lv=rhel/root-snap crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/swap rhgb quiet fstab=no systemd.mount-extra=/dev/rhel/var-snap:/var:xfs:defaults systemd.mount-extra=/dev/rhel/home-snap:/home:xfs:defaults
      grub_users $grub_users
      grub_arg --unrestricted
      grub_class kernel
    
  • Reboot and select Snapshot from the Grub2 menu. With updated boom packages, the system successfully boots into the snapshot environment:

    # grep rhel /proc/mounts 
    /dev/mapper/rhel-root--snap / xfs rw,seclabel,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
    /dev/mapper/rhel-var--snap /var xfs rw,seclabel,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
    /dev/mapper/rhel-home--snap /home xfs rw,seclabel,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
    
    
    [root@localhost ~]# systemctl status -- -.mount
    ● -.mount - Root Mount
         Loaded: loaded
         Active: active (mounted)
          Where: /
           What: /dev/mapper/rhel-root--snap
    [root@localhost ~]# systemctl status var.mount
    ● var.mount - /var
         Loaded: loaded (/proc/cmdline; generated)
         Active: active (mounted) since Mon 2024-02-26 19:53:44 GMT; 12min ago
          Until: Mon 2024-02-26 19:53:44 GMT; 12min ago
          Where: /var
           What: /dev/mapper/rhel-var--snap
           Docs: man:fstab(5)
                 man:systemd-fstab-generator(8)
          Tasks: 0 (limit: 7739)
         Memory: 4.0K
            CPU: 16ms
         CGroup: /system.slice/var.mount
    
    Feb 26 19:53:44 localhost systemd[1]: Mounting /var...
    Feb 26 19:53:44 localhost systemd[1]: Mounted /var.
    
    
    [root@localhost ~]# systemctl status home.mount
    ● home.mount - /home
         Loaded: loaded (/proc/cmdline; generated)
         Active: active (mounted) since Mon 2024-02-26 19:53:44 GMT; 12min ago
          Until: Mon 2024-02-26 19:53:44 GMT; 12min ago
          Where: /home
           What: /dev/mapper/rhel-home--snap
           Docs: man:fstab(5)
                 man:systemd-fstab-generator(8)
          Tasks: 0 (limit: 7739)
         Memory: 4.0K
            CPU: 16ms
         CGroup: /system.slice/home.mount
    
    Feb 26 19:53:44 localhost systemd[1]: Mounting /home...
    Feb 26 19:53:44 localhost systemd[1]: Mounted /home.
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments