Chapter 7. Step 7: Filesystems

You have just seen how to look at real-time system state in terms of processes, memory, and networking. Now I show how to check out the filesystems, with an eye toward disk utilization.

Displaying Filesystems

On any computer system, running out of disk space can cause many problems. On Linux, two commands are helpful in determining disk utilization.

The df (display filesystems) command shows the mounted files systems along with statistics on space usage, as you can see in Figure 7-1.

df command
Figure 7-1. df command

The main device you’re interested in is the first one, which shows /dev/vda1 mounted on /. Note the columns showing disk size, Used, Available, and Use%.

Figure 7-2 shows an example where disk utilization may be causing trouble.

df full command
Figure 7-2. df showing full disk drive

The /dev/vda1 device is 100% full!

Where Did All the Disk Space Go?

Once you’ve seen that there may be a problem with disk space, how do you find out where it is being used? You can use the du (disk utilization) command for that. By default, it descends through every directory and shows you disk usage for every subdirectory under which it is invoked (think DIR /S on CMD.EXE). That can generate a lot of output and can take a long time to run.

What we really want to do is start at the ...

Get Ten Steps to Linux Survival now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.