I didn't properly apportion my volumes when I set up a RHEL 8 server so now I'm trying to rectify that. I need to move disk space from home to root. Here's what I did:
- Booted from a RHEL ISO, went into troubleshooting mode, and dropped to the shell.
- Activated the volume group:
vgchange -ay - Temporarily mounted the volumes
mkdir /mnt/sysimage/rt mkdir /mnt/sysimage/backup mount /dev/mapper/rhel_ylntest-home /mnt/sysimage/rt/ mount /dev/mapper/rhel_ylntest-root /mnt/sysimage/backup/ - Initiated the backup:
xfsdump -l 0 -L "home lv backup" -M "backup" -f /mnt/sysimage/backup/home_backup.img /mnt/sysimage/rt - Unmounted:
umount /mnt/sysimage/rt/ - Deleted the logical volume:
lvremove /dev/mapper/rhel_ylntest-home - Created the desired size:
lvcreate -Zy -L 500G -n home rhel - Formatted the new volume:
mkfs.xfs /dev/mapper/rhel_ylntest-home - Mounted the volume:
mount /dev/mapper/rhel_ylntest-home /mnt/sysimage/rt - Restored from the backup:
xfsrestore -f /mnt/sysimage/backup/home_backup.img /mnt/sysimage/rt - Unmounted everything:
umount /mnt/sysimage/rt/ /mnt/sysimage/backup/ - Rebooted back to the command line.
The home volume correctly decreased in size but the root volume didn't get any larger and the remaining disk space seems lost to the ether. What did I do wrong? I'm wondering if for step 7, I should have done lvcreate -Zy -L 500G -n home rhel_ylntest. I'm well out of my comfort zone here so please be prescriptive.
lvresize -r -l +100%FREE /dev/mapper/rhel_ylntest-root(or some variant) is necessary.resize2fs)