1
00:00:00,120 --> 00:00:01,859
Storage issues are quite common

2
00:00:01,859 --> 00:00:03,960
when working on any operating system.

3
00:00:03,960 --> 00:00:08,220
Some of the most common ones are missing devices, volumes,

4
00:00:08,220 --> 00:00:10,890
mount points, denigrated storage,

5
00:00:10,890 --> 00:00:12,630
performance issues and more.

6
00:00:12,630 --> 00:00:15,870
So, I'm going to walk you through a couple commands

7
00:00:15,870 --> 00:00:20,103
to identify performance issues as well as optimize storage.

8
00:00:21,420 --> 00:00:23,340
The first set of commands we're going to walk

9
00:00:23,340 --> 00:00:25,620
through is the disk free command.

10
00:00:25,620 --> 00:00:28,542
Now we see it just lists all the different storages

11
00:00:28,542 --> 00:00:32,850
that we have, blocks, use, available, et cetera.

12
00:00:32,850 --> 00:00:35,523
Now, there's another option here.

13
00:00:36,360 --> 00:00:38,940
The "H" stands for human readable,

14
00:00:38,940 --> 00:00:41,163
so it makes it a lot more user friendly.

15
00:00:42,030 --> 00:00:43,800
Now we see similar information

16
00:00:43,800 --> 00:00:46,620
but just in a better format for us.

17
00:00:46,620 --> 00:00:50,940
Now, we also filter the results to a more specific device.

18
00:00:50,940 --> 00:00:53,221
So in this example, we're going to use

19
00:00:53,221 --> 00:00:54,780
the backup system that we created prior.

20
00:00:54,780 --> 00:00:58,290
So we're going to do disk free human readable

21
00:00:58,290 --> 00:01:00,663
for the backup system and we use the data one.

22
00:01:03,900 --> 00:01:04,739
Okay.

23
00:01:04,739 --> 00:01:07,290
Again, the clean view of the statistics

24
00:01:07,290 --> 00:01:08,940
of the particular storage device.

25
00:01:11,550 --> 00:01:12,990
So that's problem, we're going to also go

26
00:01:12,990 --> 00:01:15,630
through the disk usage command.

27
00:01:15,630 --> 00:01:19,140
Now this command, since had a lot of information

28
00:01:19,140 --> 00:01:21,090
so we just want to look at it real quick.

29
00:01:24,540 --> 00:01:29,540
So it gives pretty much the use of every drive.

30
00:01:29,700 --> 00:01:33,370
So we need to specify this, so we want to do sudo.

31
00:01:36,480 --> 00:01:39,783
We're going to use our same folder from earlier.

32
00:01:41,100 --> 00:01:45,483
And again, this is a very clean way of viewing disk usage.

33
00:01:49,080 --> 00:01:51,730
Might be more useful in our particular situation too.

34
00:01:52,568 --> 00:01:54,513
I actually use the whole folder.

35
00:01:55,860 --> 00:01:57,300
So we do it that way.

36
00:01:57,300 --> 00:01:59,010
We just get quick clean view

37
00:01:59,010 --> 00:02:01,353
of how much information is being used.

38
00:02:02,520 --> 00:02:03,810
Now, the next command we're going to go

39
00:02:03,810 --> 00:02:06,750
over is the input output stat.

40
00:02:06,750 --> 00:02:09,030
Now, this command's going to give us rewrite statistics

41
00:02:09,030 --> 00:02:11,700
of the particular volume that we're looking at.

42
00:02:11,700 --> 00:02:14,640
So first we're going to use, instead

43
00:02:14,640 --> 00:02:19,640
we're going to use the backup again, just for this example

44
00:02:21,840 --> 00:02:23,813
we're just going to keep using the data one.

45
00:02:26,820 --> 00:02:27,900
For the first set, we're going to go

46
00:02:27,900 --> 00:02:30,180
through transactions for a second.

47
00:02:30,180 --> 00:02:33,030
The read speed, the write speed, the total amount

48
00:02:33,030 --> 00:02:36,603
of kilobytes read and total amount kilobytes written.

49
00:02:38,220 --> 00:02:41,100
Now, the best thing to do is compare it

50
00:02:41,100 --> 00:02:43,380
'cause it's kind of hard unless you know a good baseline

51
00:02:43,380 --> 00:02:45,270
of how fast it typically moves.

52
00:02:45,270 --> 00:02:49,620
So, usually you have to view this over time and to see

53
00:02:49,620 --> 00:02:53,103
if there's any huge difference between these values.

54
00:02:54,510 --> 00:02:57,000
So another command that's very useful is using

55
00:02:57,000 --> 00:02:59,190
the input output ping command.

56
00:02:59,190 --> 00:03:02,490
Now, it lets us track latency in real time.

57
00:03:02,490 --> 00:03:05,880
So, we're going to use for this example and put

58
00:03:05,880 --> 00:03:10,410
out the ping use, okay, we're going to use account four.

59
00:03:11,730 --> 00:03:13,233
If not, it'll be unlimited.

60
00:03:14,250 --> 00:03:17,553
You want to use backup system and the data back.

61
00:03:23,590 --> 00:03:25,800
Okay, and of course, similar to the ping,

62
00:03:25,800 --> 00:03:29,550
it lets us know how long it's taking per request.

63
00:03:29,550 --> 00:03:32,010
So again, once we get a good baseline, we can tell

64
00:03:32,010 --> 00:03:35,220
if there's any issues, if it's a lot slower than normal,

65
00:03:35,220 --> 00:03:37,270
you'll see those values are a lot higher.

66
00:03:39,540 --> 00:03:42,900
Another Linux current process is scheduling.

67
00:03:42,900 --> 00:03:45,150
Now this is very important for optimization

68
00:03:45,150 --> 00:03:47,610
because there'd be scenarios where we don't want

69
00:03:47,610 --> 00:03:50,220
to treat every request the same.

70
00:03:50,220 --> 00:03:53,520
So, the system prioritizes certain requests over others

71
00:03:53,520 --> 00:03:55,623
to minimize performance issues.

72
00:03:56,850 --> 00:03:58,710
Now there's three primary ways

73
00:03:58,710 --> 00:04:00,510
to do this type of scheduling.

74
00:04:00,510 --> 00:04:03,840
There's a deadline, CFQ which stands

75
00:04:03,840 --> 00:04:06,870
for complete fair queuing and the NOP one,

76
00:04:06,870 --> 00:04:08,670
which stands for just no input output.

77
00:04:08,670 --> 00:04:11,040
So pretty much there's no priority on anything.

78
00:04:11,040 --> 00:04:16,040
Now, the no input output one, NOP is very useful

79
00:04:16,890 --> 00:04:19,740
for the scenario when we're using flash drives

80
00:04:19,740 --> 00:04:22,680
and modern hard drives because those systems typically

81
00:04:22,680 --> 00:04:25,710
have their own scheduling built into the controller

82
00:04:25,710 --> 00:04:28,860
and not rely on the current to make those decisions.

83
00:04:28,860 --> 00:04:31,315
So, we're going to use an example really quick

84
00:04:31,315 --> 00:04:34,900
and let's just view the current value

85
00:04:36,750 --> 00:04:38,733
of the schedule that we currently have.

86
00:04:49,740 --> 00:04:52,590
Now, the one that's in the brackets is the one

87
00:04:52,590 --> 00:04:54,210
that's currently set.

88
00:04:54,210 --> 00:04:57,090
So for this system, we have the deadline one set.

89
00:04:57,090 --> 00:04:58,560
Now we're just going to change this

90
00:04:58,560 --> 00:05:00,570
and it's going to be a simple echo command,

91
00:05:00,570 --> 00:05:02,320
but I'm going to switch to root first.

92
00:05:06,600 --> 00:05:09,690
Okay, now that I'm root, we're going to switch this scheduler

93
00:05:09,690 --> 00:05:14,690
to the no op configuration, it'd be simple little echo.

94
00:05:14,850 --> 00:05:15,843
I'm going to do no op.

95
00:05:16,770 --> 00:05:17,970
I'm going to go to the sys.

96
00:05:20,867 --> 00:05:25,867
Block, sda, queue, scheduler.

97
00:05:31,260 --> 00:05:34,050
Okay, command went through successfully.

98
00:05:34,050 --> 00:05:36,443
Again, just to view, make sure that went through.

99
00:05:39,300 --> 00:05:41,760
Again, the one in the bracket is going to identify

100
00:05:41,760 --> 00:05:43,560
the selected scheduler type.

101
00:05:43,560 --> 00:05:46,290
Sometimes we're going to run into issues where a device

102
00:05:46,290 --> 00:05:49,800
or typically a user is using excessive storage consumption.

103
00:05:49,800 --> 00:05:53,610
So we're going to walk through how this set quoters on a user.

104
00:05:53,610 --> 00:05:56,760
We're going to edit the fstab file.

105
00:05:56,760 --> 00:05:58,440
Again, that's what the current users

106
00:05:58,440 --> 00:06:00,510
at boot to understand what's going

107
00:06:00,510 --> 00:06:01,620
on within the file system.

108
00:06:01,620 --> 00:06:03,751
So we need to let it know that, Hey, look,

109
00:06:03,751 --> 00:06:06,510
we want to make sure that we have a quota

110
00:06:06,510 --> 00:06:09,003
on this particular backup system.

111
00:06:10,860 --> 00:06:13,170
So that's what we're typing in here.

112
00:06:13,170 --> 00:06:14,320
That's the mount point.

113
00:06:15,660 --> 00:06:16,893
That's the file system.

114
00:06:18,720 --> 00:06:23,720
And keeps on default setting and we're going to use user quota.

115
00:06:32,070 --> 00:06:33,423
Okay, great.

116
00:06:34,320 --> 00:06:35,520
Right click there.

117
00:06:35,520 --> 00:06:36,353
Okay.

118
00:06:37,530 --> 00:06:40,350
Now we'll have to remount the system.

119
00:06:40,350 --> 00:06:41,760
The "O" just stands for options,

120
00:06:41,760 --> 00:06:43,140
just letting the system know

121
00:06:43,140 --> 00:06:45,420
that there'll be options to follow.

122
00:06:45,420 --> 00:06:46,720
I'm going to use the remount.

123
00:06:54,049 --> 00:06:54,882
Okay.

124
00:06:56,640 --> 00:06:58,650
The command we're going to use to configure the user quotas

125
00:06:58,650 --> 00:07:01,833
for the data backup file system is quota check.

126
00:07:04,980 --> 00:07:09,330
We're going to use the options CUGM.

127
00:07:09,330 --> 00:07:12,030
The "C" means create new files,

128
00:07:12,030 --> 00:07:14,280
don't worry about anything that's existing.

129
00:07:14,280 --> 00:07:16,650
And the "U" and the "G" stands for users

130
00:07:16,650 --> 00:07:19,830
and groups that are part of the file system.

131
00:07:19,830 --> 00:07:22,020
And the "M" just lets us know not

132
00:07:22,020 --> 00:07:24,620
to remount this cause we've already done that prior.

133
00:07:26,520 --> 00:07:27,353
Okay.

134
00:07:29,370 --> 00:07:30,990
Next thing we need to do is actually turn

135
00:07:30,990 --> 00:07:33,990
on the check system and the "-A" stands

136
00:07:33,990 --> 00:07:36,120
for all file systems.

137
00:07:36,120 --> 00:07:39,600
Now this example, we're going to use a user I created J Snow.

138
00:07:39,600 --> 00:07:41,940
He's a pesky user, he's been using too much data.

139
00:07:41,940 --> 00:07:44,280
So we need to watch in real time how we're able

140
00:07:44,280 --> 00:07:49,280
to start putting information into the backup data system

141
00:07:49,890 --> 00:07:52,080
and how it cuts it off as the user goes

142
00:07:52,080 --> 00:07:54,450
above the soft and hard limits.

143
00:07:54,450 --> 00:07:58,325
So, what we need to do is edit the quota for John Snow.

144
00:07:58,325 --> 00:08:01,113
We're going to use the ed quota quota command.

145
00:08:03,240 --> 00:08:04,530
So we're going to identify the user.

146
00:08:04,530 --> 00:08:07,953
Again, we're going to use J snow in this example, the VM.

147
00:08:09,720 --> 00:08:12,423
So we're going to use I for insert, sorry.

148
00:08:14,160 --> 00:08:16,140
Here we're going to edit this soft limit

149
00:08:19,560 --> 00:08:22,413
of 10,000, 2,000 blocks.

150
00:08:23,610 --> 00:08:26,343
Put it to hard, 15,000.

151
00:08:29,130 --> 00:08:31,713
Keep this the same, 500 here.

152
00:08:36,780 --> 00:08:38,073
700 here.

153
00:08:40,919 --> 00:08:43,650
Now what we just changed was the soft and hard limits

154
00:08:43,650 --> 00:08:47,610
for the blocks that the user is allowed to use

155
00:08:47,610 --> 00:08:50,160
and all the way to the right, it's the soft and hard limits

156
00:08:50,160 --> 00:08:54,363
for the files specifically that the user stores.

157
00:08:56,280 --> 00:09:00,693
So, I'm get out of here and save this.

158
00:09:02,550 --> 00:09:03,780
Now in a second, we're going to switch

159
00:09:03,780 --> 00:09:07,500
to J Snow and we're going to actually input some data

160
00:09:07,500 --> 00:09:10,470
into that backup data system.

161
00:09:10,470 --> 00:09:12,480
So we need to actually make sure he has the

162
00:09:12,480 --> 00:09:14,850
proper permissions to do such things.

163
00:09:14,850 --> 00:09:17,869
So we're going to do the change model really quick

164
00:09:17,869 --> 00:09:20,853
to this backup system, just to make sure.

165
00:09:24,180 --> 00:09:25,013
Okay.

166
00:09:30,540 --> 00:09:31,953
Now let's switch to J Snow.

167
00:09:36,540 --> 00:09:38,790
All right, now we're going to use the DD command

168
00:09:39,698 --> 00:09:42,000
which is a copy command and pretty much it's just saying

169
00:09:42,000 --> 00:09:46,350
we're going to copy from a file that's the IF

170
00:09:46,350 --> 00:09:49,380
and it's going to be the dev zero file.

171
00:09:49,380 --> 00:09:50,580
This is just a dummy file,

172
00:09:50,580 --> 00:09:52,140
so don't worry too much about that.

173
00:09:52,140 --> 00:09:54,900
We're going to output to a file and this file is going

174
00:09:54,900 --> 00:09:59,520
to be the backup system that we created in the data folder.

175
00:09:59,520 --> 00:10:01,077
We're going to name it "My file".

176
00:10:04,200 --> 00:10:08,553
We're going to give it a value of one megabyte

177
00:10:08,553 --> 00:10:10,893
and we're going to do this five times.

178
00:10:13,790 --> 00:10:14,700
Okay?

179
00:10:14,700 --> 00:10:16,530
Now again, if you're not familiar with this

180
00:10:16,530 --> 00:10:18,743
we're going to list out what just happened here.

181
00:10:23,790 --> 00:10:25,470
So if you see at the bottom, we see

182
00:10:25,470 --> 00:10:29,463
the "my file" was created and it's roughly 5 million bites.

183
00:10:30,450 --> 00:10:31,680
Again, just a quick way

184
00:10:31,680 --> 00:10:33,633
to make the demonstration go smoothly.

185
00:10:35,790 --> 00:10:37,950
Now let's exit out of here 'cause we need

186
00:10:37,950 --> 00:10:41,670
to use pseudo commands to check out this report.

187
00:10:41,670 --> 00:10:44,153
So we're going to check out the report for the quota.

188
00:10:45,000 --> 00:10:46,083
The backup system.

189
00:10:50,640 --> 00:10:52,620
And now we can see it list out

190
00:10:52,620 --> 00:10:57,030
John has used roughly 5,000 blocks.

191
00:10:57,030 --> 00:11:02,030
He has a limit of 10,000, but his hard limit is 15,000.

192
00:11:02,640 --> 00:11:04,920
Now let's switch back to John.

193
00:11:04,920 --> 00:11:06,820
And we're going to do this one more time.

194
00:11:12,120 --> 00:11:16,060
This time we're going to create another file

195
00:11:18,990 --> 00:11:22,323
and we're going to make do this seven times, okay?

196
00:11:24,570 --> 00:11:27,480
Just double check that they went through properly.

197
00:11:27,480 --> 00:11:29,553
We'll see the second file was created,

198
00:11:29,553 --> 00:11:30,960
roughly 7 million bytes.

199
00:11:30,960 --> 00:11:32,660
Now let's check this report again.

200
00:11:33,900 --> 00:11:35,700
See how the information has changed.

201
00:11:40,320 --> 00:11:43,590
Now we see J Snow has used roughly 12,000 blocks,

202
00:11:43,590 --> 00:11:47,790
an example exceeding this soft block limit threshold.

203
00:11:47,790 --> 00:11:50,670
So you see that grace period is now counting

204
00:11:50,670 --> 00:11:52,263
down from the seven days.

205
00:11:53,310 --> 00:11:56,940
And again, if he does not reduce the amount used

206
00:11:56,940 --> 00:11:58,620
within the seven days, he will not be able

207
00:11:58,620 --> 00:12:02,370
to store any more information into that file system.

208
00:12:02,370 --> 00:12:04,740
And if he goes above the hard limit,

209
00:12:04,740 --> 00:12:06,153
he will also be cut off.

210
00:12:07,860 --> 00:12:10,503
Now, if you've guessed, we're going to switch back to John

211
00:12:10,503 --> 00:12:13,200
and we're going to do this one final time,

212
00:12:13,200 --> 00:12:15,663
just to see this in action.

213
00:12:17,850 --> 00:12:19,400
We're going to create another file

214
00:12:22,796 --> 00:12:24,573
and we're going to try to do this 10 times

215
00:12:24,573 --> 00:12:25,463
and we should get an error here.

216
00:12:29,700 --> 00:12:33,473
Now, if you look, you will see error writing

217
00:12:33,473 --> 00:12:36,180
that this quota was exceeded.

218
00:12:36,180 --> 00:12:39,180
So, what happens is the system identifies

219
00:12:39,180 --> 00:12:42,390
that J Snow was trying to use too much data

220
00:12:42,390 --> 00:12:44,250
so it will cut him off, it's not going to allow him

221
00:12:44,250 --> 00:12:45,930
to go above that hard limit.

222
00:12:45,930 --> 00:12:50,073
So once we do this quota report again,

223
00:12:53,910 --> 00:12:56,163
we'll see the cutoff happen.

224
00:13:02,760 --> 00:13:06,780
Again, it didn't allow him to use more than the hard limit.

225
00:13:06,780 --> 00:13:09,540
So we see this process is effective

226
00:13:09,540 --> 00:13:11,103
and it works in real time.

227
00:13:12,330 --> 00:13:14,490
Now thank you for sticking with me through this walkthrough

228
00:13:14,490 --> 00:13:16,383
and I'll see you in the next lesson.

