1
00:00:00,000 --> 00:00:14,800
Hey guys and welcome back.

2
00:00:14,800 --> 00:00:20,280
So now what we're going to do in this nugget right here is to walk through the actual configuration

3
00:00:20,280 --> 00:00:24,440
that we can use when we are setting up LVM.

4
00:00:24,440 --> 00:00:28,760
Now what I'm going to do first is to add some disks to my virtual machine.

5
00:00:28,760 --> 00:00:31,360
You've seen me do this before in a few different nuggets.

6
00:00:31,360 --> 00:00:37,359
What I've done is I've actually reversed my snapshot so that I no longer have those additional

7
00:00:37,359 --> 00:00:38,359
disks.

8
00:00:38,359 --> 00:00:44,120
The reason being is that I just want to have different disks of different sizes to highlight

9
00:00:44,120 --> 00:00:49,240
to you the utility of being able to group these together even if they do not have the

10
00:00:49,240 --> 00:00:50,520
same size you know.

11
00:00:50,520 --> 00:00:53,040
So I'll make sure my device is powered off.

12
00:00:53,040 --> 00:00:54,719
I'll go to settings.

13
00:00:54,719 --> 00:00:55,719
I'll go to storage.

14
00:00:55,719 --> 00:00:59,119
I'll click on SATA and I'll add a new hard disk.

15
00:00:59,119 --> 00:01:00,119
I'll create one.

16
00:01:00,119 --> 00:01:01,119
I'll just say next.

17
00:01:01,119 --> 00:01:04,280
I'll say next again and I'll make the size pretty small.

18
00:01:04,280 --> 00:01:06,879
I'll just maybe make this one 200 or so meg.

19
00:01:06,879 --> 00:01:07,879
I'll say create.

20
00:01:07,879 --> 00:01:09,560
I will go down.

21
00:01:09,560 --> 00:01:11,799
I'll select this and choose this.

22
00:01:11,799 --> 00:01:13,159
So now we've added this one.

23
00:01:13,159 --> 00:01:16,159
I'll add two more again hard disks.

24
00:01:16,159 --> 00:01:17,159
Creating new one.

25
00:01:17,159 --> 00:01:18,159
Next.

26
00:01:18,159 --> 00:01:19,159
Next.

27
00:01:19,159 --> 00:01:21,400
Let's maybe make this one a different value.

28
00:01:21,400 --> 00:01:24,120
Maybe say around 400 meg roughly.

29
00:01:24,120 --> 00:01:25,120
Let's create this.

30
00:01:25,120 --> 00:01:26,439
Go down.

31
00:01:26,439 --> 00:01:28,120
Select it and choose this.

32
00:01:28,120 --> 00:01:32,719
This is now also being added and then lastly we'll go to this one here hard disk.

33
00:01:32,719 --> 00:01:33,719
Let's create one.

34
00:01:33,719 --> 00:01:37,560
Let's say next and we'll maybe make this one around 700 meg.

35
00:01:37,560 --> 00:01:39,040
So let's create you.

36
00:01:39,040 --> 00:01:40,719
We'll select this one here.

37
00:01:40,719 --> 00:01:41,719
700 meg.

38
00:01:41,719 --> 00:01:44,159
Let's click choose and we'll say okay.

39
00:01:44,159 --> 00:01:47,000
So what I'll now do is I will power on my machine.

40
00:01:47,000 --> 00:01:48,000
Okay.

41
00:01:48,000 --> 00:01:54,400
So I have now uploaded or uploaded I have now rebooted my machine and we are back on

42
00:01:54,400 --> 00:01:55,880
the command line.

43
00:01:55,880 --> 00:02:01,680
So now that we have added these three new disks, let's actually check for their presence.

44
00:02:01,680 --> 00:02:03,880
We can say LSBLK-F.

45
00:02:03,880 --> 00:02:10,800
We can actually see they are here SDB, SDC and SDD or alternatively we can go into our

46
00:02:10,800 --> 00:02:16,000
dev directory and wildcard search for all of our SD devices.

47
00:02:16,000 --> 00:02:21,240
We can see we have SDB, SDC and SDD.

48
00:02:21,240 --> 00:02:22,240
Perfect.

49
00:02:22,320 --> 00:02:27,240
These three different disks as we know they are all of different sizes.

50
00:02:27,240 --> 00:02:34,240
What we want to be able to do here is to be able to bundle these together into that volume

51
00:02:34,240 --> 00:02:35,439
group.

52
00:02:35,439 --> 00:02:41,040
And once we have that big chunk of logical storage, then we can carve that up and as

53
00:02:41,040 --> 00:02:46,960
many pieces as we like and subdivide it into different partitions with different file systems.

54
00:02:46,960 --> 00:02:50,640
If we so choose, all of those options will be available to us.

55
00:02:50,639 --> 00:02:57,319
The first thing we want to be able to do here is we want to ensure that we can use LVM.

56
00:02:57,319 --> 00:03:01,719
So what I'm going to say is I'm going to say sudo apt install and I'm going to install

57
00:03:01,719 --> 00:03:02,719
LVM2.

58
00:03:02,719 --> 00:03:09,919
So if I enter here and I type in my password and to enter, I'm going to say yes of course

59
00:03:09,919 --> 00:03:14,719
and that should run through the installation of what we need LVM2.

60
00:03:14,719 --> 00:03:15,719
Okay.

61
00:03:15,719 --> 00:03:19,039
So we have now installed LVM2.

62
00:03:19,039 --> 00:03:25,759
Now you may recall in the previous Nuggets when we talked about creating a radaray, one

63
00:03:25,759 --> 00:03:30,280
of the things we had to do was to give that partition a particular label.

64
00:03:30,280 --> 00:03:37,000
Now that label was going to be FD and we were able to do such a thing using FDisk.

65
00:03:37,000 --> 00:03:40,959
Now we want to be able to do the same type of thing with respect to LVM.

66
00:03:40,959 --> 00:03:47,639
Remember we talked about when creating a physical volume, we want to put some type of header

67
00:03:47,879 --> 00:03:49,859
on that physical device.

68
00:03:49,859 --> 00:03:51,719
This is what we're going to do right now.

69
00:03:51,719 --> 00:03:56,839
So we're going to use FDisk and like I say, if I do an LS we have these three devices

70
00:03:56,839 --> 00:04:02,759
SDB, SDC and SDD again, all of different sizes.

71
00:04:02,759 --> 00:04:09,239
So what I shall do here is I'll say sudo FDisk and I'll first start out with SDB and I will

72
00:04:09,239 --> 00:04:10,239
hit enter.

73
00:04:10,239 --> 00:04:11,239
Okay.

74
00:04:11,239 --> 00:04:12,239
So we'll say M for help.

75
00:04:12,239 --> 00:04:14,560
We know to create a new partition.

76
00:04:14,560 --> 00:04:15,719
We can say N.

77
00:04:15,719 --> 00:04:18,000
We will choose a primary partition.

78
00:04:18,000 --> 00:04:21,160
We'll have the partition number, just be the default one.

79
00:04:21,160 --> 00:04:23,399
We will have the sectors at the defaults.

80
00:04:23,399 --> 00:04:26,879
Now remember here is this part here.

81
00:04:26,879 --> 00:04:32,319
Automatically FDisk is going to select a partition of type Linux.

82
00:04:32,319 --> 00:04:35,079
Now this is not what we actually want right now.

83
00:04:35,079 --> 00:04:39,480
What I want to do is I want to change this and give this a very particular type so that

84
00:04:39,480 --> 00:04:42,199
we can have this LVM heading.

85
00:04:42,199 --> 00:04:44,959
So I'll say T and hit enter.

86
00:04:44,959 --> 00:04:47,959
Now we want to do capital L to list all the codes.

87
00:04:47,959 --> 00:04:52,759
Now just like we did with the RAID, we chose FD.

88
00:04:52,759 --> 00:04:59,359
This time the option is going to be Linux LVM and the code here is going to be 8E.

89
00:04:59,359 --> 00:05:03,479
So we will say 8E and then I'll hit enter.

90
00:05:03,479 --> 00:05:08,120
And now we can see here we've actually changed the partition from Linux to Linux LVM.

91
00:05:08,120 --> 00:05:10,120
This is exactly what we want to do.

92
00:05:10,120 --> 00:05:12,560
So we can say M for more help.

93
00:05:12,560 --> 00:05:17,160
We can see how we can actually write these changes by saying W.

94
00:05:17,160 --> 00:05:18,720
So that is exactly what we will do.

95
00:05:18,720 --> 00:05:19,720
Perfect.

96
00:05:19,720 --> 00:05:23,959
So now that is done, we want to repeat the process but for disk C.

97
00:05:23,959 --> 00:05:24,959
So we'll do the same.

98
00:05:24,959 --> 00:05:27,959
We'll say N, P for primary partition.

99
00:05:27,959 --> 00:05:30,120
Default one, we'll go with the default sectors.

100
00:05:30,120 --> 00:05:34,040
We'll change the type and the type will be 8E.

101
00:05:34,040 --> 00:05:35,040
We hit enter.

102
00:05:35,040 --> 00:05:39,160
We are now changing it to Linux LVM and we will write those changes.

103
00:05:39,160 --> 00:05:47,000
And the last one with disk D, again new partition, primary partition, default, default, default.

104
00:05:47,000 --> 00:05:49,080
Change the type to 8E.

105
00:05:49,080 --> 00:05:53,280
Hit enter, Linux LVM and we will write those changes.

106
00:05:53,280 --> 00:05:54,280
Perfect.

107
00:05:54,280 --> 00:06:00,360
So now like I say, we have these three disks marked with the LVM type.

108
00:06:00,360 --> 00:06:06,560
Now the very first command that we want to do is going to allow us to see any physical

109
00:06:06,560 --> 00:06:08,200
volumes we have created.

110
00:06:08,199 --> 00:06:13,839
Now one thing I want you to note here is that right now no physical volumes have been created.

111
00:06:13,839 --> 00:06:17,120
They have been primed to be a physical volume.

112
00:06:17,120 --> 00:06:20,079
So the command we can do is PV display.

113
00:06:20,079 --> 00:06:25,000
But as you're going to see here, we actually need to use it as the root user.

114
00:06:25,000 --> 00:06:28,120
So I will say sudo PV display.

115
00:06:28,120 --> 00:06:30,079
And look at this magnificent output.

116
00:06:30,079 --> 00:06:32,120
We see absolutely nothing.

117
00:06:32,120 --> 00:06:36,439
And this is because we do not have any physical volumes quite just yet.

118
00:06:36,439 --> 00:06:42,480
In order to be able to create a physical volume, we have a very particular command.

119
00:06:42,480 --> 00:06:45,240
And that command is PV create.

120
00:06:45,240 --> 00:06:50,279
So if we go into the man page here, we can see here, this is how we initialize physical

121
00:06:50,279 --> 00:06:53,399
volumes for use by LVM.

122
00:06:53,399 --> 00:06:57,480
Now if we scroll on down, we can see all these different options.

123
00:06:57,480 --> 00:07:02,439
And again, I always encourage you to go through the man page so you can see the different

124
00:07:02,439 --> 00:07:04,600
ways to utilize these tools.

125
00:07:04,680 --> 00:07:06,720
For now, we'll press Q.

126
00:07:06,720 --> 00:07:10,360
And let me show you the basic setup that we want to utilize here.

127
00:07:10,360 --> 00:07:13,040
I'm going to say PV create.

128
00:07:13,040 --> 00:07:17,360
And I'm going to select my disks now just for posterity.

129
00:07:17,360 --> 00:07:19,280
Remember the dislocations.

130
00:07:19,280 --> 00:07:27,520
We're going to use SDB1, which is the partition which is marked as LVM, SDC1 and SDD1.

131
00:07:27,520 --> 00:07:29,080
These are the three ones we are targeting.

132
00:07:29,080 --> 00:07:32,439
So what I'll say is sudo PV create.

133
00:07:32,439 --> 00:07:35,160
And now all I'm going to do is specify those devices.

134
00:07:35,160 --> 00:07:39,240
So dev SDB1, that's the first device that we want to include.

135
00:07:39,240 --> 00:07:42,839
Then I'll say dev SDC1, the second device.

136
00:07:42,839 --> 00:07:45,519
And then dev SDD1.

137
00:07:45,519 --> 00:07:50,000
We can see a physical volume has been successfully created.

138
00:07:50,000 --> 00:07:56,480
And now if we actually use our command PV display, and I don't match the keypad, that

139
00:07:56,480 --> 00:07:57,480
would be a lot better.

140
00:07:57,480 --> 00:07:59,040
And of course, we need to do sudo.

141
00:07:59,040 --> 00:08:01,759
If I hit enter, check this out.

142
00:08:01,759 --> 00:08:03,439
We can see the output right here.

143
00:08:03,439 --> 00:08:08,879
New physical volume, we can see the name is dev SDB.

144
00:08:08,879 --> 00:08:11,039
We can see the actual size here.

145
00:08:11,039 --> 00:08:16,039
Remember that was the first size that we used when we created our disk, just over 200 meg.

146
00:08:16,039 --> 00:08:19,719
Then we see the next disk, dev SDC.

147
00:08:19,719 --> 00:08:22,480
We see the size here, just over 400 meg.

148
00:08:22,480 --> 00:08:26,399
And the last one is SDD1, just over 700 meg.

149
00:08:26,399 --> 00:08:28,240
So this is kind of like what we talked about.

150
00:08:28,240 --> 00:08:29,639
In fact, not kind of like.

151
00:08:29,639 --> 00:08:32,480
This is exactly like what we talked about.

152
00:08:32,480 --> 00:08:38,559
We have ultimately added three different disks, ones around, like I say, 200 meg.

153
00:08:38,559 --> 00:08:40,879
One was around 400.

154
00:08:40,879 --> 00:08:45,080
And the third one, a little bit bigger at around 700 meg.

155
00:08:45,080 --> 00:08:46,319
Very, very roughly, of course.

156
00:08:46,319 --> 00:08:51,080
All of these have been marked with the correct header, and they've all been created to be

157
00:08:51,080 --> 00:08:52,799
physical volumes.

158
00:08:52,799 --> 00:08:59,360
That means that they are now primed and ready to be combined into a volume group, such that

159
00:08:59,360 --> 00:09:05,720
we have one big logical volume of size, 1.3 gig.

160
00:09:05,720 --> 00:09:11,120
So how on earth do we actually transfer these physical volumes so that we can combine them

161
00:09:11,120 --> 00:09:13,200
into this volume group?

162
00:09:13,200 --> 00:09:16,200
Well, it's a very, very similar process.

163
00:09:16,200 --> 00:09:21,519
The first thing we will do is see how we can check if we do have any volume groups created.

164
00:09:21,519 --> 00:09:23,399
The command we will use is very similar.

165
00:09:23,399 --> 00:09:25,600
It's not PV display.

166
00:09:25,600 --> 00:09:30,200
This time it's VG display, volume group display.

167
00:09:30,200 --> 00:09:35,759
So if I hit Enter, again, we get this absolutely magnificent output, absolutely nothing at

168
00:09:35,759 --> 00:09:36,759
all.

169
00:09:36,759 --> 00:09:42,120
So what we have to do is, just like what we did with PV create, we now need to be able

170
00:09:42,120 --> 00:09:44,080
to create that volume group.

171
00:09:44,080 --> 00:09:50,160
Now, the command we're going to use this time is going to be VG create very, very similar.

172
00:09:50,160 --> 00:09:54,680
And we can see here this command allows us to create a volume group and it says here,

173
00:09:54,679 --> 00:09:58,799
as the description says, creates a new VG on block devices.

174
00:09:58,799 --> 00:10:06,039
Now, one thing to note here is that even though we used the PV create command to be very explicit

175
00:10:06,039 --> 00:10:11,359
because again, we want to know how these tools work for the purposes of the examination,

176
00:10:11,359 --> 00:10:16,319
notice that if you happen to use block devices that have not previously been initialized

177
00:10:16,319 --> 00:10:22,919
as physical volumes with the PV create command, VG create will actually initialize them and

178
00:10:22,919 --> 00:10:24,120
make them PVs.

179
00:10:24,159 --> 00:10:28,879
So what I'm saying here is, is that even though we want to be aware of the PV create command

180
00:10:28,879 --> 00:10:35,320
and to be able to initialize it manually yourself, notice that the VG create command can actually

181
00:10:35,320 --> 00:10:36,960
do this for us automatically.

182
00:10:36,960 --> 00:10:39,560
So just understand this difference.

183
00:10:39,560 --> 00:10:42,639
And if we scroll on down, we're going to be able to see the different options that we

184
00:10:42,639 --> 00:10:44,519
can use with this command.

185
00:10:44,519 --> 00:10:46,799
Again, I always say read the man page.

186
00:10:46,799 --> 00:10:51,639
But for now, what we'll do is we will just dive in and create our first volume group.

187
00:10:51,679 --> 00:10:56,080
What I'll do here, as I will say, pseudo VG create.

188
00:10:56,080 --> 00:11:01,919
And the first thing that I want to do is I want to give my volume group a name.

189
00:11:01,919 --> 00:11:06,720
So I'll just call it my storage chunk, call this anything you wish though.

190
00:11:06,720 --> 00:11:08,879
There's nothing special about this name, obviously.

191
00:11:08,879 --> 00:11:15,039
And now what I want to do is I want to specify which physical volumes are going to be part

192
00:11:15,039 --> 00:11:16,879
of my volume group.

193
00:11:16,879 --> 00:11:20,360
Well, we have devsdb1.

194
00:11:20,480 --> 00:11:23,919
That is a PV that has been initialized and ready to go.

195
00:11:23,919 --> 00:11:31,000
I also want to add SDC1, the second disk, and the third one was SDD1.

196
00:11:31,000 --> 00:11:38,720
So if I hit Enter now, we can see a volume group called my storage chunk has now successfully

197
00:11:38,720 --> 00:11:39,720
been created.

198
00:11:39,720 --> 00:11:45,639
So you can imagine therefore, if I do a VG display, we're now going to see some information

199
00:11:45,639 --> 00:11:46,639
relating to this.

200
00:11:46,639 --> 00:11:48,240
So check this out then.

201
00:11:48,240 --> 00:11:51,879
We now have a volume group called my storage chunk.

202
00:11:51,879 --> 00:11:53,840
The format is LVM2.

203
00:11:53,840 --> 00:11:58,519
We can actually see it is comprised of three different physical volumes.

204
00:11:58,519 --> 00:12:01,840
And we can see the actual size of the VG.

205
00:12:01,840 --> 00:12:07,039
We now have a logical size of just over 1.3 gig, as I said.

206
00:12:07,039 --> 00:12:09,000
1.35, it happens to be.

207
00:12:09,000 --> 00:12:14,519
And we can cut this up in as many pieces as small or as large as we choose and format

208
00:12:14,519 --> 00:12:20,360
those pieces as we wish using different file systems if we need to use different file systems.

209
00:12:20,360 --> 00:12:26,360
So the next component, now that we have our volume group, are those logical volumes.

210
00:12:26,360 --> 00:12:30,519
That is the subdivisions that we can carve this volume group into.

211
00:12:30,519 --> 00:12:35,480
So can you maybe guess what the command is to actually see the output?

212
00:12:35,480 --> 00:12:40,759
If you happen to follow the same format and say LV display, you would be absolutely correct.

213
00:12:40,759 --> 00:12:45,519
And as we expect, we get that same amazing output of absolutely nothing.

214
00:12:45,519 --> 00:12:51,279
That is because of course, we haven't actually subdivided our volume group into logical volumes.

215
00:12:51,279 --> 00:12:52,679
So we will do that now.

216
00:12:52,679 --> 00:12:57,600
Again, can you maybe guess what the command is going to be if you say LVCreate?

217
00:12:57,600 --> 00:12:59,360
You would be absolutely correct.

218
00:12:59,360 --> 00:13:04,039
We can see here LVCreate allows us to create a logical volume.

219
00:13:04,039 --> 00:13:08,200
And again, of course, we can see all these different options and been able to name a

220
00:13:08,200 --> 00:13:10,360
particular logical volume.

221
00:13:10,360 --> 00:13:11,680
So one so forth.

222
00:13:11,680 --> 00:13:14,120
So again, have a skim through the man page.

223
00:13:14,120 --> 00:13:20,399
But for now, what I'll do is I'll just press Q to go back and let's try subdividing this

224
00:13:20,399 --> 00:13:21,440
volume group.

225
00:13:21,440 --> 00:13:24,039
So let's create our very first chunk.

226
00:13:24,039 --> 00:13:31,800
Okay, so I will say sudo LVCreate and I will say dash N to specify the name of the logical

227
00:13:31,800 --> 00:13:33,480
volume I want to create.

228
00:13:33,480 --> 00:13:39,039
I'll just call this one little chunk because it's going to be a little chunk from my volume

229
00:13:39,039 --> 00:13:40,039
group.

230
00:13:40,039 --> 00:13:42,719
What I want to do is to specify the size.

231
00:13:42,719 --> 00:13:48,159
Now if I want to specify a fixed size, I can use the dash capital L flag.

232
00:13:48,159 --> 00:13:53,319
I like to remember this as how large I want to make this size.

233
00:13:53,319 --> 00:13:56,639
And I'll just take a 50 meg chunk.

234
00:13:56,639 --> 00:14:00,719
Now whereabouts do I want to take my chunk from?

235
00:14:00,719 --> 00:14:04,799
I want to take it from my volume group, which is called my storage chunk.

236
00:14:04,919 --> 00:14:11,039
So if I hit enter, we can see the logical volume little chunk has now been created.

237
00:14:11,039 --> 00:14:18,439
So if I say sudo LVDisplay and to enter, we can see here, we have actually created little

238
00:14:18,439 --> 00:14:19,439
chunk.

239
00:14:19,439 --> 00:14:24,799
It's taken from my storage chunk and the size is around 50 meg.

240
00:14:24,799 --> 00:14:25,799
Perfect.

241
00:14:25,799 --> 00:14:27,879
So notice the actual path here.

242
00:14:27,879 --> 00:14:33,639
It's now shown the path is dev, then the name of the volume group and then the name

243
00:14:33,639 --> 00:14:35,840
of the logical volume.

244
00:14:35,840 --> 00:14:36,840
So check this out.

245
00:14:36,840 --> 00:14:42,240
What if I wanted to create another chunk from my storage chunk?

246
00:14:42,240 --> 00:14:46,960
Now what I did the first time, I specified a fixed size.

247
00:14:46,960 --> 00:14:47,960
Okay.

248
00:14:47,960 --> 00:14:49,639
I just said give me 50 meg.

249
00:14:49,639 --> 00:14:56,679
Now if you recall, I do believe the size of the volume group was 1.35 gig.

250
00:14:56,679 --> 00:14:59,000
We have now taken 50 meg from that.

251
00:14:59,000 --> 00:15:02,879
So we should now have 1.3 gig left.

252
00:15:02,879 --> 00:15:07,879
If I do a sudo VG display, we can actually see allocated.

253
00:15:07,879 --> 00:15:13,879
We now have 52 meg and the free space is now 1.3 gig.

254
00:15:13,879 --> 00:15:14,879
Perfect.

255
00:15:14,879 --> 00:15:20,480
Now the first time, like I say, I specified a fixed size of around 50 meg.

256
00:15:20,480 --> 00:15:27,279
What if I just wanted to take what is left, i.e. the 1.3 gig and just take a percentage

257
00:15:27,279 --> 00:15:28,279
of that?

258
00:15:28,279 --> 00:15:32,840
Just say, okay, whatever I've got left, give me 50% of that or give me 30.

259
00:15:32,840 --> 00:15:33,800
30% of that.

260
00:15:33,800 --> 00:15:37,840
Well, I can actually still do that using the LVCreate command.

261
00:15:37,840 --> 00:15:39,399
The syntax is a little bit different.

262
00:15:39,399 --> 00:15:41,120
Let me show you what that looks like.

263
00:15:41,120 --> 00:15:44,720
We would do sudo LVCreate and I'll do N.

264
00:15:44,720 --> 00:15:46,879
Let's just call this one medium chunk.

265
00:15:46,879 --> 00:15:47,879
Okay.

266
00:15:47,879 --> 00:15:54,680
And now I will do dash lowercase L and I'll make this one 40% of the free space.

267
00:15:54,680 --> 00:15:58,120
So we now have 1.3 gig free.

268
00:15:58,120 --> 00:16:03,560
I want to take 40% of that 1.3 and assign it to medium chunk.

269
00:16:03,560 --> 00:16:06,919
Now, again, whereabouts am I going to take this chunk from?

270
00:16:06,919 --> 00:16:11,639
We're going to take it from the volume group called myStorageChunk.

271
00:16:11,639 --> 00:16:18,600
So if I hit enter, we can now see another logical volume has been carved out from myStorageChunk.

272
00:16:18,600 --> 00:16:25,560
So if we do sudo LVDisplay and hit enter, at the very top we see lilchunk.

273
00:16:25,559 --> 00:16:29,879
But now here we also have this new logical volume.

274
00:16:29,879 --> 00:16:31,039
It's called medium chunk.

275
00:16:31,039 --> 00:16:32,359
And again, notice the path.

276
00:16:32,359 --> 00:16:36,919
It's dev, then the volume group, and then the logical volume.

277
00:16:36,919 --> 00:16:38,599
Now check out the size of this.

278
00:16:38,599 --> 00:16:42,159
It is now 528 meg.

279
00:16:42,159 --> 00:16:46,199
That is actually 40% of 1.3 gig.

280
00:16:46,199 --> 00:16:55,159
Quick calculator, 1.3 gig times that would be 0.4 equals 0.52, otherwise known as 520

281
00:16:55,559 --> 00:16:56,159
meg.

282
00:16:56,159 --> 00:16:58,279
That is pretty much what we have got right here.

283
00:16:58,279 --> 00:16:58,839
See that?

284
00:16:58,839 --> 00:17:04,039
So this is obviously a very, very nice way for you to be able to manage the size of your chunk

285
00:17:04,039 --> 00:17:09,319
just by carving out neat little percentages of whatever is left over.

286
00:17:09,319 --> 00:17:13,879
So like I say, we want to be making a note of these locations.

287
00:17:13,879 --> 00:17:18,039
Dev myStorageChunk, lilchunk, and dev myStorageChunk, medium chunk.

288
00:17:18,039 --> 00:17:23,319
What we're now going to do is we're going to put a file system on these logical volumes.

289
00:17:23,319 --> 00:17:25,960
So what I'll do is I'll say MKFS.

290
00:17:25,960 --> 00:17:28,200
In fact, they'll use the sudo command MKFS.

291
00:17:28,200 --> 00:17:36,679
The first one I'll give an EXT3 file system, and I'll say dev myStorageChunk and then lilchunk.

292
00:17:36,679 --> 00:17:37,159
Perfect.

293
00:17:37,159 --> 00:17:39,079
So that is now being created.

294
00:17:39,079 --> 00:17:41,720
And we'll do the same for sudo MKFS.

295
00:17:41,720 --> 00:17:44,200
Let's give this one EXT4.

296
00:17:44,200 --> 00:17:47,319
And we'll say dev myStorageChunk.

297
00:17:47,319 --> 00:17:49,799
And this one is called medium chunk.

298
00:17:49,799 --> 00:17:52,439
And if we hit enter, that one is now done.

299
00:17:52,440 --> 00:17:59,559
If I do an LSBLK-F, we can see we have an LVM member two for this device and this partition.

300
00:17:59,559 --> 00:18:02,600
Same again with this one and our third one.

301
00:18:02,600 --> 00:18:13,240
But notice lilchunk right here has an EXT3 file system, whereas medium chunk here has an EXT4 file system.

302
00:18:13,240 --> 00:18:17,799
Now you will notice of course that neither of these file systems happen to be mounted.

303
00:18:17,799 --> 00:18:20,440
But we can do that no problem at all.

304
00:18:20,440 --> 00:18:23,000
So what I could do here is I could maybe make a directory.

305
00:18:23,000 --> 00:18:24,759
Let's just call this directory.

306
00:18:24,759 --> 00:18:26,519
Let's just call it small one.

307
00:18:26,519 --> 00:18:28,440
Oh, and I'll need to do sudo of course.

308
00:18:28,440 --> 00:18:30,759
So let's go to my root directory, do an LS.

309
00:18:30,759 --> 00:18:36,440
We can see we have the small one, directory, and I'll do sudo MKDR, medium one.

310
00:18:36,440 --> 00:18:37,400
There we are there.

311
00:18:37,400 --> 00:18:44,039
So let's mount these two logical volumes with different file systems in these different locations.

312
00:18:44,039 --> 00:18:45,960
So what I will say is sudo mounts.

313
00:18:45,960 --> 00:18:51,559
And the path of the first one will be dev my storage chunk for the volume group.

314
00:18:51,559 --> 00:18:54,920
And then the logical volume will be lilchunk.

315
00:18:54,920 --> 00:18:57,400
And whereabouts do I want to mount this?

316
00:18:57,400 --> 00:19:00,840
I'm going to mount it in the folder called small one.

317
00:19:00,840 --> 00:19:01,400
Perfect.

318
00:19:01,400 --> 00:19:07,880
And if I do something very similar with the second one also, sudo mount dev my storage chunk.

319
00:19:07,880 --> 00:19:09,480
And then medium chunk.

320
00:19:09,480 --> 00:19:13,319
And we will mount that in the medium one directory.

321
00:19:13,319 --> 00:19:13,720
Cool.

322
00:19:13,720 --> 00:19:17,400
So for now say mounts and I grep for just the word chunk.

323
00:19:17,400 --> 00:19:20,279
We can see here this is mounted now.

324
00:19:20,279 --> 00:19:25,000
I want you to notice here is that when this is mounted, the format looks a little bit different.

325
00:19:25,000 --> 00:19:27,640
We do want to be aware of this location.

326
00:19:27,640 --> 00:19:31,160
forward slash dev forward slash mapper.

327
00:19:31,160 --> 00:19:36,759
And then it's going to be the name of the volume group separated with a hyphen.

328
00:19:36,759 --> 00:19:40,200
And then the name of the logical volume again.

329
00:19:40,279 --> 00:19:45,000
Dev mapper volume group hyphen logical volume.

330
00:19:45,000 --> 00:19:49,720
So now what we can do is I can go into say for example my small one directory.

331
00:19:49,720 --> 00:19:52,840
And I'll just create a file called file one dot txt.

332
00:19:52,840 --> 00:19:53,799
I'll just say this.

333
00:19:53,799 --> 00:19:57,480
In fact, I better go into sudo sudo file one dot txt.

334
00:19:57,480 --> 00:20:02,039
And I'll just say this is some data stored on lilchunk.

335
00:20:02,039 --> 00:20:09,559
So save you go back out and I could go into medium one gain sudo nano file two.

336
00:20:09,559 --> 00:20:12,679
So this is stored on medium chunk.

337
00:20:12,679 --> 00:20:14,279
Save you write it out.

338
00:20:14,279 --> 00:20:18,679
So as you can see here, what we've done is we've been able to take three different discs

339
00:20:18,679 --> 00:20:22,679
of three different sizes and combine them to make one big logical chunk.

340
00:20:22,679 --> 00:20:25,079
This was called my storage chunk.

341
00:20:25,079 --> 00:20:30,759
And then what I did was I was able to carve off a little slice called lilchunk.

342
00:20:30,759 --> 00:20:35,079
Give it a particular file system in that case ext three.

343
00:20:35,079 --> 00:20:38,519
And I could mount that file system in a particular directory.

344
00:20:38,519 --> 00:20:44,279
And I could begin populating this partition file system with data as I so needed.

345
00:20:44,279 --> 00:20:47,400
Now it just so happens again, I just put on a simple text file.

346
00:20:47,400 --> 00:20:51,160
But you can imagine you could put whatever type of data you wanted on.

347
00:20:51,160 --> 00:20:57,639
And then like I say, I happened to carve out another chunk from this that took up 40%

348
00:20:57,639 --> 00:21:02,599
of what was remaining after we created the first logical volume.

349
00:21:02,599 --> 00:21:06,200
And we were able to add a completely different file system on this one.

350
00:21:06,200 --> 00:21:07,720
Ext four.

351
00:21:07,720 --> 00:21:12,600
And just like we saw before, we were able to mount this and then add in data.

352
00:21:12,600 --> 00:21:17,160
Once again, the only data we added was simple text data.

353
00:21:17,160 --> 00:21:23,480
But there is nothing stopping you from adding images or grips or MP3 files, whatever you so need.

354
00:21:23,480 --> 00:21:28,600
The point is, is we were able to aggregate that data from this, even though they had different sizes,

355
00:21:28,600 --> 00:21:34,120
create this big chunk and subdivide that chunk in as many ways as we wished.

356
00:21:34,119 --> 00:21:37,639
So as you can see here, LVM is very, very useful.

357
00:21:37,639 --> 00:21:42,359
The commands to be able to configure LVM are very, very similar when you're dealing with

358
00:21:42,359 --> 00:21:46,359
physical volumes, volume groups and logical volumes.

359
00:21:46,359 --> 00:21:50,679
But there are some more cool features that we want to explore with respect to LVM.

360
00:21:50,679 --> 00:21:53,319
We'll get to talk about those in the very next nugget.

361
00:21:53,319 --> 00:21:57,239
So I hope this has been informative for you and I'd like to thank you for viewing.

