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.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

7 Comments

Leave a Reply
  1. A minor quibble about terminology. All the above commands DISPLAY their output information on the terminal. The output will be PRINTED only if it is piped into some print function. PRINT usually refers to hard copy output.

    “If your root partition is getting full, you can resize root partition using LVM”
    Isn’t that a rather drastic procedure, requiring a total re-organization of all the storage devices on your system? It would take your system offline for an extended period of time. Wouldn’t using GParted to resize existing partitions be advisable, quicker, and less error-prone?

    Reply
  2. I don’t call these tools real monitoring tools, because you have them run them manually each time, so you have to do the monitoring yourselves.

    Reply
  3. What site would be good to get actual help on a Linux problem instead of being told all the things Im doing wrong posting my questions in the wrong site? My problem is I cant access my bios and have no splash screen to choose which O/S I want to log into.I will post some basic info here in hopes that you can help or guide me to anyone that can help.

    http://paste.ubuntu.com/26178393/

    thank you for your help and time.
    Jim

    Reply
    • @Jim

      To be honest, there is no single straightforward solution to this issue. And from my own experience, no single site will help you solve an Computer/IT problem. You need to carefully peruse through the web and dig through various resources relating to an issue.

      But first, what machine are you using(Dell, HP, Samsung, etc..)? There could possibly be a problem with your hardware causing you not to access the BIOS, for example the keyboard. The key for accessing the BIOS depends on the settings of the machine manufacturer, you could be using a wrong key.

      You can contact the machine manufacturer or read manuals or documentations to learn how to access the BIOS, that is if it isn’t corrupted.

      In addition, from the information you provided, i can noticed that you are using LILO boot loader, i personally prefer GRUB/2, you can change from LILO to GRUB2 using this guide: https://wiki.debian.org/FromLiloToGrub

      I hope this will give you a starting point towards solving your issue. In case of any thing, you can always write to us.

      Reply
  4. Your commands example is OK, but sometime, you have some bad luck. And something is wrong with your system. Block-id, uuid are very hard to identify, if I have several hdd/ssd/whatever.

    It could be very difficult to see that /dev/sdX or uuid, is located on xxx device, if I have 2 or more identical hdd/ssd. More simple is to use anywhere (fstab, as a example) /dev/disk/by-id/*.

    In this case you will get even the serial-number that is printed to the (any) hdd/ssd label. Try for example this:

    ls -l /dev/disk/by-id
    

    and you will understand what I am try to say! And you can use fdisk(whatever) /dev/disk/by-id/yyyyy

    Less errors and less mistakes (I make a new gpt table on the wrong disk …)

    Have a nice day, with BY-ID :)

    Reply
    • @Jan

      According to the fdisk man page – “fdisk is a dialog-driven program for creation and manipulation of partition tables. It understands GPT, MBR, Sun, SGI and BSD partition tables.” Though i have not extensively tested it on GPT disks, so you might practically be correct.

      Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.