Working with LVM (Logical Volume Management) can simplify the process of managing disk space. This post will guide you through enlarging a disk in LVM, migrating a non-LVM file system to LVM, and migrating the root file system to LVM.
Enlarging a Disk in LVM#
Refer to this article for more information: Manage and Create LVM Partition Using vgcreate, lvcreate, and lvextend.
To enlarge an existing LVM:
- Check if the new disk is detected using 
lsblk. If not, scan it with: 
echo "- - -" > /sys/class/scsi_host/host<N=1,2,3,4...>/scan
- Create a physical volume, extend the volume group, and extend the logical volume:
 
pvcreate <new_disk>
vgextend <vg> <new_disk>
lvextend -l +100%FREE -r <lvm>
Resize the file system:
You should able to see the resize disk on
df -h
Migrating Non-LVM File System to LVM#
For example, if you want to move /var to LVM:
- Create the LVM.
 - Mount it to a temporary location (e.g., 
/tmp/lvm). - Copy data from 
/varto the LVM: 
rsync -avz /var/ /tmp/lvm/
- Unmount it.
 - Update 
/etc/fstabwith the new LVM.- Use UUID to reference the file system.
 - Find the UUID with blkid.
 
 
Refer to fstab documentation for more details.
Migrating Root File System to LVM#
Refer to Converting an Existing Root Filesystem to LVM Partition.
The steps are similar to migrating a non-LVM file system:
- Repeat the steps of migrating Non-LVM File System
 - Perform additional steps:
chrootto updateinitrd.- Edit 
grub.confwith the new root. 
 - Restart the system.
 
Following these steps will help you manage disk space using LVM, whether you need to enlarge a disk, migrate a non-LVM file system to LVM, or migrate the root file system to LVM.

