Image

Knowledge base → Increasing LVM partition in Linux on VDS server

[Virtual servers]
Date of publication: 05.12.2022

On VDS servers, virtualization is implemented at the hardware level (Hypervisor). This type of virtualization emulates a physical server. When increasing the size of the SSD disk, you must also increase the partition of the logical disk in the operating system.

In this example, we will consider expanding an LVM partition on an Ubuntu 22.04 operating system installed with default settings. To view the existing partitions and their size, run the command:

df -h

Make sure the SSD partition is enlarged:

fdisk -l

Let's check the volume available to us to increase the partition:

lvdisplay

In most cases, you need to increase the partition to all available space, we will use the command:

lvextend -l +100%FREE /dev/mapper/ubuntu–vg-ubuntu–lv

In this case, we are expanding the /dev/mapper/ubuntu-vg-ubuntu-lv partition to all available space. If you need to increase several partitions by a specific amount, use the command, where 10G is 10 gigabytes

lvextend -L +10G /dev/mapper/ubuntu–vg-ubuntu–lv

After successful completion, you need to apply the changes with the command:

resize2fs /dev/mapper/ubuntu–vg-ubuntu–lv

Let's check the size and volume of our partitions with the command:

df -h

Done, the partition should match the size we specified.





No Comments Yet