linux查看磁盘使用程序,Linux 磁盘使用查看 查看使用磁盘程序 Monitoring disk activity in linux...

5 TOOLS FOR MONITORING DISK ACTIVITY IN LINUX

Here is a quick overview of 5 command-line tools that come in incredibly handy when troubleshooting or monitoring real-time disk activity in Linux. These tools are available in all major Linux distros.

IOSTAT

iostatcan be used to report the disk read/write rates and counts for an interval continuously. It collects disk statistics, waits for the given amount of time, collects them again and displays the difference. Here is the output of the commandiostat -y 5:

187616c86980d12812fee94436f30862.png

iostat in action

Each report, every 5 seconds, include the CPU stats and the disk stats. The CPU stats is a break up of where CPU time was spent during the interval. The disk stats includes the number of I/O requests per second (tps), the rate of read and write (kB_read/sandkB_write/s) and the amount of data read and written (kB_readandkB_wrtn).

The-yargument instructs iostat to discard the first report which are the stats since boot and are rarely useful. The “5” in the command line specifies the interval in seconds. The CPU stats can be omitted by including the-dflag, although practically it is useful to have it there.

IOTOP

iotopis a top-like utility for displaying real-time disk activity. It can list the processes that are performing I/O, alongwith the disk bandwidth they are using. Here is howiotop -olooks like:

e74b8461b182bd757bd1e7754e4b2e21.png

iotop in action

The-oflag restricts the display to processes that are doing I/O, omitting it shows all the processes. You can also see the total disk bandwidth usage on the top two lines.

In case you are wondering, the “total” values show the amount of data read from or written to the disk block device driver, and the “actual” values show the numbers for the actual hardware disk I/O. File system caching is one of the reasons for the difference in the values.

DSTAT

dstatis a little more user-friendly version ofiostat, and can show much more information than just disk bandwidth. Here is dstat in action, showing cpu and disk stats:

4c8e4e035c67e827b0ab1d54d8e97f4a.png

dstat in action

As you can see, it has nicely colored output. The command-line flags include-cfor CPU stats,-dfor disk stats,--disk-utilfor disk utilization and--disk-tpsfor disk transactions (I/O requests) per second. You can read more about dstathere.

ATOP

atopis particularly good for quickly grasping changes happening to the system. It does an excellent job of summarizing changes in each interval. Unlike the others, it can list all the processes that caused any system-level changes (like doing disk I/O) during the interval – this feature is present only inatop.

f054239cd6560eeef526b1cd1558f562.png

atop in action

Here we’re runningatopwith an interval of 1 second. The top section should be read from left to right: PRC shows process information, CPU the split of CPU usage, CPL the load averages, MEM the memory usage, SWP the swap file usage and DSK and NET the disk and network information respectively. The bottom section shows processes that did interesting things during the interval. You can read more about atophere.

IOPING

iopingis a quick and dirty storage volume latency checker. It is useful for checking if the elevated disk times that you’re seeing are because of a degradation of the underlying virtual disk / network / hardware.

627c5db4b66728bdc395469849d481f8.png

ioping in action

Low numbers (<1ms) and low variance in the numbers are indicators of a healthy storage volume.

CLOSING NOTES

All the tools listed above have more features and options, here are good places to start digging further:iostat,iotop,dstat,atopandioping.

If you’re interested in measuring disk performance, you should definitely also look atfioandsysbench. Both are fairly complicated, but are standard tools for the job.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值