Hey guys and welcome back. So what I want to talk to you about in this skill right here
is the concept of LVM. Now what LVM actually stands for, it stands for the logical volume
manager or sometimes referred to as logical volume management. So let me first begin
describing what logical volume manager actually does for us by giving you a scenario. So let's
say that you want to have additional storage space, okay? Simply put, what you actually have
right now is not cutting it. So you actually ask if you can get an expansion of your current
storage situation. So let's say for whatever reason you maybe happen to need, let's just say
another 15 gig of storage. And in order to be helpful to you, well your team does supply you
with this extra 15 gig. But what they do is they come and they bring three different drives. One is
a 5 gig drive, the other is a 5 gig drive, and the last one is a 5 gig drive. Now in total,
this does give you 15 gigabits of additional storage. But what if maybe the software or the
application you need actually needs the entire 15 gig. What disk exactly then are you going to put
this on? Because you can't put the 15 gig on this 5 gig, it's not enough, nor this one, nor this one.
Instead, what you would have to do is you would have to aggregate these devices and combine them so
that they could actually yield their combined storage space of 15 gigabytes. Now this is exactly
what we're talking about when we mention the types of problems that LVM can actually solve. So let me
first describe to you the basic architecture of how LVM works. And then we'll list some of the
advantages of using LVM and we'll also mention some of the potential downfalls of using LVM.
Honestly, I will say that I do believe LVM is an absolutely amazing technology. This is something
you absolutely want to learn, not just for the purposes of the LPIC2 examination, but as a Linux
engineer. This is something that's going to be so useful to you on a very regular basis, in my opinion.
So let's dig into the architecture. Let's find out how this technology works. Let's see how it's
going to solve this problem. So well, why don't we just dig right into it right away then shall we?
So what I'll do is I will clear my screen. Okay, so let me first begin by highlighting
three main concepts that are going to make up the LVM architecture. One is known as APV. The next one
is known as AVG and the last one is known as an LV. Now what are these rather cryptic sounding
names? Well, it actually isn't quite so cryptic. The first one is simply called a physical volume.
The next one is called a volume group and the last one is called a logical volume. So let's
actually tackle these one by one and then see how they all actually relate to one another. So we'll
start off with the very first one, the PV, the physical volume. Now, when you have a whole bunch
of different physical devices, like in the example I said, you are presented with three different
five gigabit hard drives, five here, five here and five here. These are actually physical hard
drives we're talking about here. Okay, someone actually walks in to the room with three hard drives
in their hands and gives them to you. Now, in order to be able to use these devices as PVs, physical
volumes, we would take them and we would have to mark it with an LVM header. We'll get to see how we
actually do this in the next nugget, but really just conceptualize the PVs as the actual disks that
we're using, the block devices that we can ultimately assign a header to be used as a physical volume.
So now if we can use these as a physical volume, these three different devices, and the problem is
as we denoted that we need 15 gigabytes of storage combined, not three individual five
gigabytes of storage. You can probably guess what we want to do. We want to combine these
and when we actually combine these three physical volumes into one big chunk, so we aggregate it
as 15 gig, that aggregation is known as the volume group. This is the VG that we create.
Like I say, this would now be combined to be 15 gigabytes. So really all we're talking about with
respect to the volume group, this is the big logical chunk that is made up of multiple physical
volumes. Pretty cool. Now, now that we actually have this big 15 gigabit logical chunk, if we
actually want to segment this, we could segment it into our logical volume. So let's say we split it
in half and we give 7.5 gig here and 7.5 gig here. This would be one logical volume and this would be
another logical volume. Now, right now, it may not be apparent why this is useful, you're thinking,
okay, so we had these multiple disks, we combined them just so we could then chop them up further.
But the reality is, this is very, very flexible. So let me show you. For a start, one thing is that
the physical devices do not have to be the same size. In my example, I gave a very simple example
of three 5 gigabyte devices. That doesn't actually have to be the case. Let's say we had, I don't know,
one device here, which was 2 gig, and the second device was 5 gig, and maybe another device was
3 gig, and we had one here for 20 gig, a little bit bigger. So what we have now are four distinct
devices, each with their own space. Now, let's say we wanted to have three distinct projects,
whatever that may actually comprise of, and each of those projects were going to take up 10 gig each.
What disk could you choose right now in order to fill this out? Well, you could put two of the
projects on this one here, because you could have 10 and 10, and now this one would be completely
full. But what about that last project that requires 10 gig? Which device would you choose?
The reality is you can't, but what we could do is we could combine all of these. So we had 20,
add 3, which is 23, add 5, which is 28, add 2, which is 30. So we say let's take these four
individual devices, let's create a volume group of 30, and we could put the three projects on
this particular volume group. But what if, let's say for example, you wanted to have each one on a
separate partition, let's just say, or using a different file system? Well, like I say, we could
carve this up. So now we have this 30 gigabyte chunk, so that this is 10, and this is also 10,
and we could have partition one, partition two, partition three, all with different file systems
if we so choose, and we could put the first project here, the second project here, and the third
project here. And under the hood, we are actually utilizing four physical devices, but we are able
to combine them and segment them however we want. So really, you can gather up these physical devices,
smash them all together so that they're like one big massive chunk, and you can choose to divide
and chop this up like a pizza in whatever sizes you actually wish. So when you're using LVM,
as we can see here, we can aggregate cheap physical disks to make one large logical chunk and chop
that up as we wish. When we're dealing with LVM, we don't just get our physical disks and then,
you know, blend it into a large volume group, subdivide it as we may wish, and then we're done.
If we want to extend our logical volume by adding more disks later on, then we have the
ability to extend this because like I say, around LVM, we have tons and tons and tons of
flexibility. Similarly, if we want to shrink our LVM, we can reduce the size, we can reduce the
disks that we are using, or we can just shrink the logical size of particular partitions,
whatever it may be. All of this is available to you when you choose to use LVM. This is why it's
so, so useful. So the question is, how exactly do we utilize this technology? How can we actually
build these volume groups and subdivide them into logical volumes? Well, we will absolutely be
looking at that in the very next nuggets. I hope this has been informative for you and I'd like to
thank you for viewing.