1
00:00:00,000 --> 00:00:17,620
Hey guys and welcome back. So what I want to talk to you about in this skill right here

2
00:00:17,620 --> 00:00:27,940
is the concept of LVM. Now what LVM actually stands for, it stands for the logical volume

3
00:00:27,940 --> 00:00:34,899
manager or sometimes referred to as logical volume management. So let me first begin

4
00:00:34,899 --> 00:00:41,460
describing what logical volume manager actually does for us by giving you a scenario. So let's

5
00:00:41,460 --> 00:00:47,299
say that you want to have additional storage space, okay? Simply put, what you actually have

6
00:00:47,299 --> 00:00:53,700
right now is not cutting it. So you actually ask if you can get an expansion of your current

7
00:00:53,700 --> 00:00:59,220
storage situation. So let's say for whatever reason you maybe happen to need, let's just say

8
00:00:59,220 --> 00:01:06,579
another 15 gig of storage. And in order to be helpful to you, well your team does supply you

9
00:01:06,579 --> 00:01:12,420
with this extra 15 gig. But what they do is they come and they bring three different drives. One is

10
00:01:12,420 --> 00:01:19,140
a 5 gig drive, the other is a 5 gig drive, and the last one is a 5 gig drive. Now in total,

11
00:01:19,780 --> 00:01:27,540
this does give you 15 gigabits of additional storage. But what if maybe the software or the

12
00:01:27,540 --> 00:01:34,980
application you need actually needs the entire 15 gig. What disk exactly then are you going to put

13
00:01:34,980 --> 00:01:42,180
this on? Because you can't put the 15 gig on this 5 gig, it's not enough, nor this one, nor this one.

14
00:01:42,180 --> 00:01:48,659
Instead, what you would have to do is you would have to aggregate these devices and combine them so

15
00:01:48,659 --> 00:01:56,500
that they could actually yield their combined storage space of 15 gigabytes. Now this is exactly

16
00:01:56,500 --> 00:02:02,899
what we're talking about when we mention the types of problems that LVM can actually solve. So let me

17
00:02:02,899 --> 00:02:09,060
first describe to you the basic architecture of how LVM works. And then we'll list some of the

18
00:02:09,060 --> 00:02:16,180
advantages of using LVM and we'll also mention some of the potential downfalls of using LVM.

19
00:02:16,260 --> 00:02:22,099
Honestly, I will say that I do believe LVM is an absolutely amazing technology. This is something

20
00:02:22,099 --> 00:02:28,260
you absolutely want to learn, not just for the purposes of the LPIC2 examination, but as a Linux

21
00:02:28,260 --> 00:02:34,100
engineer. This is something that's going to be so useful to you on a very regular basis, in my opinion.

22
00:02:34,100 --> 00:02:39,300
So let's dig into the architecture. Let's find out how this technology works. Let's see how it's

23
00:02:39,300 --> 00:02:44,580
going to solve this problem. So well, why don't we just dig right into it right away then shall we?

24
00:02:44,660 --> 00:02:51,220
So what I'll do is I will clear my screen. Okay, so let me first begin by highlighting

25
00:02:51,220 --> 00:03:00,660
three main concepts that are going to make up the LVM architecture. One is known as APV. The next one

26
00:03:00,660 --> 00:03:09,140
is known as AVG and the last one is known as an LV. Now what are these rather cryptic sounding

27
00:03:09,139 --> 00:03:15,299
names? Well, it actually isn't quite so cryptic. The first one is simply called a physical volume.

28
00:03:15,299 --> 00:03:23,699
The next one is called a volume group and the last one is called a logical volume. So let's

29
00:03:23,699 --> 00:03:29,619
actually tackle these one by one and then see how they all actually relate to one another. So we'll

30
00:03:29,619 --> 00:03:36,579
start off with the very first one, the PV, the physical volume. Now, when you have a whole bunch

31
00:03:36,660 --> 00:03:42,500
of different physical devices, like in the example I said, you are presented with three different

32
00:03:42,500 --> 00:03:49,620
five gigabit hard drives, five here, five here and five here. These are actually physical hard

33
00:03:49,620 --> 00:03:54,900
drives we're talking about here. Okay, someone actually walks in to the room with three hard drives

34
00:03:54,900 --> 00:04:02,740
in their hands and gives them to you. Now, in order to be able to use these devices as PVs, physical

35
00:04:02,740 --> 00:04:09,219
volumes, we would take them and we would have to mark it with an LVM header. We'll get to see how we

36
00:04:09,219 --> 00:04:16,180
actually do this in the next nugget, but really just conceptualize the PVs as the actual disks that

37
00:04:16,180 --> 00:04:23,139
we're using, the block devices that we can ultimately assign a header to be used as a physical volume.

38
00:04:23,139 --> 00:04:31,300
So now if we can use these as a physical volume, these three different devices, and the problem is

39
00:04:31,300 --> 00:04:39,139
as we denoted that we need 15 gigabytes of storage combined, not three individual five

40
00:04:39,139 --> 00:04:44,100
gigabytes of storage. You can probably guess what we want to do. We want to combine these

41
00:04:44,100 --> 00:04:51,139
and when we actually combine these three physical volumes into one big chunk, so we aggregate it

42
00:04:51,139 --> 00:04:58,660
as 15 gig, that aggregation is known as the volume group. This is the VG that we create.

43
00:04:58,660 --> 00:05:03,860
Like I say, this would now be combined to be 15 gigabytes. So really all we're talking about with

44
00:05:03,860 --> 00:05:11,220
respect to the volume group, this is the big logical chunk that is made up of multiple physical

45
00:05:11,220 --> 00:05:18,420
volumes. Pretty cool. Now, now that we actually have this big 15 gigabit logical chunk, if we

46
00:05:18,420 --> 00:05:25,460
actually want to segment this, we could segment it into our logical volume. So let's say we split it

47
00:05:25,539 --> 00:05:34,180
in half and we give 7.5 gig here and 7.5 gig here. This would be one logical volume and this would be

48
00:05:34,180 --> 00:05:41,539
another logical volume. Now, right now, it may not be apparent why this is useful, you're thinking,

49
00:05:41,539 --> 00:05:47,219
okay, so we had these multiple disks, we combined them just so we could then chop them up further.

50
00:05:47,219 --> 00:05:54,500
But the reality is, this is very, very flexible. So let me show you. For a start, one thing is that

51
00:05:54,500 --> 00:06:00,980
the physical devices do not have to be the same size. In my example, I gave a very simple example

52
00:06:00,980 --> 00:06:06,980
of three 5 gigabyte devices. That doesn't actually have to be the case. Let's say we had, I don't know,

53
00:06:07,540 --> 00:06:14,899
one device here, which was 2 gig, and the second device was 5 gig, and maybe another device was

54
00:06:14,899 --> 00:06:22,259
3 gig, and we had one here for 20 gig, a little bit bigger. So what we have now are four distinct

55
00:06:22,339 --> 00:06:28,099
devices, each with their own space. Now, let's say we wanted to have three distinct projects,

56
00:06:28,099 --> 00:06:34,980
whatever that may actually comprise of, and each of those projects were going to take up 10 gig each.

57
00:06:34,980 --> 00:06:40,500
What disk could you choose right now in order to fill this out? Well, you could put two of the

58
00:06:40,500 --> 00:06:46,740
projects on this one here, because you could have 10 and 10, and now this one would be completely

59
00:06:47,060 --> 00:06:52,500
full. But what about that last project that requires 10 gig? Which device would you choose?

60
00:06:52,500 --> 00:06:59,540
The reality is you can't, but what we could do is we could combine all of these. So we had 20,

61
00:06:59,540 --> 00:07:07,139
add 3, which is 23, add 5, which is 28, add 2, which is 30. So we say let's take these four

62
00:07:07,139 --> 00:07:15,220
individual devices, let's create a volume group of 30, and we could put the three projects on

63
00:07:15,220 --> 00:07:21,300
this particular volume group. But what if, let's say for example, you wanted to have each one on a

64
00:07:21,300 --> 00:07:26,340
separate partition, let's just say, or using a different file system? Well, like I say, we could

65
00:07:26,340 --> 00:07:33,700
carve this up. So now we have this 30 gigabyte chunk, so that this is 10, and this is also 10,

66
00:07:33,700 --> 00:07:39,380
and we could have partition one, partition two, partition three, all with different file systems

67
00:07:39,380 --> 00:07:44,260
if we so choose, and we could put the first project here, the second project here, and the third

68
00:07:44,259 --> 00:07:51,379
project here. And under the hood, we are actually utilizing four physical devices, but we are able

69
00:07:51,379 --> 00:07:57,939
to combine them and segment them however we want. So really, you can gather up these physical devices,

70
00:07:57,939 --> 00:08:05,219
smash them all together so that they're like one big massive chunk, and you can choose to divide

71
00:08:05,219 --> 00:08:11,620
and chop this up like a pizza in whatever sizes you actually wish. So when you're using LVM,

72
00:08:11,620 --> 00:08:18,420
as we can see here, we can aggregate cheap physical disks to make one large logical chunk and chop

73
00:08:18,420 --> 00:08:24,740
that up as we wish. When we're dealing with LVM, we don't just get our physical disks and then,

74
00:08:24,740 --> 00:08:31,699
you know, blend it into a large volume group, subdivide it as we may wish, and then we're done.

75
00:08:31,699 --> 00:08:37,460
If we want to extend our logical volume by adding more disks later on, then we have the

76
00:08:37,460 --> 00:08:44,740
ability to extend this because like I say, around LVM, we have tons and tons and tons of

77
00:08:44,740 --> 00:08:53,060
flexibility. Similarly, if we want to shrink our LVM, we can reduce the size, we can reduce the

78
00:08:53,060 --> 00:08:58,259
disks that we are using, or we can just shrink the logical size of particular partitions,

79
00:08:58,259 --> 00:09:04,340
whatever it may be. All of this is available to you when you choose to use LVM. This is why it's

80
00:09:04,340 --> 00:09:10,580
so, so useful. So the question is, how exactly do we utilize this technology? How can we actually

81
00:09:10,580 --> 00:09:17,139
build these volume groups and subdivide them into logical volumes? Well, we will absolutely be

82
00:09:17,139 --> 00:09:21,540
looking at that in the very next nuggets. I hope this has been informative for you and I'd like to

83
00:09:21,540 --> 00:09:23,060
thank you for viewing.

