1
00:00:00,480 --> 00:00:02,280
In this lesson, you're going to learn

2
00:00:02,280 --> 00:00:03,840
how to use logical volumes

3
00:00:03,840 --> 00:00:05,400
to create a more flexible structure

4
00:00:05,400 --> 00:00:08,100
for organizing data on storage devices,

5
00:00:08,100 --> 00:00:10,890
because after all, partitioning is not the only way

6
00:00:10,890 --> 00:00:13,740
to divide up a storage device logically.

7
00:00:13,740 --> 00:00:15,210
As we discussed before,

8
00:00:15,210 --> 00:00:17,730
we've made the use of physical storage devices,

9
00:00:17,730 --> 00:00:21,000
but device mapping turns these physical storage devices

10
00:00:21,000 --> 00:00:23,100
into virtual storage devices.

11
00:00:23,100 --> 00:00:26,250
In Linux, the device mapper creates the virtual device

12
00:00:26,250 --> 00:00:28,440
and passes data from that virtual device

13
00:00:28,440 --> 00:00:30,810
to one or more physical devices.

14
00:00:30,810 --> 00:00:33,750
DM-multipath is a feature of the Linux Kernel

15
00:00:33,750 --> 00:00:35,970
that provides redundancy and improved performance

16
00:00:35,970 --> 00:00:37,770
for block storage devices.

17
00:00:37,770 --> 00:00:40,800
If one path fails, DM-multipath will switch

18
00:00:40,800 --> 00:00:42,810
to one of the other paths that remains,

19
00:00:42,810 --> 00:00:44,610
keeping that storage device available

20
00:00:44,610 --> 00:00:46,200
for reading and writing.

21
00:00:46,200 --> 00:00:48,031
The multipath tools package enables you

22
00:00:48,031 --> 00:00:51,060
to manage DM-multipath for storage devices

23
00:00:51,060 --> 00:00:53,700
and typically, you're going to find the configuration file

24
00:00:53,700 --> 00:00:58,700
located at /etc/multipath.conf.

25
00:00:59,070 --> 00:01:01,766
The mdadm command is a tool that's going to be used

26
00:01:01,766 --> 00:01:04,470
to manage software-based RAID arrays.

27
00:01:04,470 --> 00:01:06,360
In a RAID array, data is stored

28
00:01:06,360 --> 00:01:08,700
across multiple physical storage devices

29
00:01:08,700 --> 00:01:10,350
and those devices are combined

30
00:01:10,350 --> 00:01:12,900
into a single virtual storage device.

31
00:01:12,900 --> 00:01:15,270
This type of software-based RAID configuration

32
00:01:15,270 --> 00:01:17,490
is an alternative to using device mapper

33
00:01:17,490 --> 00:01:19,260
and the DM-multipath.

34
00:01:19,260 --> 00:01:22,080
The mdadm tool enables you to create,

35
00:01:22,080 --> 00:01:24,780
manage and monitor RAID arrays.

36
00:01:24,780 --> 00:01:26,280
Now, before we dive too much further

37
00:01:26,280 --> 00:01:28,140
into logical volumes and RAIDs,

38
00:01:28,140 --> 00:01:29,803
it's important for us to take a quick detour

39
00:01:29,803 --> 00:01:31,830
and do a quick review of RAIDs

40
00:01:31,830 --> 00:01:34,080
from your previous A plus studies.

41
00:01:34,080 --> 00:01:35,550
A RAID is a redundant array

42
00:01:35,550 --> 00:01:38,250
of independent or inexpensive disks.

43
00:01:38,250 --> 00:01:40,200
RAIDs are classified based on their level,

44
00:01:40,200 --> 00:01:45,200
such as RAID 0, RAID 1, RAID 5, RAID 6 and RAID 10.

45
00:01:45,480 --> 00:01:47,880
Each RAID has either striping, mirroring,

46
00:01:47,880 --> 00:01:50,190
parity, or a combination of these features,

47
00:01:50,190 --> 00:01:52,170
depending on the RAID level.

48
00:01:52,170 --> 00:01:54,690
Striping refers to a technique used by RAIDs

49
00:01:54,690 --> 00:01:56,940
in which multiple smaller physical disks

50
00:01:56,940 --> 00:02:00,540
can be combined to logically act as a single larger disk.

51
00:02:00,540 --> 00:02:03,600
For example, if I wanted to have a four terabyte hard drive

52
00:02:03,600 --> 00:02:05,310
for storage in my Linux system,

53
00:02:05,310 --> 00:02:08,460
but I only have two two terabyte hard drives available,

54
00:02:08,460 --> 00:02:11,039
I can use striping to combine them logically

55
00:02:11,039 --> 00:02:12,269
and my system is going to treat them

56
00:02:12,269 --> 00:02:15,660
as a single four terabyte hard disk drive.

57
00:02:15,660 --> 00:02:16,980
Mirroring, on the other hand,

58
00:02:16,980 --> 00:02:19,320
is the second technique that's used in a RAID.

59
00:02:19,320 --> 00:02:21,900
With mirroring, two physical hard disk drives

60
00:02:21,900 --> 00:02:24,690
are going to be combined into a single logical volume.

61
00:02:24,690 --> 00:02:27,330
An identical copy of everything that's put on them,

62
00:02:27,330 --> 00:02:29,670
is going to be put on both drives.

63
00:02:29,670 --> 00:02:31,830
This way, if a single drive fails,

64
00:02:31,830 --> 00:02:34,470
the system can quickly access all the files it needs,

65
00:02:34,470 --> 00:02:36,330
because there's still a fully redundant copy

66
00:02:36,330 --> 00:02:39,540
on that second drive as part of that RAID.

67
00:02:39,540 --> 00:02:42,330
Parity is the third technique we use in RAIDs.

68
00:02:42,330 --> 00:02:44,400
Now, parity computations are going to be used

69
00:02:44,400 --> 00:02:46,650
in RAID drive arrays for fault tolerance

70
00:02:46,650 --> 00:02:48,960
by calculating the data in two drives

71
00:02:48,960 --> 00:02:51,450
and storing the results on a different drive.

72
00:02:51,450 --> 00:02:53,430
For example, in a RAID 5,

73
00:02:53,430 --> 00:02:55,770
there's going to be a minimum of three disk drives

74
00:02:55,770 --> 00:02:56,610
and these are going to be used

75
00:02:56,610 --> 00:02:58,740
so that data can be striped across the drives

76
00:02:58,740 --> 00:03:01,140
by splitting each file into two pieces,

77
00:03:01,140 --> 00:03:02,730
putting one piece on one drive

78
00:03:02,730 --> 00:03:04,860
and the other piece on the second drive,

79
00:03:04,860 --> 00:03:08,790
and then the calculated parity gets put on a third drive.

80
00:03:08,790 --> 00:03:11,400
All right, now that we've defined the term striping,

81
00:03:11,400 --> 00:03:13,950
mirroring and parity, let's take a quick look

82
00:03:13,950 --> 00:03:15,180
at the different types of RAIDs

83
00:03:15,180 --> 00:03:17,700
that you can configure on your Linux system.

84
00:03:17,700 --> 00:03:19,890
First, we have a RAID 0.

85
00:03:19,890 --> 00:03:21,930
RAID 0 relies on striping.

86
00:03:21,930 --> 00:03:24,240
With a RAID 0, we have two different disks

87
00:03:24,240 --> 00:03:25,170
that are working together

88
00:03:25,170 --> 00:03:27,330
and each of them holds half of the data.

89
00:03:27,330 --> 00:03:29,340
So as you can see here,

90
00:03:29,340 --> 00:03:32,340
part of the file A1 and part of the file A2

91
00:03:32,340 --> 00:03:34,530
are each put on each of the drives.

92
00:03:34,530 --> 00:03:38,010
So let's assume that I have a RAID 0 with my Linux system.

93
00:03:38,010 --> 00:03:39,960
If I've installed it and configured it,

94
00:03:39,960 --> 00:03:42,660
what does the operating system actually see?

95
00:03:42,660 --> 00:03:44,820
Do they see disk zero and disk one?

96
00:03:44,820 --> 00:03:45,750
Well, no.

97
00:03:45,750 --> 00:03:48,210
Instead it's just going to see one logical drive

98
00:03:48,210 --> 00:03:51,030
in the RAID, because both disks are working together

99
00:03:51,030 --> 00:03:53,700
to create a single larger logical volume.

100
00:03:53,700 --> 00:03:55,440
Now, if I'm going to copy this video

101
00:03:55,440 --> 00:03:58,170
over to the new striped RAID 0 logical drive,

102
00:03:58,170 --> 00:03:59,910
what do you think is going to happen?

103
00:03:59,910 --> 00:04:02,730
Well, it's going to put the first piece on disk zero

104
00:04:02,730 --> 00:04:04,590
and the second piece on disk one

105
00:04:04,590 --> 00:04:06,420
and the third piece on disk zero,

106
00:04:06,420 --> 00:04:08,370
and the fourth piece on disk one.

107
00:04:08,370 --> 00:04:09,600
And it keeps doing this,

108
00:04:09,600 --> 00:04:11,490
where all of the even parts and odd parts

109
00:04:11,490 --> 00:04:14,280
are being split up across the two different disks.

110
00:04:14,280 --> 00:04:15,660
This is what's known as striping,

111
00:04:15,660 --> 00:04:18,540
because as I'm putting a piece on each of those two disks,

112
00:04:18,540 --> 00:04:20,910
if you look at it, it looks like a candy stripe

113
00:04:20,910 --> 00:04:22,050
or a peppermint stick,

114
00:04:22,050 --> 00:04:24,270
because it's swirling around those two RAIDs,

115
00:04:24,270 --> 00:04:27,510
with the evens on one side and the odds on the other.

116
00:04:27,510 --> 00:04:29,370
Now, RAID 0 is a great thing

117
00:04:29,370 --> 00:04:31,200
if you want to have faster speeds,

118
00:04:31,200 --> 00:04:34,200
because it stripes the data across two physical drives,

119
00:04:34,200 --> 00:04:37,380
but this provides no redundancy at all for your data.

120
00:04:37,380 --> 00:04:39,180
If one of these two disks fail,

121
00:04:39,180 --> 00:04:40,557
then you're going to lose half of the file.

122
00:04:40,557 --> 00:04:43,290
And if you lose half of the file, well, guess what?

123
00:04:43,290 --> 00:04:45,840
The computer isn't going to be able to read the file at all,

124
00:04:45,840 --> 00:04:48,750
so really, it's like you lost the whole file.

125
00:04:48,750 --> 00:04:50,670
Now, the good thing about using a stripe disk

126
00:04:50,670 --> 00:04:52,110
or a RAID 0 array,

127
00:04:52,110 --> 00:04:54,540
is the fact that you get this speed boost, right?

128
00:04:54,540 --> 00:04:56,940
And so as you're doing things like high speed gaming

129
00:04:56,940 --> 00:04:58,470
or high speed video editing,

130
00:04:58,470 --> 00:05:00,720
RAID 0s can be a great setup for this,

131
00:05:00,720 --> 00:05:03,150
because you can access two disks a lot faster

132
00:05:03,150 --> 00:05:04,710
than you can access one disk,

133
00:05:04,710 --> 00:05:05,910
because each of them is going to give you

134
00:05:05,910 --> 00:05:08,550
half of the information at the same time.

135
00:05:08,550 --> 00:05:11,010
Now, the other good thing about using a RAID 0,

136
00:05:11,010 --> 00:05:14,370
is the fact that there is no loss of space on those disks.

137
00:05:14,370 --> 00:05:16,710
If I take 2 one terabyte hard disks

138
00:05:16,710 --> 00:05:19,230
and I combine them logically into a RAID 0,

139
00:05:19,230 --> 00:05:21,750
this is going to appear as a single logical volume

140
00:05:21,750 --> 00:05:25,110
containing two terabytes of size for us to use.

141
00:05:25,110 --> 00:05:27,120
The next type of RAID we need to discuss,

142
00:05:27,120 --> 00:05:28,890
is known as a RAID 1.

143
00:05:28,890 --> 00:05:30,270
Whenever you hear RAID 1,

144
00:05:30,270 --> 00:05:34,290
I want you to think about two words, mirror and redundancy.

145
00:05:34,290 --> 00:05:37,620
When you have a RAID 1, you have a mirrored disk array.

146
00:05:37,620 --> 00:05:40,530
This means that every single thing that's put on disk zero,

147
00:05:40,530 --> 00:05:42,600
is also put on disk one.

148
00:05:42,600 --> 00:05:44,910
So if I have a file called A

149
00:05:44,910 --> 00:05:46,890
and I break it up into four pieces,

150
00:05:46,890 --> 00:05:49,320
both disk zero and disk one are going to have

151
00:05:49,320 --> 00:05:51,960
all of those four parts of file A.

152
00:05:51,960 --> 00:05:54,270
And as you can see here, one, two, three

153
00:05:54,270 --> 00:05:56,190
and four is on disk zero.

154
00:05:56,190 --> 00:05:59,160
One, two, three and four is also on disk one.

155
00:05:59,160 --> 00:06:02,550
So if I delete everything on disk one, guess what?

156
00:06:02,550 --> 00:06:05,250
I can still access it on disk zero.

157
00:06:05,250 --> 00:06:06,330
This is what we're talking about

158
00:06:06,330 --> 00:06:08,310
by having a mirror disk array.

159
00:06:08,310 --> 00:06:11,730
The fact is, both of these disks have an identical copy

160
00:06:11,730 --> 00:06:14,370
and this gives us a great amount of redundancy.

161
00:06:14,370 --> 00:06:16,230
In fact, it's fully redundant,

162
00:06:16,230 --> 00:06:17,460
because we have an entire disk

163
00:06:17,460 --> 00:06:20,580
that can go away and I can still operate with no problems,

164
00:06:20,580 --> 00:06:22,920
because I can rely on the other disk.

165
00:06:22,920 --> 00:06:25,800
There is one big downside to using a RAID 1 though,

166
00:06:25,800 --> 00:06:28,650
and that's the loss of space on one of those disks,

167
00:06:28,650 --> 00:06:31,290
because if I have to take two one terabyte hard disks,

168
00:06:31,290 --> 00:06:34,350
I no longer get two terabytes of storage space to use,

169
00:06:34,350 --> 00:06:37,290
instead I'm only getting one terabyte of space.

170
00:06:37,290 --> 00:06:38,123
Why?

171
00:06:38,123 --> 00:06:39,270
Because I have a mirrored copy

172
00:06:39,270 --> 00:06:41,040
of every single piece of data

173
00:06:41,040 --> 00:06:43,440
and that means I have to make two full copies

174
00:06:43,440 --> 00:06:44,970
and it takes up twice the amount of space

175
00:06:44,970 --> 00:06:46,470
to store those files.

176
00:06:46,470 --> 00:06:48,720
So if you have half of the total space

177
00:06:48,720 --> 00:06:50,580
being used simply for redundancy,

178
00:06:50,580 --> 00:06:53,280
this means you're paying a lot more for storage costs,

179
00:06:53,280 --> 00:06:55,770
because you're going to be using something like a RAID 1 here,

180
00:06:55,770 --> 00:06:57,030
instead of a RAID 0

181
00:06:57,030 --> 00:06:59,430
that allows you to use all of the disk space.

182
00:06:59,430 --> 00:07:02,130
So if you want to get the best of both worlds,

183
00:07:02,130 --> 00:07:03,300
you really might want to consider

184
00:07:03,300 --> 00:07:05,580
using something like a RAID 5.

185
00:07:05,580 --> 00:07:08,670
A RAID 5 is going to give you the redundancy through parity.

186
00:07:08,670 --> 00:07:10,590
So when you hear RAID 5,

187
00:07:10,590 --> 00:07:12,450
I want you to remember the keywords.

188
00:07:12,450 --> 00:07:15,090
These are redundancy and parity.

189
00:07:15,090 --> 00:07:17,100
Now, a RAID 5 is a bit different

190
00:07:17,100 --> 00:07:19,440
in how it provides that redundancy though.

191
00:07:19,440 --> 00:07:22,200
Instead of using a full mirror like a RAID 1 did

192
00:07:22,200 --> 00:07:25,140
and taking up an entire disk worth of space,

193
00:07:25,140 --> 00:07:28,650
a RAID 5 is going to use striping and a computed parity

194
00:07:28,650 --> 00:07:30,780
across three or more disks.

195
00:07:30,780 --> 00:07:33,090
Now, it's important to remember and to take note

196
00:07:33,090 --> 00:07:35,970
that a RAID 5 can use three or more disks,

197
00:07:35,970 --> 00:07:38,700
but you must have at least three disks

198
00:07:38,700 --> 00:07:41,160
in order to configure a RAID 5.

199
00:07:41,160 --> 00:07:44,220
Now, a RAID 5 with three disks is going to work like this.

200
00:07:44,220 --> 00:07:46,710
First, we have three disks, disk zero,

201
00:07:46,710 --> 00:07:48,510
disk one, and disk two.

202
00:07:48,510 --> 00:07:51,120
If I want to store four different files on those drives,

203
00:07:51,120 --> 00:07:54,660
I can do this by putting pieces of file A, B, C and D

204
00:07:54,660 --> 00:07:56,370
on all of those drives.

205
00:07:56,370 --> 00:08:00,450
Notice that B, C and D have this thing called a Bp,

206
00:08:00,450 --> 00:08:02,550
a Cp and a Dp.

207
00:08:02,550 --> 00:08:04,740
This is the computed parity.

208
00:08:04,740 --> 00:08:08,130
So when I take file B and I put half on disk zero

209
00:08:08,130 --> 00:08:10,642
and half on disk one, I then can do a calculation

210
00:08:10,642 --> 00:08:14,340
and put the results of that calculation onto disk two.

211
00:08:14,340 --> 00:08:16,080
Now, if I lose one of those disks,

212
00:08:16,080 --> 00:08:18,420
I can use the part that I have and the parity

213
00:08:18,420 --> 00:08:20,370
in order to calculate that file,

214
00:08:20,370 --> 00:08:22,650
or if I have the two parts and no parity,

215
00:08:22,650 --> 00:08:24,600
I can then simply recalculate the parity

216
00:08:24,600 --> 00:08:26,760
and recreate that file as well.

217
00:08:26,760 --> 00:08:28,710
Now, I know that sounds a little bit complicated,

218
00:08:28,710 --> 00:08:30,600
but I want you to think about it this way.

219
00:08:30,600 --> 00:08:33,299
Let's say I gave you two numbers and I give you an answer.

220
00:08:33,299 --> 00:08:36,390
For example, two plus three equals five.

221
00:08:36,390 --> 00:08:38,789
Now, if I take away any of the three numbers

222
00:08:38,789 --> 00:08:40,350
and I give you the other two,

223
00:08:40,350 --> 00:08:43,049
you could still figure out what the other one was, right?

224
00:08:43,049 --> 00:08:45,810
Of course you could, because if I gave you two and three,

225
00:08:45,810 --> 00:08:48,030
you could add them together and get five.

226
00:08:48,030 --> 00:08:50,880
If I gave you two plus something equals five,

227
00:08:50,880 --> 00:08:53,730
you could say, well, five minus two is three.

228
00:08:53,730 --> 00:08:55,650
So the answer must be three.

229
00:08:55,650 --> 00:08:58,350
Or if I gave you something plus three is five.

230
00:08:58,350 --> 00:09:00,630
You could say that five minus three is two.

231
00:09:00,630 --> 00:09:01,637
And therefore, you calculated

232
00:09:01,637 --> 00:09:03,960
that the missing number was two.

233
00:09:03,960 --> 00:09:06,420
That's what we're doing inside of a RAID 5.

234
00:09:06,420 --> 00:09:07,620
We're going to be able to recompute

235
00:09:07,620 --> 00:09:09,270
the missing parts of the file

236
00:09:09,270 --> 00:09:11,760
by using the known parts and the stored parity

237
00:09:11,760 --> 00:09:13,500
and this is how redundancy through parity

238
00:09:13,500 --> 00:09:14,850
is going to be achieved.

239
00:09:14,850 --> 00:09:16,170
The great thing about this,

240
00:09:16,170 --> 00:09:17,610
is that it takes up less disk space

241
00:09:17,610 --> 00:09:19,110
to store a computed parity

242
00:09:19,110 --> 00:09:21,540
than it does to store the entire mirrored file.

243
00:09:21,540 --> 00:09:24,330
So if I'm using three drives in a RAID 5,

244
00:09:24,330 --> 00:09:27,750
I'm only using one third of the space for that parity.

245
00:09:27,750 --> 00:09:29,220
If I use four drives,

246
00:09:29,220 --> 00:09:32,040
I'm losing only one fourth of the space for that parity.

247
00:09:32,040 --> 00:09:34,530
And if I'm using five drives, I'm only going to lose one fifth

248
00:09:34,530 --> 00:09:36,840
of the total space for that parity.

249
00:09:36,840 --> 00:09:39,210
This is a lot less than a full mirrored file.

250
00:09:39,210 --> 00:09:41,640
So it's a lot more efficient to create a RAID 5

251
00:09:41,640 --> 00:09:43,560
in terms of space, than using a RAID 1

252
00:09:43,560 --> 00:09:45,390
using a mirrored array.

253
00:09:45,390 --> 00:09:48,570
For this reason, RAID 5 is the most popular type of RAID

254
00:09:48,570 --> 00:09:50,910
in use today and you're going to find it heavily used

255
00:09:50,910 --> 00:09:53,040
in most server environments.

256
00:09:53,040 --> 00:09:55,320
Next, let's talk about RAID 6.

257
00:09:55,320 --> 00:09:57,360
What exactly is a RAID 6?

258
00:09:57,360 --> 00:10:00,330
Well, six is better than five by one

259
00:10:00,330 --> 00:10:01,950
and any time you hear RAID 6,

260
00:10:01,950 --> 00:10:04,260
I want you to think of five plus one.

261
00:10:04,260 --> 00:10:06,330
So everything that was true about a RAID 5

262
00:10:06,330 --> 00:10:08,520
is still true about a RAID 6,

263
00:10:08,520 --> 00:10:11,880
except we are going to have double parity in a RAID 6,

264
00:10:11,880 --> 00:10:13,530
instead of single parity.

265
00:10:13,530 --> 00:10:15,060
Because of this double parity,

266
00:10:15,060 --> 00:10:17,010
we also need to add an extra drive

267
00:10:17,010 --> 00:10:19,020
and have a minimum of at least four drives

268
00:10:19,020 --> 00:10:20,700
to create a RAID 6.

269
00:10:20,700 --> 00:10:24,660
Now, why would you want to use a RAID 6 instead of a RAID 5?

270
00:10:24,660 --> 00:10:27,750
Well, in a RAID 5, I can only lose one drive

271
00:10:27,750 --> 00:10:29,610
and keep operating that array.

272
00:10:29,610 --> 00:10:33,300
In RAID 6, I can actually lose two disks and keep operating.

273
00:10:33,300 --> 00:10:36,360
So if I have maybe five or 10 disk drives,

274
00:10:36,360 --> 00:10:37,860
using two of them for parity

275
00:10:37,860 --> 00:10:39,900
gives me a much better redundancy value

276
00:10:39,900 --> 00:10:41,400
than if I just use RAID 5

277
00:10:41,400 --> 00:10:44,070
with a single redundancy and single parity.

278
00:10:44,070 --> 00:10:47,790
This is the main difference between a RAID 5 and a RAID 6.

279
00:10:47,790 --> 00:10:49,710
Now, the last type of RAID we're going to discuss,

280
00:10:49,710 --> 00:10:51,660
is known as a RAID 10.

281
00:10:51,660 --> 00:10:54,540
A RAID 10 is really a RAID of RAIDs.

282
00:10:54,540 --> 00:10:57,570
What I mean by this, is that I actually have two RAID 1s

283
00:10:57,570 --> 00:11:00,990
and they're being placed inside a RAID 0 configuration.

284
00:11:00,990 --> 00:11:02,670
If we go back to a RAID 0,

285
00:11:02,670 --> 00:11:05,490
we remember this is all about speed and striping

286
00:11:05,490 --> 00:11:08,310
and so as the file comes in, I'm going to stripe it

287
00:11:08,310 --> 00:11:11,310
and put half to the left side and half to the right side.

288
00:11:11,310 --> 00:11:13,620
But because each of that left and right side

289
00:11:13,620 --> 00:11:15,300
is actually a mirrored RAID,

290
00:11:15,300 --> 00:11:17,700
I have all of the odd stuff on the left side

291
00:11:17,700 --> 00:11:19,920
and all of the even stuff on the right side,

292
00:11:19,920 --> 00:11:22,080
and now I have two full copies.

293
00:11:22,080 --> 00:11:25,140
Because of this setup, you need a minimum of four disks

294
00:11:25,140 --> 00:11:27,240
to be able to create a RAID 10.

295
00:11:27,240 --> 00:11:30,360
This means I'm going to lose 50% of my total disk space

296
00:11:30,360 --> 00:11:33,120
to create this striped array of mirrored to arrays,

297
00:11:33,120 --> 00:11:34,223
but I do get the benefit

298
00:11:34,223 --> 00:11:38,430
of having two fully redundant mirrors inside my RAID 10.

299
00:11:38,430 --> 00:11:40,470
RAID 10 is also pretty fast,

300
00:11:40,470 --> 00:11:43,080
because you're using that RAID 0 striping technique

301
00:11:43,080 --> 00:11:44,970
across two mirrored arrays.

302
00:11:44,970 --> 00:11:48,270
So with RAID 10, you get the benefits of RAID 1

303
00:11:48,270 --> 00:11:50,520
and the benefits of RAID 0,

304
00:11:50,520 --> 00:11:53,580
but you're having to use four disks to do this.

305
00:11:53,580 --> 00:11:56,340
All right, now that we've reviewed the types of RAIDs,

306
00:11:56,340 --> 00:11:57,210
you might be wondering,

307
00:11:57,210 --> 00:11:58,994
how do I get information about my RAID

308
00:11:58,994 --> 00:12:01,440
from my Linux system and its Kernel?

309
00:12:01,440 --> 00:12:06,210
Well, to do that, you're going to use /proc/mdstat.

310
00:12:06,210 --> 00:12:08,370
This is a file and it's a text-based file

311
00:12:08,370 --> 00:12:12,060
that contains a snapshot of the Kernel's RAID or MD state.

312
00:12:12,060 --> 00:12:13,770
To read this file on your system,

313
00:12:13,770 --> 00:12:17,340
simply type cat /proc/mdstat

314
00:12:17,340 --> 00:12:20,130
in the command line interface and then hit ENTER.

315
00:12:20,130 --> 00:12:21,840
This will display the information to your screen

316
00:12:21,840 --> 00:12:25,020
about any known RAID configurations on your system.

317
00:12:25,020 --> 00:12:27,120
Now, for example, on one of my systems,

318
00:12:27,120 --> 00:12:30,240
I get the following returned when I enter this command.

319
00:12:30,240 --> 00:12:32,400
Under personalities, the file's going to tell me

320
00:12:32,400 --> 00:12:34,920
which RAIDs could be supported by my Kernel.

321
00:12:34,920 --> 00:12:37,710
In this case, it says I can support a RAID 6,

322
00:12:37,710 --> 00:12:39,930
a RAID 5 or a RAID 4.

323
00:12:39,930 --> 00:12:42,000
Next, we see that md0,

324
00:12:42,000 --> 00:12:44,430
which is the name of my array, is active.

325
00:12:44,430 --> 00:12:45,837
It's configured as a RAID 5

326
00:12:45,837 --> 00:12:49,290
and it's using three disk drives to make up that RAID 5.

327
00:12:49,290 --> 00:12:53,220
Sda1, sdd1 and sdb1.

328
00:12:53,220 --> 00:12:55,620
The numbers after each of these tells me which disk

329
00:12:55,620 --> 00:12:57,660
is physically located in the array

330
00:12:57,660 --> 00:13:01,050
and this is actually disk zero, which is sda1,

331
00:13:01,050 --> 00:13:05,820
disk one which is sdd1, and disk two which is sdd1.

332
00:13:05,820 --> 00:13:08,310
Next, we see the number of blocks supported,

333
00:13:08,310 --> 00:13:10,830
the size of the chunks and the status of the algorithm

334
00:13:10,830 --> 00:13:13,980
and then we can see the status of the disks in that RAID.

335
00:13:13,980 --> 00:13:15,390
And this is shown as UUU_.

336
00:13:17,070 --> 00:13:20,160
This means up, up, up and down.

337
00:13:20,160 --> 00:13:21,990
Notice, there's that underscore

338
00:13:21,990 --> 00:13:23,700
and when there's an underscore shown,

339
00:13:23,700 --> 00:13:25,920
this means there's a disk that is down.

340
00:13:25,920 --> 00:13:28,170
In this case, we can see the fourth disk,

341
00:13:28,170 --> 00:13:30,480
which is probably going to be sdc1.

342
00:13:30,480 --> 00:13:33,210
It's going to be down, because there's an underscore shown.

343
00:13:33,210 --> 00:13:35,760
This explains why the Kernel supports RAID 6,

344
00:13:35,760 --> 00:13:39,300
which requires four disks, but we're only using a RAID 5,

345
00:13:39,300 --> 00:13:41,370
which uses three disks, because we have three disks

346
00:13:41,370 --> 00:13:43,170
that are up and configured.

347
00:13:43,170 --> 00:13:45,990
Next, we're going to discuss one of the major applications

348
00:13:45,990 --> 00:13:47,250
of the device mapper,

349
00:13:47,250 --> 00:13:51,120
which is called the logical volume manager, or LVM.

350
00:13:51,120 --> 00:13:54,750
The LVM will map whole physical devices and partitions

351
00:13:54,750 --> 00:13:58,530
into one or more virtual containers, known as volume groups.

352
00:13:58,530 --> 00:14:02,370
Within these volume groups, are one or more logical volumes.

353
00:14:02,370 --> 00:14:05,463
Ultimately, these logical volumes become the storage devices

354
00:14:05,463 --> 00:14:08,580
that the system, the user and the applications

355
00:14:08,580 --> 00:14:10,980
are going to interact with and work with.

356
00:14:10,980 --> 00:14:14,310
With the logical volume manager, you can dynamically create,

357
00:14:14,310 --> 00:14:16,110
delete and resize volumes

358
00:14:16,110 --> 00:14:17,970
without having to reboot the system.

359
00:14:17,970 --> 00:14:20,130
You can also map multiple logical volumes

360
00:14:20,130 --> 00:14:22,290
across multiple physical devices

361
00:14:22,290 --> 00:14:26,040
and you can create virtual snapshots of each logical volume

362
00:14:26,040 --> 00:14:28,470
so that you can quickly and easily revert a volume

363
00:14:28,470 --> 00:14:30,330
to a specific state.

364
00:14:30,330 --> 00:14:34,470
The /dev/mapper directory contains all the logical volumes

365
00:14:34,470 --> 00:14:36,510
on a given system that are being managed

366
00:14:36,510 --> 00:14:38,700
by the logical volume manager.

367
00:14:38,700 --> 00:14:39,765
Devices in this directory

368
00:14:39,765 --> 00:14:43,830
are typically going to be called /dev/mapper,

369
00:14:43,830 --> 00:14:47,700
the volume group name, -the logical volume name.

370
00:14:47,700 --> 00:14:49,140
the logical volume manager

371
00:14:49,140 --> 00:14:50,477
divides its volume management tools

372
00:14:50,477 --> 00:14:54,030
into three categories based on three different components,

373
00:14:54,030 --> 00:14:57,120
including physical volume tools, volume group tools

374
00:14:57,120 --> 00:14:59,160
and logical volume tools.

375
00:14:59,160 --> 00:15:02,190
Some logical volume managers' physical volume tools

376
00:15:02,190 --> 00:15:04,380
will include things like pvscan,

377
00:15:04,380 --> 00:15:06,960
which is used to scan for all the physical devices

378
00:15:06,960 --> 00:15:10,080
that are being mounted and used as physical volumes.

379
00:15:10,080 --> 00:15:12,960
You also have pvcreate, which is used to initialize

380
00:15:12,960 --> 00:15:16,260
a driver partition to use as a physical volume.

381
00:15:16,260 --> 00:15:18,810
We also have pvdisplay, which is used to list

382
00:15:18,810 --> 00:15:21,090
the attributes of physical volumes.

383
00:15:21,090 --> 00:15:23,880
We have pvchange, which is used to change attributes

384
00:15:23,880 --> 00:15:25,530
of a physical volume.

385
00:15:25,530 --> 00:15:27,966
We have pvs, which is used to display information

386
00:15:27,966 --> 00:15:30,000
about physical volumes.

387
00:15:30,000 --> 00:15:32,430
We have pvck, which is used to check

388
00:15:32,430 --> 00:15:34,650
the metadata of physical volumes.

389
00:15:34,650 --> 00:15:36,450
And we have pvremove,

390
00:15:36,450 --> 00:15:39,120
which is used to remove physical volumes.

391
00:15:39,120 --> 00:15:41,400
Now, we also have some volume group tools.

392
00:15:41,400 --> 00:15:43,410
This includes vgscan,

393
00:15:43,410 --> 00:15:46,830
which is going to scan all physical devices for volume groups.

394
00:15:46,830 --> 00:15:50,010
We have vgcreate to create our volume groups.

395
00:15:50,010 --> 00:15:52,257
We have vgdisplay to list out attributes

396
00:15:52,257 --> 00:15:53,940
of our volume groups.

397
00:15:53,940 --> 00:15:56,520
We have vgchange to change the attributes

398
00:15:56,520 --> 00:15:57,960
of our volume groups.

399
00:15:57,960 --> 00:16:01,890
We have vgs to display information about our volume groups.

400
00:16:01,890 --> 00:16:06,150
We have vgck to check the metadata of those volume groups.

401
00:16:06,150 --> 00:16:09,150
We have vgrename to rename a volume group.

402
00:16:09,150 --> 00:16:11,880
We have vgreduce to remove physical volumes

403
00:16:11,880 --> 00:16:14,670
from a volume group to reduce its size.

404
00:16:14,670 --> 00:16:17,730
We have vgextend, which allows us to add physical volumes

405
00:16:17,730 --> 00:16:19,080
to the volume groups.

406
00:16:19,080 --> 00:16:21,030
We have vgmerge, where we can merge

407
00:16:21,030 --> 00:16:22,620
two volume groups together.

408
00:16:22,620 --> 00:16:24,900
We have vgsplit, which can be used to split

409
00:16:24,900 --> 00:16:26,700
a volume group into two groups

410
00:16:26,700 --> 00:16:28,020
and we have vgremove,

411
00:16:28,020 --> 00:16:30,420
where we can remove those volume groups.

412
00:16:30,420 --> 00:16:32,730
When we get down to our logical volume tools,

413
00:16:32,730 --> 00:16:34,410
we have things like lvscan,

414
00:16:34,410 --> 00:16:37,770
which scans all the physical devices for logical volumes.

415
00:16:37,770 --> 00:16:40,380
We have lvcreate to create logical volumes

416
00:16:40,380 --> 00:16:41,820
in a volume group.

417
00:16:41,820 --> 00:16:45,810
We have lvdisplay to list the attributes of logical volumes.

418
00:16:45,810 --> 00:16:48,027
Lvchange is going to be used to change attributes

419
00:16:48,027 --> 00:16:49,860
of the volumes.

420
00:16:49,860 --> 00:16:53,340
Lvs will display information about logical volumes

421
00:16:53,340 --> 00:16:56,730
and lvrename is used to rename the logical volumes.

422
00:16:56,730 --> 00:16:58,050
If you use lvreduce,

423
00:16:58,050 --> 00:17:00,780
that'll reduce the size of your logical volumes.

424
00:17:00,780 --> 00:17:04,319
Lvextend will extend the size of your logical volumes.

425
00:17:04,319 --> 00:17:07,290
Lvresize will resize the logical volumes

426
00:17:07,290 --> 00:17:11,130
and finally, lvremove will remove the logical volumes.

427
00:17:11,130 --> 00:17:12,359
Now, you may be wondering,

428
00:17:12,359 --> 00:17:14,396
do I have to memorize that long list of tools

429
00:17:14,396 --> 00:17:16,170
that Jason just read out?

430
00:17:16,170 --> 00:17:19,650
And the answer is no, because you always have the help files

431
00:17:19,650 --> 00:17:21,329
and the man files at your system

432
00:17:21,329 --> 00:17:23,220
when you're doing this in the real world.

433
00:17:23,220 --> 00:17:24,938
For the exam, they're not going to ask you

434
00:17:24,938 --> 00:17:27,089
each and every one of these commands,

435
00:17:27,089 --> 00:17:29,010
but it is something I wanted to introduce you to

436
00:17:29,010 --> 00:17:30,660
so you can get comfortable with the idea

437
00:17:30,660 --> 00:17:32,850
of how to work with logical volumes

438
00:17:32,850 --> 00:17:34,893
inside the logical volume manager.

