Menu

How to resize a logical volume in Linux with 5 simple commands

How to resize a logical volume in Linux with 5 simple commands

Its easy to add capacity or Increase size of a Linux LVM with a few simple commands:

Physical Volume (PV): Consists of Raw disks or RAID arrays or other storage devices.
Volume Group (VG): Combines the physical volumes into storage groups.
Logical Volume (LV): VG’s are divided into LV’s and are mounted as partitions.

Scenario:

Currently server has a VG called – MEGA and few LVs mounted to / partition. VG was made up from two physical volumes called sda1, sda2, sdb1 and sdb2 and so. means 2 Physical HDDs (sda and sdb).

The VG – MEGA has some free space in it and we can use it to extend the LV – /dev/MEGA/root

#lsblk will give full details.

Follow the below to extend the LV then update the partition.

Before check the #df -Th and #lsblk

1. Identify the LV Logical Volume.

find your LV name to be extended with the #lvs or #lvdisplay (make note of LV Path) for your partiton.

2. Extend the LV 

#lvextend -L +10G /dev/MEGA/root

After you have extended the logical volume it is necessary to increase the file system size to match.

If your file systems are XFS use below:

3. Increase the filesystem size

#xfs_growfs /dev/MEGA/root

Loading

Categories:   Linux

Comments