1
00:00:00,000 --> 00:00:14,240
Hey guys and welcome back.

2
00:00:14,240 --> 00:00:20,039
So in the previous nugget we saw some basic LVM configuration and we could see some of

3
00:00:20,039 --> 00:00:25,519
the tools that we could use or the commands should I say that we could use to set up this

4
00:00:25,519 --> 00:00:26,519
technology.

5
00:00:26,519 --> 00:00:32,200
Now there are some additional commands that we do want to be aware of for the purposes

6
00:00:32,200 --> 00:00:33,200
of the examination.

7
00:00:33,200 --> 00:00:37,879
Let me just tell you what some of those are and what they can actually do for us.

8
00:00:37,879 --> 00:00:43,679
Now the first one I want to talk to you about is one called PVChange and again I would encourage

9
00:00:43,679 --> 00:00:47,840
you to read the man pages on these particular commands and explore everything that they

10
00:00:47,840 --> 00:00:48,840
are capable of.

11
00:00:48,840 --> 00:00:53,879
But as a high level overview to understand what these commands do for the examination,

12
00:00:53,880 --> 00:00:59,800
what this one does, it allows us to change attributes of a physical volume.

13
00:00:59,800 --> 00:01:04,159
The next command is one called PVMove.

14
00:01:04,159 --> 00:01:08,240
What this command is going to allow us to do, it's going to allow us to move, hence

15
00:01:08,240 --> 00:01:14,640
the name, data from one physical volume to another physical volume.

16
00:01:14,640 --> 00:01:21,000
So realistically when you want to happen to downsize a volume group, i.e. remove a physical

17
00:01:21,000 --> 00:01:27,000
volume, you may want to move that data first, in which case the PVMove command is going

18
00:01:27,000 --> 00:01:29,040
to allow you to do such a thing.

19
00:01:29,040 --> 00:01:34,640
Now following on in that vein, if we have our volume group, remember that big logical

20
00:01:34,640 --> 00:01:41,280
chunk, if we want to remove one of the physical volumes from that volume group, the command

21
00:01:41,280 --> 00:01:45,079
we would use is PVRemove.

22
00:01:45,079 --> 00:01:51,519
Similarly if we want to make changes to particular attributes of a logical volume, the command

23
00:01:51,519 --> 00:01:54,719
we could use would be LVChange.

24
00:01:54,719 --> 00:02:00,359
As we can see here we're following a similar format, PVChange changes attributes of a physical

25
00:02:00,359 --> 00:02:05,560
volume, LVChange changes attributes of a logical volume.

26
00:02:05,560 --> 00:02:13,039
Now if we want to actually extend a logical volume, we could use the command LVExtend.

27
00:02:13,159 --> 00:02:18,560
Similarly if we wanted to reduce the size of a logical volume, we could use the command

28
00:02:18,560 --> 00:02:20,560
LVReduce.

29
00:02:20,560 --> 00:02:26,599
And again if we want to make changes to a volume group, the command would be VGChange.

30
00:02:26,599 --> 00:02:32,799
And if we wanted to extend the size of a volume group, make our big logical chunk even bigger,

31
00:02:32,799 --> 00:02:36,479
we would use the command VGExtend.

32
00:02:36,479 --> 00:02:41,159
Now there is not enough time, definitely not, to display all of these commands and show

33
00:02:41,280 --> 00:02:42,719
you how to work with them.

34
00:02:42,719 --> 00:02:46,000
That would mean this scale would run on for way too long.

35
00:02:46,000 --> 00:02:50,879
So as always as homework I would suggest that you use the man page on these commands, check

36
00:02:50,879 --> 00:02:51,879
them out.

37
00:02:51,879 --> 00:02:55,840
But if you want to have a full listing of the available commands that we can use, if

38
00:02:55,840 --> 00:03:02,599
I just happen to say LVM and I press help and hit enter, we can actually see all of

39
00:03:02,599 --> 00:03:03,960
the different options right here.

40
00:03:03,960 --> 00:03:09,199
So if I scroll on up, we can see here LVCreate creates a logical volume.

41
00:03:09,239 --> 00:03:14,519
LVExtends ultimately extends and adds space to your logical volume.

42
00:03:14,519 --> 00:03:23,359
We can see LVRemove, LVRename, same with PVCreate, PVMove, VGCreate, VGReduce, so on and so forth.

43
00:03:23,359 --> 00:03:28,679
So what I will do is I will give you an example of one of these commands and what we will

44
00:03:28,679 --> 00:03:32,799
do is we will extend one of our logical volumes.

45
00:03:32,799 --> 00:03:35,239
So if I hit exit and I clear the screen.

46
00:03:35,240 --> 00:03:40,800
Okay, so if I do LVDisplay to see my logical volume and of course I'm always forgetting

47
00:03:40,800 --> 00:03:45,280
and my sudo command, so LVDisplay with sudo, hit enter.

48
00:03:45,280 --> 00:03:52,280
So how about we extend medium chunk and we will give it an additional let's say 100meg.

49
00:03:52,280 --> 00:03:57,560
Now we can see here the actual path here which we saw before but I do actually feel like I

50
00:03:57,560 --> 00:04:00,760
should make a note here just for clarity.

51
00:04:00,759 --> 00:04:08,639
See this path format of dev followed by the volume group followed by the logical volume.

52
00:04:08,639 --> 00:04:15,639
This is actually the naming convention with respect to LVM1 and you actually still see

53
00:04:15,639 --> 00:04:19,319
this even when using LVM2 which we have installed.

54
00:04:19,319 --> 00:04:22,519
I believe this is for backwards compatibility reasons.

55
00:04:22,519 --> 00:04:28,920
However you will have noticed in the previous nuggets we also saw the format of dev forward slash

56
00:04:28,920 --> 00:04:35,120
mapper forward slash and then the last part was the volume group with a hyphen and then

57
00:04:35,120 --> 00:04:37,000
the logical volume.

58
00:04:37,000 --> 00:04:42,080
This naming convention is actually the newer naming convention for LVM2.

59
00:04:42,080 --> 00:04:48,120
So both of these are kind of accepted albeit this one is the more modern and up to date

60
00:04:48,120 --> 00:04:49,120
one.

61
00:04:49,120 --> 00:04:54,960
So the command I will do is I will say sudo LV extend and I'll do dash L and now what

62
00:04:54,959 --> 00:04:59,120
I want to do is to specify the new size I want this to be.

63
00:04:59,120 --> 00:05:02,399
So I want to increase it by 100 to 600.

64
00:05:02,399 --> 00:05:05,239
I'm not going to say add 100.

65
00:05:05,239 --> 00:05:08,959
I'm actually going to give the new fixed size of 600.

66
00:05:08,959 --> 00:05:15,439
And I'll now say dev my storage chunk and then the name medium chunk.

67
00:05:15,439 --> 00:05:21,479
If I hit enter we can see here we have now successfully resized the medium chunk logical

68
00:05:21,480 --> 00:05:24,439
volume to be 600 megs.

69
00:05:24,439 --> 00:05:31,280
If I do my sudo LV display we can now see this has actually been resized.

70
00:05:31,280 --> 00:05:35,759
Now one thing I want to note is that if we want to do this again let me extend it maybe

71
00:05:35,759 --> 00:05:37,259
to 700.

72
00:05:37,259 --> 00:05:41,439
I will actually use the newer naming convention.

73
00:05:41,439 --> 00:05:46,439
So what I will do here is I will say sudo LV extend and I'll say dash L and I'll now

74
00:05:46,439 --> 00:05:49,160
make this 700 meg.

75
00:05:49,320 --> 00:05:54,240
This time I'll use a convention of dev forward slash mapper and now I'm going to say the

76
00:05:54,240 --> 00:05:58,320
volume group hyphen the logical volume.

77
00:05:58,320 --> 00:06:04,920
So if I hit enter now notice this also works and again if we display our outputs we can

78
00:06:04,920 --> 00:06:09,120
see here this has now been displayed to 700 meg.

79
00:06:09,120 --> 00:06:13,200
Now the last thing I just want to briefly cover is remember we talked about the ability

80
00:06:13,199 --> 00:06:19,479
of LVM to be able to create snapshots so that we have a perfect frozen image from a

81
00:06:19,479 --> 00:06:23,719
particular time that we can then use to revert back to.

82
00:06:23,719 --> 00:06:25,719
Let me show you how we can actually do this.

83
00:06:25,719 --> 00:06:32,039
If I say sudo LV display and I scroll on up we can see we have this LV right here.

84
00:06:32,039 --> 00:06:37,759
What if I want to be able to create a snapshot of this logical volume in its current state

85
00:06:37,759 --> 00:06:41,919
so that I could reverse back and go to this save state.

86
00:06:41,920 --> 00:06:47,120
In the event of maybe a disaster say for example so what we're going to do is we're going to

87
00:06:47,120 --> 00:06:52,720
take a note of the path here or alternatively we could use the dev mapper myStoriesChunk

88
00:06:52,720 --> 00:06:57,480
hyphen littleChunk naming convention if we so choose but for now I'll just keep it simple

89
00:06:57,480 --> 00:07:01,759
and copy this path and I'll show you the syntax we need to use.

90
00:07:01,759 --> 00:07:07,720
The way we can do this is again by using the LV create command I will say dash L the size

91
00:07:07,720 --> 00:07:14,680
is going to be 52 meg and to create this snapshot we're going to have to use the dash s flag

92
00:07:14,680 --> 00:07:20,480
this ultimately will generate the snapshot and now I'm going to say dash n to give this

93
00:07:20,480 --> 00:07:26,960
snapshot a name so I'll just call this something identifiable so I'll say littleChunk snap1

94
00:07:26,960 --> 00:07:31,800
which is the very first snapshot that I'm going to take of this logical volume and now I'm

95
00:07:31,840 --> 00:07:39,920
going to specify the path so I'll say dev myStorageChunk and then littleChunk so if I hit enter now

96
00:07:39,920 --> 00:07:46,160
we can see here that this logical volume has actually been generated so as we can see here

97
00:07:46,160 --> 00:07:52,720
with LVM we do have many commands to perform many different tasks LVM is very very comprehensive

98
00:07:52,720 --> 00:07:58,040
you can do so much with it that is why I would always encourage you to take this further explore

99
00:07:58,120 --> 00:08:03,160
those commands we talked about read demand pages and do a little labbing until you feel

100
00:08:03,160 --> 00:08:08,600
confident and familiar with the technology but ultimately those are the core concepts you

101
00:08:08,600 --> 00:08:13,720
want to understand for the purposes of the Lpik2 examination with respect to LVM so I hope this

102
00:08:13,720 --> 00:08:16,439
has been informative for you and I'd like to thank you for viewing.

