Increasing the LVM disk size

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

VlaKl

New Member
Apr 26, 2019
23
0
1
Hi

The virtual disk is increased. How to increase LVM ?

fdisk -l /dev/sdc

Disk /dev/sdc: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Physical volume ---
PV Name /dev/sdc
VG Name vol_data
PV Size 30.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 7679
Free PE 0
Allocated PE 7679



- Volume group ---
VG Name vol_data
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <30.00 GiB
PE Size 4.00 MiB
Total PE 7679
Alloc PE / Size 7679 / <30.00 GiB
Free PE / Size 0 / 0
 

EffrafaxOfWug

Radioactive Member
Feb 12, 2015
1,394
511
113
From what you've posted, you've created the PV direct on /dev/sdc without using a partition, so no you don't need to create a partition - but IMHO starting off using partitions makes things much easier to manage (I almost always do to be sure that alignment is correct); then before all the LVM stuff you'd also need to extend the sdc1 partition to the end of the disc. I usually do this interactively with parted.

Assuming it's /dev/sdc you've increased to 53GB and you're not using a partition, you need to complete steps looking something like this (I'm doing this from memory so check before you run of course!):
Get LVM the realise the PV device size has increased:
Code:
pvresive /dev/sdc
pvdisplay /dev/sdc
Once the PV is bigger, grow the volume group across the extents of the newly extended PV:
Code:
vgextend vol_data /dev/sdc
vgdisplay vol_data
Any logical volumes sitting in that VG can then be extended with lvextend. If you use the -r option, LVM will also attempt to resize the filesystem on the LV accordingly; this doesn't always work (depends on how you've got it set up basically) so be prepared to resize the filesystem manually.
Code:
lvextend -rv -L +10G /dev/vol_data/whatever_your_lv_is_called
 
Last edited:
  • Like
Reactions: VlaKl