Skip to content

Instantly share code, notes, and snippets.

@ipan
Last active January 18, 2018 01:00
Show Gist options
  • Save ipan/0c9ec9a8dd28042d7635ea8b02ef668d to your computer and use it in GitHub Desktop.
Save ipan/0c9ec9a8dd28042d7635ea8b02ef668d to your computer and use it in GitHub Desktop.
extending existing LVM partition #lvm #unix #lvextend #resize2fs #vgdisplay #lvdisplay

The starting logical volume (vm) is 1TB. The volume group (data) has plenty of free space. This can be queried with lvdisplay.

The following command will extend the logical volume vm under volume group data by 4 TB

lvextend -L4T /dev/data/vm
resize2fs /dev/data/vm

Run vgdisplay to confirm:

--- Volume group ---
VG Name               data
System ID
Format                lvm2
Metadata Areas        1
Metadata Sequence No  4
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                2
Open LV               1
Max PV                0
Cur PV                1
Act PV                1
VG Size               26.31 TiB
PE Size               4.00 MiB
Total PE              6896639
Alloc PE / Size       1310720 / 5.00 TiB
Free  PE / Size       5585919 / 21.31 TiB
VG UUID               eS3lPE-uoQ9-MLp4-DA4Z-MljT-tJw9-NOeovR

After the logical volume (vm) has been extended to 5TB, there are still more than 20 TB of free space in data volume group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment