Hi there, In this quick article I’ll show you how to extend xfs formatted LVM in CentOS 8.
Xfs is a file system designed for high-performance operations. When you created an LVM and add xfs file system into it, the extending and reducing methods are bit different than other file systems. Let’s move for the steps.
- Unmount the Logical Volume
- Extend the Volume Group
- Extend the Logical Volume
The above steps are looks the same for any type of LVM. But the commands are a bit different for xfs file system. I already created the 2GB Volume Group called “new_vg” in my workstation.
The following Logical volume called “My_lv1” is created using the volume group called “new_vg”.
Above logical volume is mounted on /LVM directory. Now I’ll include some dummy data into /LVM.
Let’s extend the logical volume called “My_lv1”.
01. Unmount the Logical Volume
First of all, we need to unmount the logical volume from the current mount point. The following command will unmount the logical volume.
02. Extend the Volume Group
The following command will extends the Volume Group using sdb2 partition(3GB of size).
vgextend new_vg /dev/sdb2
Now Volume Group has 3GB of free space.
03. Extend the Logical Volume
Now the Volume group has 3GB of free space and Its also able to use extend the size of logical volumes. The following command will extends the size of the logical volume called “My_lv1” to 5GB. That means we need to add more 3GB into that volume.
lvextend -L +2.99G /dev/new_vg/My_lv1
Remember! We cannot add exactly 3GB for extending.
Now we can mount the logical volume into /LVM directory.
mount /dev/new_vg/My_lv1 /LVM
Also execute the following command.
Let’s check the new size using df -h /LVM command.
Also, check whether our dummy data lost or not. (Should not be lost)
Yes! Its also there. That means our resizing process is completed!
That’s all about extending xfs formatted LVMs in centOS 8. If you have any questions, leave a comment below.