When managing disk space on a Ubuntu system, there may come a time when you need to resize a Logical Volume (LV) to accommodate for increased storage demands. This guide will walk you through the process step by step.

For me, it was necessary to expand my Ubuntu VM in Proxmox.

I first had 24GB Before Resizing and then expanded to 56GB After Resizing

Introduction

Logical Volume Management (LVM) provides a flexible and scalable way to manage disk space in Ubuntu systems. By using LVM, you can resize logical volumes to meet changing storage requirements without disrupting system operations.

Prerequisites

Before starting the resizing process, ensure you have the following:

  • Access to the Ubuntu system with root privileges.
  • Backup important data to avoid the risk of data loss.

Procedure

  1. Access Root Shell:

Change to the root user:

sudo su -l
  1. Identify the Disk and Partition:

Use fdisk to list available disks and partitions:

fdisk -l
  1. Extend the Partition::

Use growpart to extend the partition. Replace /dev/sda with your disk identifier and 3 with the partition number you want to extend:

growpart /dev/sda 3
  1. Update Physical Volume (PV):

Display information about physical volumes with pvdisplay, then resize the physical volume:

pvdisplay
pvresize /dev/sda3
  1. Extend Logical Volume (LV):

Extend the logical volume to utilize the available space. Replace /dev/ubuntu-vg/ubuntu-lv with your volume path:

lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
  1. Display Logical Volume Information:

Verify the extension using lvdisplay:

lvdisplay
  1. Resize File System:

Resize the file system on the logical volume to reflect the changes made:

resize2fs /dev/ubuntu-vg/ubuntu-lv
  1. Verify Changes:

Confirm that the volume has been successfully resized:

df -h
  1. Verify Logical Volume Changes:

Verify the logical volume changes and the increased space:

lsblk

Conclusion

By following the above steps, you have successfully resized the Ubuntu Logical Volume on LVM, allowing for additional storage space to be utilized. Remember to exercise caution when manipulating disk partitions and volumes to avoid data loss.

For further information and troubleshooting, refer to the official Ubuntu documentation and community forums.