Insight: Tools To Monitor Linux Disk Usage And Partitions
It is always a wise and a good habit to monitor Linux disk usage and partitions to avoid future problems and complications. In this post, we are going to write about a few but best tools to monitor Linux disk usage and partitions.
Tools To Monitor Linux Disk Usage And Partitions
1. pydf command
pydf is a python script that is used to figure out the amount of disk space available. It is generally used to display the amount of used and available disk space on your Linux. The output of the pydf command is completely customizable. It is similar to a df command.
You need to install pydf command in your Linux operating system as it is not available by default.
Run the following command to install pydf command in Ubuntu 20.04 LTS/Debian:
sudo apt-get install pydf
Run the following commands to install pydf command in CentOS 8.X, RedHat 8.X.
yum install -y python-pip pip install --upgrade pip pip install pydf
How To Use PYDF Command
If you run only “pydf” command then it will display the disk space usages. Some of the command examples are:
pydf -a - To check file systems having 0 block
pydf -k - To print size in kilobytes
pydf -g - To print size in gigabytes
2. df command
df command is a useful built-in command in Linux. df also stands for the disk file system and can be used to get the details of available disk space along with used space on the Linux operating system.
How To Use df Command
df -h "To display sizes in Human Readable formats" df -T "Display the file system type in the output" df -a "List disk usage of all the file system" df -k "Print disk usage of file systems in block-size"
3. cfdisk command
cfdisk stands for curses fdisk. It is a curses-based disk partition table manipulator for Linux. It is based on libfdisk and supports GUID Partition Table, BSD disklabel, Master boot record, SGI, and SUN disk labels.
cfdisk /dev/sda
4. fdisk Command
Most used disk management command in Linux as fdisk also known as format disk is a partition table manipulator for Linux. Some of the fdisk command examples:
fdisk -l "View all disk partitions"
fdisk -l /dev/sda "View details about specific disk partition"
fdisk -s /dev/sda2 "Check size of a partition in Linux"
5. sfdisk command
sfdisk is a short form of scriptable fdisk. We can call sfdisk as an advanced version of fdisk. Some of the sfdisk command examples are:
sfdisk -l "View Existing Disk Partitions"
sfdisk -l -uM "Display Size in MB"
sfdisk /dev/sdf "Create New Disk Partitions"
sfdisk -s "Display Total Partition Size"
sfdisk -d "Dump Disk Partition Details to Text File"
sfdisk -lx /dev/sdf "Display Extended Partition Details"
sfdisk -T "Display All Disk Partition types"