How to create a dedicated `/var/lib/leapp` partition for leapp upgrades
Environment
- Red Hat Enterprise Linux 7
leapp
Issue
While upgrading a dedicated /var/lib/leapp partition is desired for additional space
Resolution
Warning: this is for experts only
The procedure assumes that you have space in the volume group to create a dedicated file system for /var/lib/leapp.
If this isn't the case, you will need some additional storage attached while performing the upgrade.
- Delete the files currently under
/var/lib/leapp
# rm -rf /var/lib/leapp/*
- Find if your system is using XFS filesystems with
ftype=0set. This will be important later. If the command returns nothing, then your system does not have XFS filesystems withftype=0set
# findmnt -t xfs
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/rhel-root xfs rw,relatime,seclabel,attr2,inode64,noquota
├─/usr /dev/mapper/rhel-usr xfs rw,relatime,seclabel,attr2,inode64,noquota
├─/boot /dev/vda1 xfs rw,relatime,seclabel,attr2,inode64,noquota
├─/home /dev/mapper/rhel-home xfs rw,relatime,seclabel,attr2,inode64,noquota
└─/var /dev/mapper/rhel-var xfs rw,relatime,seclabel,attr2,inode64,noquota
#
- Compute the space required for the new partition
# expr $(findmnt -t xfs -n -o SOURCE | wc -l) \* $LEAPP_OVL_SIZE
15360
Note: If your file systems are XFS file systems with ftype=0, use the value computed in Step 3 plus a few Gigabytes as security.
Otherwise, use some arbitrary value such as 16 GB which should be sufficient. Refer to the output from Step 2 if you need to see whether you have XFS filesystems with ftype=0 set
- Create the filesystem as an EXT4 filesystem
It is up to you to create the device which will be mounted as/var/lib/leapp.
Typically if you have enough space in your Volume Group, create a Logical Volume inside that.
Alternatively, you may use dedicated storage (a raw disk, a LUN, etc.)
Assuming you have created the Logical Volume or attached some storage, create the filesystem:
# mkfs.ext4 /dev/<device>
5a. If you are using non-LVM storage for your /var/lib/leapp filesystem, determine the filesystem UUID:
# blkid
5b. If you are using LVM storage for /var/lib/leapp, determine the VG and LV names:
# vgs
# lvs
- Edit
/etc/fstabto automatically mount/var/lib/leappduring boot
**It is It is necessary to add the file system to/etc/fstabbecause it will be required during the Upgrade phase after the reboot occurred
A typical /etc/fstab entry for /var/lib/leapp for non-LVM storage:
UUID=<UUID for the newly created filesystem found in blkid output> /var/lib/leapp ext4 defaults 1 2
A typical /etc/fstab entry for /var/lib/leapp for LVM storage:
/dev/mapper/<VGname-LVname for the newly created filesystem found in vgs and lvs output> /var/lib/leapp ext4 defaults 1 2
- Reload
systemd
# systemctl daemon-reload
- Mount
/var/lib/leapp
# mount /var/lib/leapp
- Now that you have a dedicated
/var/lib/leapppartition you may proceed with theleappupgrade as normal
Root Cause
This process can be utilized when the /var/ or /var/lib/ partition does not have enough space dedicated to it in order to proceed with a leapp upgrade
Note that there are other resolutions outlined in [leapp] At least X MB more space needed on the filesystem which may be relevant if you are seeing those errors during leapp upgrades
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.