The Importance of Logical Volume Management

logical-volume-management

The Importance of Logical Volume Management

LVM is a concept that is still debated at many IT forums and by computer enthusiasts worldwide, so throughout this post, we’re going to go over the concept, as well as analyze some other concepts like virtualization, Oracle monitoring, MySQL monitoring and database performance monitoring as well.

lvmDefining LVM: Logical Volume Management Definition

When it comes to computer storage, Logical Volume Management is a method that allows for the allocation of space on devices that is far more versatile than the mass-storage conventional schemes of partitioning.

In fact, a manager can easily stripe or combine different partitions, as well as concatenate them and block devices into virtual ones that can easily be managed without even having to interrupt the system.

This is called storage virtualization, and it happens in a separate layer on the device-driver stack f any OS, not in network storage systems.

Your usual hard disks, partitions, and LUNs are your physical volumes, also known as PVs. What happens is that these PVs are then interpreted as chunks of PEs or physical extents. These can have either variable sizes (Veritas) or fixed sizes (Linux) and can then be fused or separated at will.

LVs which are striped will allocate each LE from PVs and therefore can increase performance on sequential reads (especially large ones).

The LVs can easily be grown by using more LEs, or on the contrary be shrunk if you strip LEs from them.

It is worthy of note that if you are changing the size of an LV, the file system on it won’t necessarily change.

 

How Are LVM Volumes different from Normal Partitions:

When LVM still wasn’t a thing, you only had the hard drive, and you could partition said hard drive and install files on each of these partitions.

Now, imagine a drive with two partitions, like 1 and 2. Outside of the partitions, there is free space that is currently unused.

File systems are present and mounted on partition 1 and 2.

What you are going to have is a 1-1 correlation of possible file systems and disk partitions.

However, what happens when you add LVM to the mix?

Image the same structure again, but this time with a separate layer with a group of disk partitions. Think of it like a virtual hard drive you can partition too.

Let’s match it with the previously scenario and add another physical volume making it three physical disks.

One partition takes the entire space of the first two disks, and the last one has half free space, half portioned disk.

Now, things get interesting with LVM as you can build a logical partition that is just as big as all of your disks combined. This particular volume group takes 2.5 disks, and it is divided into two, the full part bigger than any individual disk!

 

The Importance of LVM in Virtualization:

We are discussing storage virtualization right now, but if you think that this is recent then think again as it was with us for a long time by now.

In fact, there are many ways to achieve this virtualization, but what really matters with LVM is that you have the scale as well.

You can have host-based virtualization, which means you can use hosts’ software like LVM that allows you to map disks to large and logical storage pools

These pools are then allocated to servers.

These servers see this logical storage pools as actual disks when it really contains the data space to occupy several disks. It appears as a single disk because that is how it works when the pool is presented as such to the host. Even more layers of virtualization can be added.

Here are some example commands for LVM which you might find helpful and understand how things work in LVM.

Use pvcreate command to create Phyical volumes with two disk.

$ sudo pvcreate /dev/sda1 /dev/sdb1

Use pvscan command to check the physical volumes

$ sudo pvscan

Use pvdisplay command with attributes like size, phyiscal extent sie, total physical extent size, free space.

$ sudo pvdisplay

After Physical Volume is setup you can create Volume group with vgcreate command. volume group is basically a pool of storage that consists one or more physical volumes.

$ sudo vgcreate volgroup1 /dev/sda1 /dev/sdb1

Volume group “volgroup1” successfully created
Use vgdisplay command lists the created volume groups on the server.

$ sudo vgdisplay

After Volume Group time is to setup Logical Volumes which will be the actual volume available for VMs hosted on Xen and KVM virtualization. The following command will create one logical volume drive with size of 50GB

$sudo lvcreate -l 50G -n logVol1 volgroup1

You can create a ext4 file system on logVol1 to make it available for storage purpose.

$ sudo mkfs.ext3 /dev/volgroup1/logVol1

Well the good thing is you can resize the logical volume as per your needs. So now lets extend the logical volume with additional 50GB.

$ sudo lvextend -L +50G /dev/volgroup1/logVol1

Finally resize the extended volume

$ sudo resize2fs /dev/volgroup1/logVol1

 

KVM and Xen Virtualizations:

Now let’s talk a bit about Xen. Xen is a hypervisor supporting Itanium, Arm, x86 and x86_64 architectures so it can run Linux, Solaris, Windows and some BSDs as guests. There are a lot of companies that support Xen, like Oracle VM and Citrix.

Xen only needs systems that support virtualization to do it fully but can act as an hypervisor if the systems don’t have the required virtualization extensions.

On the other hand, we have KVM which is an hypervisor in Linux Kernel’s mainline. Obviously, your host operating system must be Linux, but it also supports other guests like Solaris, Linux, Windows, BSD. It is going to run on x86-64 systems as well as x86 with the required virtualization extensions, so this isn’t really an option for Central Processing Units that were made before the virtualization extensions debut, also not being a choice on new CPUs like Atom from Intel as they also don’t include these extensions.

Hardware from datacenters that replace it from time to time isn’t an issue, but for people running systems like SM10000 this can be tricky, and if you’re using Atom CPUs in said data center, it becomes impossible.

virtualizationSo, bottom line, one of the best perks of using an LVM partition is its ability to not only resize a logical volume but also giving you more free space to use with each attachable disk. The selling point is really the easier it makes for storage managers to have it all on check.

However, this virtualization technique is still unknown to many, including some Linux software developers, which just goes to show that even though this is a very effective way to enhance the performance of data centers, some computers with large disks and storage managing, it still is far from being mainstream and sits in the shadows.

There are even more ways to use LVM that we didn’t address throughout this article, but we thought that the ability to alter a disk partition’s size in a dynamic way as something that new LVM users would like to know was possible, as well as some of the other perks mentioned throughout the post.

 

We hope you have learned a bit with our post, and that you now know about LVM, its features, its perks and the benefits it made available to virtualization fans and datacenters.

Xen virtualization is what we recommend, as KVM as serious limitations as far as compatibility is concerned

Share this post


24x7servermanagement