Disk Space Monitoring

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
21 hours 25 minutes
Difficulty
Intermediate
CEU/CPE
21
Video Transcription
00:00
>> Hey there Cybrarians.
00:00
Welcome back to the Linux+ course here at Cybrary.
00:00
I'm your instructor Rob Goelz.
00:00
In today's lesson, we're going to be
00:00
talking about Disk Space Monitoring.
00:00
Upon completion of today's lesson,
00:00
you are going to be able to understand
00:00
the importance of disk space monitoring,
00:00
as well as identify some of the commands that
00:00
can be run to monitor and work with storage.
00:00
We'll see that during our demo at the end of the lesson.
00:00
Storage is another area where
00:00
we're probably going to encounter problems
00:00
that we're going to need to troubleshoot and that's why
00:00
we're covering it in this module.
00:00
Now, storage issues do tend to
00:00
focus on just a handful of things.
00:00
For example, running on a disk space or disk latency,
00:00
or just plain old failing disks and storage hardware.
00:00
We're going to look at monitoring
00:00
disk space in this lesson,
00:00
we'll talk about some of those other things
00:00
later in the module.
00:00
Linux has two commands that can be
00:00
used to monitor disk space,
00:00
and those are df and du.
00:00
Let's take a look at both of these
00:00
commands with some demo time.
00:00
Here we are in our demo environment and let's just go
00:00
ahead and run the df utility right off the bat.
00:00
Then we can see that this displays overall
00:00
disk space uses broken down by a file system,
00:00
but it is displaying this in one K blocks,
00:00
which is hard to make sense,
00:00
better way to view this is with the -H flag or option,
00:00
and that is actually the human-readable option.
00:00
Now if we hit "Enter" on that,
00:00
we can see that the size
00:00
instead of it being displayed in one K blocks,
00:00
it's displayed in a much more human-readable size.
00:00
We can see that
00:00
the dev temp FS file system is a 182 megs,
00:00
we can see that dev ST 82 is
00:00
236 gigs and so on and so forth.
00:00
Now, if we wanted to,
00:00
we could just display
00:00
a specific type of file system as well.
00:00
For example, we can specify AHT.
00:00
We add H for human-readable,
00:00
then we can add T as well for type,
00:00
then we'll specify that we just want to see
00:00
file systems of the type XFS.
00:00
Now when we hit "Enter",
00:00
we can see that we only have
00:00
three file systems that are explicitly running XFS,
00:00
and that is the root file system,
00:00
the home file system,
00:00
and then mount XFS.
00:00
We can go ahead and clear out of this.
00:00
Let's go ahead and take a look at our du command.
00:00
Now the du command is really
00:00
helpful when you're trying to drill down into
00:00
a file system and determine what is
00:00
eating up all the disk space on your system.
00:00
If we look back again at our df, HT,
00:00
XFS command, we can see that we
00:00
don't have anything running out of disk space here,
00:00
but for the purposes of this demo,
00:00
let's say we're running low on disk space,
00:00
let's say we have 98 percent in
00:00
use here on our root file system.
00:00
Well, one thing that we can do right off
00:00
the bat is just do a summary,
00:00
you can do a do du-SH,
00:00
and that will summarize in
00:00
human-readable what's going on on the root file system.
00:00
Here we can see we get some messages
00:00
about things that it can't access that's fine,
00:00
but here we can see that it's actually
00:00
only 14 gigs in use,
00:00
we could see more,
00:00
we get more information about it if
00:00
we don't include the summary flag.
00:00
But also we would see if the summary here
00:00
equals the amount of file space in use that we know,
00:00
we definitely do have an issue
00:00
on the system and there's not just
00:00
some open files lock hanging, some open handle.
00:00
What we can do now if we want to to drill down further,
00:00
is we can specify that
00:00
we don't want to see the summary anymore,
00:00
but we only want to go down one directory.
00:00
We can say, let's
00:00
specify anything that's not actually mounted on route,
00:00
and let's go down to one directory.
00:00
We'll say max depth equals 1.
00:00
The reason that we're doing this is because we don't
00:00
really have anything in the root,
00:00
we have stuff underneath the root that's eating
00:00
up the disk space in this root file system.
00:00
Let's go ahead and hit "Enter",
00:00
and now we can see here
00:00
is all the sub-directories of roots.
00:00
For example, Etsy Route var,
00:00
user, media, so on and so forth.
00:00
For example, what we can see is that a lot of space is
00:00
being taken up by Etsy and the user directory,
00:00
so that's 7.4 gigs and
00:00
the user is 4.2, and if we wanted to,
00:00
we could drill down further
00:00
into each of these directories,
00:00
and see what's taken up all of the disk space.
00:00
With that, we've reached the end of this lesson,
00:00
and in this lesson we covered
00:00
the importance of disk space monitoring,
00:00
if you are out of disk space is going to be a bad day.
00:00
Then we talked about how to use the commands df and
00:00
du to monitor disk space during our demo.
00:00
Thanks so much for being here and I look
00:00
forward to seeing you in the next lesson.
Up Next