10 Tools to Monitor Linux Disk Partitions and Usage in Linux

In this article, we will review a number of Linux command line utilities that you can use to check disk partitions in Linux.

Monitoring the space usage of storage devices is one of the most important tasks for a SysAdmin, which ensures that there is adequate free space available on the storage devices to maintain the efficient operation of your Linux system.

List of Command Line Tools to Check Linux Disk Partitions

The following is a list of command line utilities for printing storage device partition tables and space usage.

1. fdisk (fixed disk) Command

fdisk is a powerful and popular command line tool used for creating and manipulating disk partition tables. It supports various partition table formats, including GPT, MBR, Sun, SGI, and BSD.

You can use fdisk‘s user-friendly, text-based, menu-driven interface to perform tasks such as displaying, creating, resizing, deleting, modifying, copying, and moving partitions on storage disks

The fdisk command below will print the partition table of all mounted block devices:

$ sudo fdisk -l
fdisk – List Linux Disk Partition Table
fdisk – List Linux Disk Partition Table

For more usage and examples of the ‘fdisk‘ command, please read ‘10 ‘fdisk’ Command Examples to Manage Partitions‘.

2. sfdisk (scriptable fdisk) Command

sfdisk works similarly to fdisk as it can print or manipulate a storage disk partition table. However, sfdisk offers additional features that are not available in fdisk. You can use it just like fdisk, and it also supports GPT, MBR, Sun, and SGI partition tables.

One difference between the two is that sfdisk does not create the standard system partitions for SGI and SUN disk labels like fdisk does.

$ sudo sfdisk -l 
sfdisk – Check Linux Disk Partition Table
sfdisk – Check Linux Disk Partition Table

For more usage, go through the sfdisk man pages.

3. cfdisk (curses fdisk) Command

cfdisk is a simple program used for printing and managing disk partitions by providing basic partitioning functionality through a user-friendly interface that operates similarly to more powerful commands like fdisk and sfdisk, enabling users to view, add, delete, and modify hard disk partitions.

Use the right and left arrow keys to move the highlighter over the menu tabs.

$ sudo cfdisk
cfdisk – Print Linux Disk Partition Table
cfdisk – Print Linux Disk Partition Table

4. Parted Command

The parted command is a versatile and powerful utility for managing disk partitions on Unix-like operating systems. With a wide array of features, it allows users to create, resize, delete, and manipulate partitions on hard drives, making it essential for system administrators and advanced users.

The parted tool supports both MBR (Master Boot Record) and GPT (GUID Partition Table) partitioning schemes and provides options for various file systems.

Additionally, parted provides a range of advanced features, such as alignment control and the ability to create, resize and copy disk partitions (add a progress bar while copying), making it an indispensable tool for disk management tasks.

$ sudo parted -l
parted – A Partition Manipulation Tool
parted – A Partition Manipulation Tool

5. lsblk (list block) Command

The lsblk command provides a detailed overview of storage devices, including hard drives, solid-state drives, and removable media, along with their associated information like size, partitions, and mount points.

lsblk aids in system administration tasks, making it easier to identify available storage resources, understand disk configurations, and manage storage devices efficiently.

Its straightforward output and customization options make it a valuable tool for system administrators, helping ensure effective storage management and troubleshooting.

$ lsblk 
lsblk - List Block Devices in Linux
lsblk – List Block Devices in Linux

6. blkid (block id) Command

The blkid command is used to identify block devices such as hard drives and partitions by their Universally Unique Identifier (UUID) or other attributes. It provides crucial information about storage devices, making it easier to mount and manage them.

$ blkid 
blkid – Print Block Device Attributes
blkid – Print Block Device Attributes

7. hwinfo (hardware info) Command

The hwinfo command is used to provide comprehensive data about the system’s components, including CPU, RAM, storage devices, graphics cards, network interfaces, and more.

The system administrators and users employ ‘hwinfo‘ to diagnose hardware issues, identify compatible drivers, and enhance system performance.

$ hwinfo

To restrict the information to a summary, use --short option as in the command below:

$ hwinfo --short --block
hwinfo – Print Linux Hardware Information
hwinfo – Print Linux Hardware Information

Make sure the hwinfo tool is installed on your system to get the above results.

List of Command Line Tools to Monitor Linux Disk Space Usage

The following list includes command-line utilities for monitoring Linux disk space usage.

8. df (disk filesystem) Command

The df command is used to retrieve essential information about disk usage and available storage space on Linux file system usage.

The “df” command assists users in monitoring disk space allocation, identifying potential storage issues, and making informed decisions regarding data management and cleanup.

The '-hT' switch in the command below enables human-readable reporting of disk size, used space, available space, and used space percentages.

$ df -hT
df – Show Linux Disk Space Usage
df – Show Linux Disk Space Usage

9. du (disk usage) Command

The du command is used to allow users to assess the space occupied by files and directories on their storage device in a human-readable format.

The du command helps users identify which files or directories consume the most space, aiding in disk management, cleanup, and optimization tasks. This command is invaluable for system administrators and users seeking to maintain efficient disk usage.

$ du -sh /home/tecmint
df - Show Linux File Space-Usage
df – Show Linux File Space-Usage

10. pydf (python df) Command

The pydf command is an exceptional Python command line utility and a great replacement for the df command in Linux. It uses distinct colors to highlight disk partitions with specific attributes.

$ pydf
Pydf - Show Disk Usage in Colored Output
Pydf – Show Disk Usage in Colored Output

Make sure that the ‘pydf‘ utility is installed on your system. If it is not installed, you can install it using the ‘Install Pydf Tool in Linux‘ article.

What to Do When Your Linux Disk/Partition Is Running Out of Space?

Once you realize that any of your storage disk(s) is running out of space or is full, you should:

  • First, make a backup of all your important files on the system using any of the Linux system backup tools.
  • Next, check which files or directories are occupying the biggest amount of space on the disk(s) using the du command.
  • Then delete from the storage disk(s), any files that are no longer important or that you will not use in the future with the help of the rm command or you can CCleaner tools to find and delete unwanted files in Linux.
  • If your root partition is getting full, you can resize root partition using LVM, it should be pretty straight.

Note: In case you delete any important file, you can recover the deleted file in Linux.

Conclusion

In this article, we have talked about a number of useful command line utilities for displaying storage disk partition tables and monitoring space usage.

If there is any important command line utility for the same purpose, that we have left out? Let us know via the comment section below. You can possibly ask a question or provide us feedback as well.