The duf command

1

Back in November of last year we published an article about dfc, a more modern version of the df command. I’m always on the lookout for new tools to use in my SysAdmin role and recently found the relatively new duf command.

The duf command, takes dfc even further with its advanced formatting. The results of the duf command with no options on my primary workstation are shown in Figure 1.

Figure 1: The duf command displays disk usage statistics in a well defined and easily readable format. Click to enlarge.

This cool and relatively new command displays storage statistics in tables that separate the storage device types into local, fuse (User space file storage), and special devices. Each type has it’s own characteristics and use cases, so separating them in this manner makes sense.

The local devices are logical volumes and partitions that provide the normal storage locations for our systems whether running or powered off.

The fuse devices are usually remote storage. On my system the /home/dboth/Pictures device is an SSHFS (SSH FileSystem) device that is on a remote system, the bunkerhill host in this case.

The special devices are usually virtual filesystems that the host uses for tracking and managing every part of the running system. The common ones we think about are /proc and /sys.

The duf command has several options designed to allow you to filter the storage devices and filesystem types, such as EXT4 or VFAT, so that you only see the ones you are interested in. On the opposite extreme, when used with the -all option it shows devices that are normally not displayed as can be seen in Figure 2.

I enjoy exploring data like this as I always learn something new. In this case, the most interesting — but not the only — thing, is /dev/shm, the shared memory device. This is an area of memory used by the operating system and running applications to perform IPC (Inter-Process Communications). This is where system tools and user-space programs can communicate and coordinate their activities.

To ensure the security of the system, user-space programs cannot access memory that belongs to the kernel or other operating system programs.

In Figure 2, if you were using the screen program, you might also see some interesting artifacts consisting of ASCII strings used to provide some of the formatting. But the data itself is unaffected and retains its formatting, so it’s still useful.

I’ll be experimenting with the duf command some more so I can discover more interesting things about it and about the many storage systems on my hosts.

Leave a Reply