Several tools for monitoring disk partition and usage in Linux

Time:2021-12-9

In this article, we will discuss the command-line utilities that can be used to monitor disk usage in Linux, providing information about total size, capacity, total used, file system information, partition information, and so on. Let’s see how these tools help retrieve this information
DF command
DF is a Linux command line utility that monitors Linux disk usage. The DF command displays a complete summary of file system disk usage details. With the – HT option, it displays detailed information about file system, type, total disk size, used capacity, remaining capacity, utilization, and disk installation location in an easy to read format.
Several tools for monitoring disk partition and usage in Linux several tools for monitoring disk partition and usage in Linux
Use the – HT option below to display the usage and file system types of all file systems in an easy to read format.

[[email protected] ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 898M 0 898M 0% /dev
tmpfs tmpfs 910M 0 910M 0% /dev/shm
tmpfs tmpfs 910M 29M 881M 4% /run
tmpfs tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 37G 1.6G 36G 5% /
/dev/sda1 xfs 1014M 150M 865M 15% /boot
tmpfs tmpfs 182M 0 182M 0% /run/user/0
Several tools for monitoring disk partition and usage in Linux several tools for monitoring disk partition and usage in Linux

PYDF command
PYDF is a python command line utility and one of the best alternatives to DF commands in Linux. It works like the DF command, but the difference is that the output is highlighted in different colors. By default, the PYDF command is not available in CentOS 7. X and RHEL 7. X. If you need to install PYDF, you need to install PIP package manager first, and then use pip to install PYDF tool.

Install PIP package manager using Yum from the following command line:

[[email protected] ~]# yum -y install python-pip

The following command line updates the PIP package manager:

[[email protected] ~]# pip install –upgrade pip

To install PYDF using PIP:

[[email protected] ~]# pip install pydf
Several tools for monitoring disk partition and usage in Linux several tools for monitoring disk partition and usage in Linux
You can directly use apt package manager to install in Ubuntu:

$ sudo apt install pydf
Use the following command to display all file systems:

[[email protected] ~]# pydf -a
Several tools for monitoring disk partition and usage in Linux several tools for monitoring disk partition and usage in Linux
Use the – H option below to display disk usage in an easy to read format.

[[email protected] ~]# pydf -h
Filesystem Size Used Avail Use% Mounted on
/dev/centos/root 37G 1624M 35G 4.3 [#…………………] /
/dev/sda1 1014M 149M 865M 14.7 [###……………….] /boot
Several tools for monitoring disk partition and usage in Linux several tools for monitoring disk partition and usage in Linux

Fdiskf command
The fdisk command is one of the most commonly used command line utilities for monitoring partitions in Linux. Fdisk can obtain all the detailed information about the partitions in the system, and can also monitor, create, delete, move and copy any partition in the Linux system. Using the fdisk command, data can also be moved to a new disk.

View all disk partitions
One of the most common parameters in the fdisk command is – L, which lists all available partitions and their device names in the Linux system:

[[email protected] ~]# fdisk -l
Several tools for monitoring disk partition and usage in Linux several tools for monitoring disk partition and usage in Linux

View specified disk
The – L parameter is used to view all available partitions. You can also view the details of a specific partition by providing the device name next to the – L parameter, as shown below:
Several tools for monitoring disk partition and usage in Linux several tools for monitoring disk partition and usage in Linux

Sfdisk command
Sfdisk represents a scriptable fdisk. Sfdisk is a command similar to fdisk, but it has more functions than fdisk because it can display the partition size (in MB).

[[email protected] ~]# sfdisk -l -uM
Cluster display is used by default. After using the – um option, the disk capacity is displayed in MB.
Several tools for monitoring disk partition and usage in Linux several tools for monitoring disk partition and usage in Linux

summary
In this article, we will discuss the command-line utilities that can be used to monitor disk usage in Linux, providing information about total size, capacity, total used, file system information, partition information, and so on.

Recommended Today

Detailed examples of KVC in IOS

Detailed examples of KVC in IOS KVC is the abbreviation of key value coding, which means key value coding. In IOS, a method is provided to indirectly access the property of an object by using the name of the property (that is, the key). In fact, we can see various attributes of the class through […]