— Linux — 2 min read
As a Linux user, monitoring hard drive performance is crucial for maintaining smooth system operation. Over the years, I’ve adopted four tools to monitor and detect bottlenecks in my Linux hard drives: iostat, ioping, iotop, and glances. Each tool provides unique insights into disk performance. Here’s how I use them effectively:
iostatiostat is one of the first tools I turn to for an overview of disk performance. It provides metrics such as CPU usage, transactions per second (TPS), and data read/write rates.
1sudo apt install sysstat2iostat1Linux 5.4.0-200-generic (aithe209) 12/04/2024 _x86_64_ (80 CPU)2
3avg-cpu: %user %nice %system %iowait %steal %idle4 1.81 0.00 0.69 3.48 0.00 94.025
6Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd7sda 88.74 2814.06 423.50 0.00 5022715628 755889088 08nvme0n1 4.71 62.00 75.84 962.53 110653383 135366169 1717987804sda or nvme0n1 for targeted analysis.1iostat -m -p sdaThis command gives a more focused view of a specific disk, including read/write rates in MB/s.
iopingioping measures I/O latency, providing a real-time look at how fast your disks respond to requests. It’s particularly useful for spotting slow disks.
1sudo apt install ioping2sudo ioping /dev/sda14 KiB <<< /dev/sda (block device 16.4 TiB): request=1 time=31.4 ms24 KiB <<< /dev/sda (block device 16.4 TiB): request=2 time=31.4 ms34 KiB <<< /dev/sda (block device 16.4 TiB): request=14 time=34.1 ms (slow)44 KiB <<< /dev/sdb (block device 16.4 TiB): request=2 time=207.1 ms (very slow)iotopSimilar to top for CPU, iotop provides a real-time view of disk I/O usage by processes. It’s perfect for identifying I/O-intensive applications.
1sudo apt install iotop2sudo iotopiotop is especially useful during troubleshooting, as it directly links disk activity to specific processes, helping me optimize or debug applications.
glancesglances is a versatile monitoring tool that provides an overview of system performance, including CPU, memory, network, and disk I/O.
1sudo apt install glances2glances1DISK I/O R/s W/s2sda 2814.06 423.503MEM [||| 5.1%] active: 56.3G4CPU [ 0.3%] iowait: 0.0%5SWAP [||| 4.9%]R/s and W/s) give immediate feedback on workload intensity.%iowait, which signals potential disk bottlenecks.iostat to identify system-wide trends.ioping to pinpoint slow disks.iotop to find I/O-heavy processes.glances for an all-in-one view.By combining these four tools—iostat, ioping, iotop, and glances— I can detect bottlenecks early and ensure my hard drives operate efficiently. Whether you’re troubleshooting performance issues or optimizing your system, these tools are must-haves in any Linux toolkit.