Storage issues are quite common
when working on any operating system.
Some of the most common ones are missing devices, volumes,
mount points, denigrated storage,
performance issues and more.
So, I'm going to walk you through a couple commands
to identify performance issues as well as optimize storage.
The first set of commands we're going to walk
through is the disk free command.
Now we see it just lists all the different storages
that we have, blocks, use, available, et cetera.
Now, there's another option here.
The "H" stands for human readable,
so it makes it a lot more user friendly.
Now we see similar information
but just in a better format for us.
Now, we also filter the results to a more specific device.
So in this example, we're going to use
the backup system that we created prior.
So we're going to do disk free human readable
for the backup system and we use the data one.
Okay.
Again, the clean view of the statistics
of the particular storage device.
So that's problem, we're going to also go
through the disk usage command.
Now this command, since had a lot of information
so we just want to look at it real quick.
So it gives pretty much the use of every drive.
So we need to specify this, so we want to do sudo.
We're going to use our same folder from earlier.
And again, this is a very clean way of viewing disk usage.
Might be more useful in our particular situation too.
I actually use the whole folder.
So we do it that way.
We just get quick clean view
of how much information is being used.
Now, the next command we're going to go
over is the input output stat.
Now, this command's going to give us rewrite statistics
of the particular volume that we're looking at.
So first we're going to use, instead
we're going to use the backup again, just for this example
we're just going to keep using the data one.
For the first set, we're going to go
through transactions for a second.
The read speed, the write speed, the total amount
of kilobytes read and total amount kilobytes written.
Now, the best thing to do is compare it
'cause it's kind of hard unless you know a good baseline
of how fast it typically moves.
So, usually you have to view this over time and to see
if there's any huge difference between these values.
So another command that's very useful is using
the input output ping command.
Now, it lets us track latency in real time.
So, we're going to use for this example and put
out the ping use, okay, we're going to use account four.
If not, it'll be unlimited.
You want to use backup system and the data back.
Okay, and of course, similar to the ping,
it lets us know how long it's taking per request.
So again, once we get a good baseline, we can tell
if there's any issues, if it's a lot slower than normal,
you'll see those values are a lot higher.
Another Linux current process is scheduling.
Now this is very important for optimization
because there'd be scenarios where we don't want
to treat every request the same.
So, the system prioritizes certain requests over others
to minimize performance issues.
Now there's three primary ways
to do this type of scheduling.
There's a deadline, CFQ which stands
for complete fair queuing and the NOP one,
which stands for just no input output.
So pretty much there's no priority on anything.
Now, the no input output one, NOP is very useful
for the scenario when we're using flash drives
and modern hard drives because those systems typically
have their own scheduling built into the controller
and not rely on the current to make those decisions.
So, we're going to use an example really quick
and let's just view the current value
of the schedule that we currently have.
Now, the one that's in the brackets is the one
that's currently set.
So for this system, we have the deadline one set.
Now we're just going to change this
and it's going to be a simple echo command,
but I'm going to switch to root first.
Okay, now that I'm root, we're going to switch this scheduler
to the no op configuration, it'd be simple little echo.
I'm going to do no op.
I'm going to go to the sys.
Block, sda, queue, scheduler.
Okay, command went through successfully.
Again, just to view, make sure that went through.
Again, the one in the bracket is going to identify
the selected scheduler type.
Sometimes we're going to run into issues where a device
or typically a user is using excessive storage consumption.
So we're going to walk through how this set quoters on a user.
We're going to edit the fstab file.
Again, that's what the current users
at boot to understand what's going
on within the file system.
So we need to let it know that, Hey, look,
we want to make sure that we have a quota
on this particular backup system.
So that's what we're typing in here.
That's the mount point.
That's the file system.
And keeps on default setting and we're going to use user quota.
Okay, great.
Right click there.
Okay.
Now we'll have to remount the system.
The "O" just stands for options,
just letting the system know
that there'll be options to follow.
I'm going to use the remount.
Okay.
The command we're going to use to configure the user quotas
for the data backup file system is quota check.
We're going to use the options CUGM.
The "C" means create new files,
don't worry about anything that's existing.
And the "U" and the "G" stands for users
and groups that are part of the file system.
And the "M" just lets us know not
to remount this cause we've already done that prior.
Okay.
Next thing we need to do is actually turn
on the check system and the "-A" stands
for all file systems.
Now this example, we're going to use a user I created J Snow.
He's a pesky user, he's been using too much data.
So we need to watch in real time how we're able
to start putting information into the backup data system
and how it cuts it off as the user goes
above the soft and hard limits.
So, what we need to do is edit the quota for John Snow.
We're going to use the ed quota quota command.
So we're going to identify the user.
Again, we're going to use J snow in this example, the VM.
So we're going to use I for insert, sorry.
Here we're going to edit this soft limit
of 10,000, 2,000 blocks.
Put it to hard, 15,000.
Keep this the same, 500 here.
700 here.
Now what we just changed was the soft and hard limits
for the blocks that the user is allowed to use
and all the way to the right, it's the soft and hard limits
for the files specifically that the user stores.
So, I'm get out of here and save this.
Now in a second, we're going to switch
to J Snow and we're going to actually input some data
into that backup data system.
So we need to actually make sure he has the
proper permissions to do such things.
So we're going to do the change model really quick
to this backup system, just to make sure.
Okay.
Now let's switch to J Snow.
All right, now we're going to use the DD command
which is a copy command and pretty much it's just saying
we're going to copy from a file that's the IF
and it's going to be the dev zero file.
This is just a dummy file,
so don't worry too much about that.
We're going to output to a file and this file is going
to be the backup system that we created in the data folder.
We're going to name it "My file".
We're going to give it a value of one megabyte
and we're going to do this five times.
Okay?
Now again, if you're not familiar with this
we're going to list out what just happened here.
So if you see at the bottom, we see
the "my file" was created and it's roughly 5 million bites.
Again, just a quick way
to make the demonstration go smoothly.
Now let's exit out of here 'cause we need
to use pseudo commands to check out this report.
So we're going to check out the report for the quota.
The backup system.
And now we can see it list out
John has used roughly 5,000 blocks.
He has a limit of 10,000, but his hard limit is 15,000.
Now let's switch back to John.
And we're going to do this one more time.
This time we're going to create another file
and we're going to make do this seven times, okay?
Just double check that they went through properly.
We'll see the second file was created,
roughly 7 million bytes.
Now let's check this report again.
See how the information has changed.
Now we see J Snow has used roughly 12,000 blocks,
an example exceeding this soft block limit threshold.
So you see that grace period is now counting
down from the seven days.
And again, if he does not reduce the amount used
within the seven days, he will not be able
to store any more information into that file system.
And if he goes above the hard limit,
he will also be cut off.
Now, if you've guessed, we're going to switch back to John
and we're going to do this one final time,
just to see this in action.
We're going to create another file
and we're going to try to do this 10 times
and we should get an error here.
Now, if you look, you will see error writing
that this quota was exceeded.
So, what happens is the system identifies
that J Snow was trying to use too much data
so it will cut him off, it's not going to allow him
to go above that hard limit.
So once we do this quota report again,
we'll see the cutoff happen.
Again, it didn't allow him to use more than the hard limit.
So we see this process is effective
and it works in real time.
Now thank you for sticking with me through this walkthrough
and I'll see you in the next lesson.