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.
You can install the package using the CLI, by issuing in a terminal:
yum install system-config-lvm
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.
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…