Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to monitor disk partition and usage in Linux

2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to monitor disk partitions and usage in Linux. I hope you will get something after reading this article. Let's discuss it together.

Df command

Df is a Linux command line utility that monitors Linux disk usage. The df command displays a complete summary of the file system disk usage details. "with the-hT option, it displays details about the file system, type, total disk size, used capacity, remaining capacity, utilization, disk installation location, and so on, in an easy-to-read format."

Use the-ht option below to display the usage and file system types of all file systems in an easy-to-read format.

[root@localhost ~] # df-hT Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 898M 0898M 0% / devtmpfs tmpfs 910M 0910M 0% / dev/shm tmpfs tmpfs 910M 29M 881M 4% / run tmpfs tmpfs 910M 0910M 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

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, except that the output is highlighted in different colors. The pydf command is not available by default in CentOS 7.x and RHEL 7.x. If you need to install pydf, you need to install the pippackage manager first, and then use pip to install the pydf tool.

# use the following command to install the piping package manager with yum: [root@localhost ~] # yum-y install python-pip # the following command line is to update the pip package manager: [root@localhost ~] # pip install-- upgrade pip # install the pydf tool using pip: [root@localhost ~] # pip install pydf

You can install it directly using apt package Manager in ubuntu:

$sudo apt install pydf

Use the following command to display all file systems:

[root@localhost] # pydf-a

Use the-h option below to display disk usage in an easy-to-read format.

[root@localhost] # 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

Fdiskf command

The fdisk command is one of the most commonly used command-line utilities in Linux to monitor partitions. Fdisk can get all the details about the partitions in the system, and it 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 commonly used arguments in the fdisk command is-l, which lists all available partitions in the Linux system and their device names:

[root@localhost ~] # fdisk-l

View the specified disk

The parameter-l is used to view all available partitions, or you can view details about a specific partition by providing a device name next to the-l parameter, as follows:

Sfdisk command

Sfdisk means scriptable fdisk,sfdisk is a command similar to fdisk, but it has more functionality than fdisk because it can display the partition size in MB.

[root@localhost] # sfdisk-l-uM

Cluster display is used by default, and disk capacity is displayed in MB after using the-uM option.

After reading this article, I believe you have a certain understanding of "how to monitor disk partitions and usage in Linux". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 237

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report