Linux virtual machines (LVM) are a powerful tool for managing storage and computing resources. In this article, we will show you how to use a graphical user interface (GUI) to manage LVM virtual machines. First, create a new LVM virtual machine by clicking the New Virtual Machine button in the Virtual Machine Manager window. The New Virtual Machine wizard will guide you through the process of creating a new LVM virtual machine. The first step in setting up an LVM virtual machine is to select the disk type and size for your new virtual disk. You can create a new disk or use an existing disk on your computer. We recommend using at least 1 GB of space for each LVM virtual disk. Next, choose the type of filesystem that you want to use for your new virtual disk. You can choose ext4, xfs, or btrfs as your filesystem type. We recommend using ext4 as your filesystem type because it is supported by most modern Linux distributions and it offers good performance when storing large files on disks. After selecting your filesystem type and size, click Next to continue setting up your new LVM virtual machine. The next step in setting up an LVM virtual machine is to choose a name for your new virtual machine and specify the location where you want to store it on your computer. ..


We’ve talked about how to use LVM before, but what if you wanted to accomplish the same tasks only with a comfortable graphical interface? HowTo Geek dives into how to manage LVM drives with a GUI.

Image by marfis.

Introduction

The Logical Volume Manager or LVM, has already been covered on HTG as well as why you should use it. As LVM is becoming more and more mainstream, where some of the major distribution players like CentOS and Ubuntu with their latest 12.10 release, now installing on LVM by default, you may come across it sooner then you might think. With the above it will probably won’t be long before the time that you would want to administrate an LVM, to increase the space available on the volume for example… with that said, what could be more pleasant then having a nice graphical interface to do the job? Nothing, so lets install one.

Install LVM GUI utility

The utility that we will be using to perform the job is “system-config-lvm” from Redhat. as this utility has been repackaged for Ubuntu, the only difference between the two, is how you install it.

On CentOS

You can install the package using the CLI, by issuing in a terminal:

Once installed, you can issue the utility name with sudo for admin rights to launch it:

Alternatively, You may wish to install the package using the graphical package manager. To do that, go to “system” -> “Administration” -> “Add/Remove Software”.

Search for “LVM” in the filter box to find the “system-config-lvm” utility down at the bottom.

Select the checkbox and “Next -> Next -> Finish” to accept the installation and it’s key. Once installed (this is true for the CLI way as well), the program will appear under “System” -> “Administration” -> “Logical Volume Management”.

Click It to Open the program. At this point you may skip to the “Using” segment at the bottom.

On Ubuntu

The newest version of Ubuntu (12.10 at the time of this writing), now ships with LVM as an integral part. That is good news, because on previous releases, while you could install the system-config-lvm utility, you would also have to install about 180MB worth of missing LVM stuff with it. This would make the “just get in and out with a live CD” use case a bit slower. Moreover you had to issue a manual command so that all of the functions of the utility, namely the filesystem re-sizing, would work.

Open the “Ubuntu software center” and look for “LVM”.

Click on the “Logical Volume management” row and then click “More info”.

Because the LVM utility comes from the Linux “Universe”, we have to first enable the repository by clicking on “Use This Source”. Once the resource is enabled and the package manager has been updated (have patience as this may take a short while), you will get the option to install the program. Click “install”.

Once installed, if you are running a version earlier then 12.10, you’re gonna want to drop to a shell to issue the following single command, which will enable the utility’s filesystem re-sizing ability.

Now you can open the program by clicking its icon.

Using the utility

If you’ve read our “What is Logical Volume Management and How Do You Enable It in Ubuntu?” guide, you’ve probably noticed that all of the LVM setup there, is done in the command line. With this program, you could perform all of the setup necessary to create an LVM from scratch with the GUI.

With that said, for the purpose of this example, we will not be setting up an LVM, but rather walk through the one of the most prominent use case scenarios of “increasing the available disk space” for a volume.

New space for a volume can come in many forms, maybe you’ve physically added and HD to the system, maybe you’ve increased the disk for a VM… it doesn’t really matter the procedure of adding the space to a volume is very similar.

Initialize the “New space” for LVM usage. Add the “New space” to the Physical Volume(PV). Allocate the “New space” in the PV to the Logical Volume(LV). Increase a specific Logical Volume size. Increase the filesystem on the LV.

Initializing the “New space”

For this example, we’ve opted to go the “There is a new HD in the system” route, and now we will prepare it for LVM use.

Expand the “Uninitialized Entities” tree menu, and find the “new space” (in our case, that’s “/dev/sdb”) and select it.

Once Selected click on “Initialize Entity”.

Click yes to confirm you understand that the data on the disk will be destroyed.

Note: In our example, we haven’t partitioned the disk for simplicity’s sake, but you are advised (even by the program) to do so.

Add the “New space” to the Physical Volume(PV)

Now that the “New space” has been initialized, it can be added to and existing “Volume Group”.

Once you click “Add to existing Volume Group”, you will be presented with a list of the detected groups on the system. In our example, the Volume Group we will be adding to, is the one Ubuntu was installed on with the 12.10 installer which had the LVM option enabled. As the Volume Group was created for us by the installer, it chose the name “Ubuntu”.

Select the Volume Group if its not selected and click on “Add”.

Allocate the “New space” in the PV to the Logical Volume(LV)

Once the “New space” has been added to the PV, you will see the new “Unused Space” as part of the Logical Volume Group, as in the picture below.

Increase a specific Logical Volume size

In order to have a “Logical Volume” use the “New space”, expand the “Logical View” tree menu and select the Logical Volume you wish to increase. In our example, that would be the “root” volume.

Once the Logical Volume is selected, click on “Edit Properties”.

The “Edit Logical Volume” window enables you to change the size of the Volume, using a simple slider or a “Use remaining” button.

Increase the filesystem on the LV

If the system fully supports LVM, as CentOS and Ubuntu 12.10 do (for 12.04, see the comment in the installation segment) clicking OK, will also increase the size for the  filesystem which resides inside of the Logical Volume… neat haa? :)

It is the hope of this writer, that this guide has changed what was once a “oh dear gowaaad, i’ll have to pull out the manual and my hair again” procedure to a “sure, what’s the problem” one… :)

A Command Line is great for the copy & paste reproducibility, not for the monkey understanding or usability… (Aviad Raviv 2009)