Extend LVM Disk on Linux Ubuntu 22.04

Tram Ho

What is LVM?

  • LVM (Logical Volume Manager) is a tool on Linux operating system that allows to manage drives and partitions more flexibly. Instead of dividing the drive into fixed partitions, LVM allows the creation of resizable virtual partitions, creating many smaller storage volumes to make the most of the free space.
  • With LVM, you can perform operations such as creating, resizing or moving virtual partitions dynamically, without having to change or move the files on that partition. This makes managing storage on the system easier and more flexible.
  • LVM is commonly used on server systems or large storage systems where managing storage space is a big challenge.

The concept

  • Physical Volumes (PVs): are the physical partitions on the drive. PVs can be physical drives, partitions on drives, or other storage devices.
  • Volume Groups (VGs): is a group of PVs that have been combined together. All PVs in that VG are managed as a single entity. With VG, users can create virtual partitions (LVs) of flexible sizes using the storage space on the PVs.
  • Logical Volumes (LVs): are virtual partitions created from VG’s storage space. LVs are managed like partitions on regular physical drives, and can be created, deleted, resized, and formatted similar to regular partitions.


For the server configuration as follows

IPHostnamevCPURAMDISK cores16G100G

After creating the ubuntu server successfully, I use the command

Screenshots 2023-03-13 at 11.06.58.png

then we use the command fdisk -l to check the entire hard drive space

Screenshots 2023-03-13 at 11.12.03.png

So my total hard drive capacity is 100G as I just received 50G, so we need to Extend another 50G

To extend LVM drive on Linux Ubuntu, please follow these steps:

1. Check the current status of the LVM partitions on the system with the following command

This command will display a list of existing LVM partitions on your system.

Screenshots 2023-03-13 at 11.16.39.png

2. Check the available space on the physical partition (PV) with the following command

This command will display information about the available and used capacity on the PV.

Screenshots 2023-03-13 at 11.17.47.png

3. Check the location of the LVM partition you want to extend with the following command

This command will display the list of partitions on your system.

Screenshots 2023-03-13 at 11.20.46.png

then I choose the name partition named

4.So the LVM partition is already there, now I just need to add the logical volume with the following command

Screenshots 2023-03-13 at 11.32.46.png

Continue command

Screenshots 2023-03-13 at 11.33.49.png

After running successfully, use the df -h command to check if the hard drive has been added

Screenshots 2023-03-13 at 11.34.34.png

So we have successfully extended 50G to the LVM partition

Thank you for following my article, if you find it interesting, please give me an upvote to have more motivation to share more useful articles.

Share the news now

Source : Viblo