Storage Management with an LVM GUI

Have you been looking for open-source storage management tools that are easy to use and provide a graphical representation of your storage. Alas, there are no comprehensive tools but there are graphical tools that you can pair with command-line wizardry, particularly LVM.

I’ve been on a quest for good open-source storage management tools. These tools, preferably a single tool, would allow me to create, control, and monitor all aspects of storage whether it be iSCSI based storage, NAS, local file systems, users, etc. It would be independent of the hardware yet have the ability to interact with many types of hardware such as RAID cards (the ones supported in the kernel) and networking devices (focused on storage networking). Alas, such a beast does not exist (at least that I can find) and the question of whether such a beast should exist is open for debate. However, in the absence of such a tool I decided to look for what tools are available. The one that I kept coming back to was LVM (Logical Volume Management).

LVM is a wonderful way of managing your storage devices. It abstracts storage into several layers that can be controlled and manipulated to give you the control you need over your storage devices. There are LVM command line tools that allow you to take physical devices and create groups or pools of virtual storage devices. Then you can divide these groups into virtual partitions that can then be used for file systems or for other uses (i.e. raw devices). The steps are not that difficult, but it is easy to get confused and when you are dealing with data, getting confused and making mistakes is not a good thing. So I decided to look for a GUI interface to LVM so I could get a reasonable representation of the state of the storage.

In a previous article I mentioned three GUI tools that interact with LVM. The one that came up consistently in my searching was system-config-lvm that comes with Redhat or it’s repackaged versions (i.e. CentOS, Scientific Linux). In this article I want to walk through using this tool to create and manipulate storage to illustrate how easy it is to use. While I wouldn’t classify myself as a person dependent upon a GUI tool for system administration, when everything is working well GUI’s do make life a little easier.

Quick review of LVM

LVM comes with virtually every distribution of Linux and allows you to abstract various pieces of physical storage into virtual groups that can be carved into chunks that form the basis of file systems (virtual partitions if you like). It also allows you to combine physical partitions into groups, resize these groups (grow or shrink), and manage these groups. To effectively use LVM there are some fundamental concepts in LVM that you need to understand (and master). Figure 1 below illustrates these concepts.

LVM_original_description.png
Figure 1 – LVM Concepts

At the bottom are the physical drives – in this case there are two drives, /dev/sdb and /dev/sdc. Each of these drives has two partitions. These two pieces form the “physical” basis of LVM. LVM itself sits above the physical devices and is shown in the light yellow area.

The physical partitions map to Physical Volumes (PV’s). So in Figure 1 the physical volumes are /dev/sdb1, /dev/sdb2, /dev/sdc1, and /dev/sdc2. From the Physical Volumes (PV’s), a Volume Group (VG) is created. A VG can use all or just one of the PV’s. In the example in Figure 1, the four PV’s are used in a single VG, primary_vg (note: the VG name actually ends in “_vg” to make it more noticeable). After creating one or more VG’s (Volume Groups), a Logical Volume (LV) is created. You have to have at least one Logical Volume (LV) per Volume Group (VG). These LV’s are used for creating file systems. In Figure 1, the VG is broken into two LV’s: /dev/primary_vg/home_lv and /dev/primary_vg/data_lv (again note the use of the “_lv” at the end of the name to better indicate a LV). Then on top of these these two PV’s are the file systems. For /dev/primary_vg/home_lv an ext3 file system is created and mounted as /home. For /dev/primary_vg/data_lv an xfs file system is created and mounted as /data.

In a shorter form, Physical Volumes (PV’s) are on the bottom of the stack and are really partitions on a disk (hence the use of the term “physical”). Above the PV’s is one or more Volume Groups (VG). Then you partition the VG into Logical Volumes (LV’s). These LV’s are used for creating file systems. If you like here are the steps or layers to LVM:

Disk Partition -> Physical Volumes (PV) -> Volume Group (VG) -> Logical Volume (LV) -> File System

If you’ve never used LVM before you may ask what have taken a two step process “Partition -> File System” and added three steps or layers. These additional steps or abstractions allow you to manipulate the storage (more on that in a bit).

Perhaps not the best way to think about LVM but one concept that can be useful is to think of the Volume Group (VG) as the “virtual hard drive”. It gathers real partitions (PV’s) into a virtual drive (the VG). Then you partition the “virtual drive” into Logical Volumes (LV’s). You can think of the LV’s as “virtual partitions.” Then you can create file systems or whatever else you need to do with the LV’s as though they are real physical devices.

Some advantages of LVM are:

  • You can “aggregate” physical volumes (PV’s) into a single volume
  • You can add or even remove PV’s from a Volume Group (VG) allowing you to resize it
  • You can resize Logical Volumes (LV’s) if there is enough storage in the underlying VG
  • If you increase an LV, you can possibly increase the size of a file system (if the file system allows this). This can typically be done without the loss of data.

Using the old approach of “Disk Partition -> File System” doesn’t give you this flexibility or control you need over your storage. When you are dealing with a large number of users with a large number of disks in a server, or even having to add storage to your desktop, having control and flexibility over your storage is very, very convenient.

If you read the previous article it walks through an example illustrating how to create PV’s, VG’s, and LV’s, and ultimately a file system. It is important to know the LVM command line commands in a general sense in case you need to use without a GUI (perhaps using only a remote console). Memorizing the various options is debatable (I’ve got a funny story about memorizing the myriad options for esoteric commands) but you should at least have some knowledge of the commands – perhaps even a cheat sheet or a log of the commands you used to arrive at the current configuration.

However, with LVM it is easy to make a mistake and lose data. So having a graphical representation of the steps in LVM can make things a lot easier. When I searched for GUI tools for LVM, the one that quickly rose to the top was system-config-lvm from Redhat.

Next: The Walkthru

Comments on "Storage Management with an LVM GUI"

btmanmeh

Thanks for the article and information. I\’ve been running Red Hat/CentOS for a long time now, and to be honest never once looked at system-config-lvm. Although it\’s not terribly hard to do simple things, like grow an LVM home partition on the command line, more complicated tasks often become confusing.

The GUI gives you a nice layout of everything in one screen, and looks like it really makes extending a volume group or logical volume very simple. Thanks again for sharing!

Reply
sreeny

Hi ., JFI ,system-config-lvm is also available for Ubuntu/Debian

Reply
yellow01

Red Hat 6 beta 2 Release Notes say that system-config-lvm is going to be replaced with gnome-disk-utility, with the former being no longer updated and later eventually removed from distribution.

I kind of liked this system-config-* approach, primarily for being desktop agnostic. IMHO, this is not the best decision. Perhaps someone from Red Hat should comment on it.

Very good article.

Reply
chuntera

Wouldn’t it be great if you didn’t have to unmount your volume to resize it ?

Reply
kikator

In the second paragraph after the fifth image should say “space used”and not “space user” am I right?

Reply
curmudgeonbob

Nice article. I read somewhere that the journaling ability of file systems is lost on LVM mounted file systems. If this is true, what happens if the machine is shut down suddenly because of power failure?

Also, I would like to know if it is possible to create LVM volumes over existing file systems containing valuable data. Just thinking out loud y’all.

Reply

Leave a Reply to btmanmeh Cancel reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>