Advance

A Clever Guide to Resize LVM Partition on Ubuntu 22.04

Resize LVM Partition on Ubuntu 22.04
5
(3)

If you are a system administrator, you should know that sometimes when the standard partitioning during installation does not fit the custom needs of the servers or the servers run out of usable disk space. For this reason, you usually need to change the size of the disks. This article will teach you How to Resize LVM Partition on Ubuntu 22.04. Eldernode offers an economically Ubuntu VPS Server, which you can check out the provided package to purchase it.

How to Resize LVM Partition on Ubuntu 22.04

In this guide, we will walk you through the process of resizing an LVM (Logical Volume Management) partition on Ubuntu 22.04. LVM allows you to dynamically manage your storage by adding, removing, or resizing partitions without the need to reboot your system. Follow these clever steps to resize your LVM partition efficiently and securely.

Note: This guide assumes you have basic knowledge of the Linux command line interface.

Recommended Article: How to install and use vi as a full text editor

What is LVM Partition?

LVM stands for Logical Volume Manager and is a flexible storage management system available on Ubuntu and many other Linux distributions. You can manage disk partitions, volumes, and file systems in a more dynamic and flexible way compared to traditional partitioning schemes using LVM. It is an advanced method than the traditional method of partitioning a disk into one or more sectors and formatting that partition with a file system.

Resizing LVM Partition on Ubuntu VPS

In the first step, you should collect information about current LVM settings and names. To do this, find out the physical volumes that are used by the LVM file system using the command below:

sudo pvs

And run the command below to find out the Volume group name:

sudo vgdisplay

Now you can get information about the Logical Volume as shown below:

sudo lvdisplay

Note that you need to insert the new virtual or physical disk. Once done, configure the inserted disk within the existing LVM file system.
Then identify the new disk using the command below:

sudo fdisk -l

Or

sudo lvmdiskscan

Next, create a new disk as Physical Volume on the server as shown below:

sudo pvcreate /dev/vdb

The output should be as follows:

Physical volume “/dev/vdb” successfully created.

Now it’s time to add the new Physical Volume to your existing Logical Volume. To achieve this, simply execute the command provided:

sudo vgextend ubuntu-vg /dev/vdb

The output should look something like this:

Volume group “ubuntu-vg” successfully extended.

And extend the Logical volume using the command below:

sudo lvm lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

Resize it as shown below:

sudo resize2fs -p /dev/mapper/ubuntu--vg-ubuntu--lv

Lastly, enter the following command to view the correct size of your file system:

df -h

That’s it!

Recommended Article: Initial server setup on Ubuntu 22.04

Conclusion

LVM is a system of managing logical volumes or filesystems that allows you to manage disk partitions, volumes, and file systems. In this article, we taught you how to resize the LVM partition on Ubuntu 22.04. I hope this tutorial was useful for you and that it helps you to resize the LVM partition on your Ubuntu server. If you have any questions or problems during the process, you can contact us in the Comments section.

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 3

No votes so far! Be the first to rate this post.

View More Posts
Tom Veitch
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

    Leave Your Comment

    Your email address will not be published.

    We are by your side every step of the way

    Think about developing your online business; We will protect it compassionately

    We are by your side every step of the way

    +8595670151

    7 days a week, 24 hours a day