Expanding LVM volume

Kernels & Hardware, configuring network, installing services

Expanding LVM volume

Postby letthiswork1 » 2019-10-18 04:43

Hi All,

I have been using Debian linux for a few years now and always struggled with expanding the LVM volumes. I know this question is asked a lot..

I usually follow a guide on google on creating the new partition and expanding the volume but because i have hit the limit i am unable to do so.

I was wondering what the correct steps are to merge 2 volumes to i can create a new volume to add the additional space?

You will see there is 128GB in the fdisk available but only 70GB available.

df -h output

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/servername-root
68G 60G 4.9G 93% /
tmpfs 1.5G 0 1.5G 0% /lib/init/rw
udev 1.5G 116K 1.5G 1% /dev
tmpfs 1.5G 0 1.5G 0% /dev/shm
/dev/sda1 228M 15M 202M 7% /boot


vgdisplay
--- Volume group ---
VG Name servername
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 69.75 GiB
PE Size 4.00 MiB
Total PE 17856
Alloc PE / Size 17856 / 69.75 GiB
Free PE / Size 0 / 0
VG UUID Z67FQC-4k2U-rca6-7anh-NDzw-2Rjz-23o7jd


fdisk

Code: Select all
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000de4a7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          32      248832   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              32        2611    20719617    5  Extended
/dev/sda3            2611        9137    52422456+  8e  Linux LVM
/dev/sda5              32        2611    20719616   8e  Linux LVM

Disk /dev/dm-0: 74.0 GB, 73979133952 bytes
255 heads, 63 sectors/track, 8994 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 914 MB, 914358272 bytes
255 heads, 63 sectors/track, 111 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table



Is anyone able to explain the best way to expand the volume?
letthiswork1
 
Posts: 1
Joined: 2019-10-18 04:38

Re: Expanding LVM volume

Postby p.H » 2019-10-18 12:51

letthiswork1 wrote:i have hit the limit

What limit ?
letthiswork1 wrote:what the correct steps are to merge 2 volumes

What kind of volumes do you want to merge (logical, physical, other...) and what do you mean precisely by "merge" ? LVM does not merge either physical or logical volumes.
letthiswork1 wrote:You will see there is 128GB in the fdisk available but only 70GB available.

What do you mean by "available" (in both instances) ?

Note : you seem to be using an obsolete version of fdisk which uses cylinders (deprecated) as the size units. fdisk from util-linux in Debian does not do this since Jessie at least. Could it be gnu-fdisk ?

fdisk shows that you created a primary partition sda3 after the extended partition sda2, instead of expanding the extended partition and create a new logical partition sda6. This leaves the ability to create only one more primary partition sda4 in the unallocated space after sda3. Make sure you use all the available space for the new partition, because you won't be able to create another partition so any unallocated space would be unusable.

After you created this partition with type LVM and informed the kernel so that you can use it, add it to the volume group.
Code: Select all
vgextend servername /dev/sda4

Then you can extend an existing logical volume and its filesystem.
Code: Select all
lvextend -L+xxG /dev/servername/lvname # add xx GiB to current size
lvextend -LxxG /dev/servername/lvname # increase size to xx GiB
resize2fs /dev/servername/lvname # extend ext2/3/4 filesystem to new volume size

Or create a new logical volume of size xx GiB.
Code: Select all
lvcreate -n lvname -LxxG servername
p.H
 
Posts: 1151
Joined: 2017-09-17 07:12


Return to System configuration

Who is online

Users browsing this forum: No registered users and 11 guests

fashionable