To be able to extend an LVM volume, we need to add physical storage (partition or a disk).
We add a new partition to /dev/sdb2 using the fdisk tool:
Remark:
The partition /dev/sdb1 already exists on the system, fdsisk is going to propose /dev/sdb2 by default. We also have to give it the LVM filesystem type.
We create the partition using:
we check using the below command:
We check the existing LVM volume using:
Creating the physical volume:
We create the physical volume based on the partition /dev/sdb2 using:Extending the volume group:
We then extend the volume group with the new partition /dev/sdb2:
We check that /dev/sdb2 is in the "vg_name" volume group:
We could also use the command pvs as below:
Extending the logical volume:
We extend the logical volume "/dev/mapper/vg_name-lv_name" using:
In the example above we extend the logical volume by five megabytes.
Resizing the filesystem:
Remark:
The resize2fs command works for ext3 and ext4 Linux filesystems.
Comments