How to resize LVM volumes on Linux
Proponents of LVM often say that one of its benefits (and why you should use it) is because users can re-size, manipulate and modify LVM partitions on the fly. Resizing LVM partitions is indeed a fantastic feature, and it’s sure to make those opposed to the technology rethink.
Today in this guide, we’re going to go over how to manipulate and resize LVM volumes on Linux. We’ll cover how to do it in two ways: the terminal, and the KDE Partition manager.
Note: while re-sizing LVM partitions is considered safe, you should still backup your data before continuing with the rest of this post.
Resize LVM volumes – KDE Partition Manager
Long ago, manipulating LVM partitions with a GUI tool was done with System Config LVM. Unfortunately, that program is deprecated, hasn’t been updated, and doesn’t support the latest logical volume management features.
Thankfully, if you’re not a fan of working with LVM volumes in the terminal, there’s still a GUI tool you can use: the KDE Partition manager.
Install KDE Partition Manager
The KDE Partition Manager is the default partitioning tool for Linux operating systems that choose the KDE Plasma 5 desktop environment rather than Gnome Shell or others. However, if you’re not a Plasma user, you’ll likely need to install the app before using it to manipulate LVM volumes.
To install the KDE Partition manager, open up a terminal and follow the instructions that correspond with the Linux distribution you currently use.
Ubuntu
sudo apt install partitionmanager
Debian
sudo apt-get install partitionmanager
Arch Linux
sudo pacman -S partitionmanager kdesu
Fedora
sudo dnf install kde-partitionmanager kdesu
OpenSUSE
sudo zypper install partitionmanager
Generic Linux
The source code for the KDE Partition manager is available online, and most Linux distributions should be able to install it. To get the app working on your OS, head over to the code website and download it to get started.
Using KDE Partition manager
Now that the KDE Partition manager application is up and running, you’ll be ready to use it to resize LVM volumes.
To start, open up the application menu, search for “KDE Partition Manager” and open it up.
Note: KDE Partition Manager has issues running on Gnome Wayland. Be sure to log into X11 mode before attempting to run it!
With the app open, look to the left-hand side of the app under “Devices” and select the hard drive that contains the LVM volumes you want to manipulate.
Clicking on the LVM drive should instantly show its partition layout on-screen. From here, locate the LVM partition and right-click on it.
Note: depending on the partition, you may need to click “unmount” before working with it.
In the selection menu, click the “resize” option and use the GUI tool to change the size of your LVM volume.
Resize in-use Root partitions
The Linux system does not allow manipulation of the root file system if it’s in use (even with LVM). Therefore, if you’d like to resize an LVM Root partition, you must boot into a live disk.
To get the live disk going, follow the step-by-step instructions below.
Step 1: Download the latest version of Kubuntu and flash it to a USB drive with Etcher.
Step 2: Boot into the Kubuntu live disk and select “try Kubuntu.”
Step 3: When the desktop loads, open up the KDE Partition manager and follow the re-size instructions outlined earlier in the guide.
Resize LVM volumes – Terminal
Resizing LVM volumes in the Linux terminal is quite straight-forward. Here’s how to do it.
First, view your LVM volumes with the lvdisplay command.
sudo lvdisplay
Running the lvdisplay command will show a complete print-out of all of the LVM volumes on your Linux PC. From there, take note of the volume you’d like to resize. Then, go to the terminal and resize with the command below.
Note: change XG to the number of GBs you wish to use as the new size. You can also use MB.
Shrink
sudo lvresize --verbose --resizefs -L -XG /dev/lvm/path
Extend
sudo lvresize --verbose --resizefs -L +XG /dev/lvm/path
Resize in-use Root partitions in terminal
Need to resize a partition currently used as your Linux machine’s Root in a terminal? Follow the step-by-step instructions below.
Step 1: Download an Ubuntu live disk and flash it to a USB stick with Etcher.
Step 2: Boot into Ubuntu, click on “Try Ubuntu” and let the desktop load.
Step 3: Launch a terminal window and gain root access by entering sudo -s. Then, run the lvdisplay command to print out the LVM partitions on the system.
Step 4: Follow the terminal re-size instructions outlined earlier in this post to change the size of your LVM.