Nytro Posted July 21, 2012 Report Posted July 21, 2012 (edited) Linux iotop: Check What’s Stressing And Increasing Load On Your Hard Disksby Vivek Gite on July 20, 2012The iotop command is top like utility for disk I/O. It watches I/O usage information output by the Linux kernel (requires v2.6.20 or later) and displays a table of current I/O usage by processes or threads on the system. This post expalins how to install and use iotop to find out what's stressing (or program names) on your hard drives under Linux operating systems.Install iotopUse the yum command to install iotop under RHEL / CentOS Linux, enter:# yum install iotopSample outputs:Loaded plugins: auto-update-debuginfo, product-id, protectbase, rhnplugin, subscription-managerUpdating certificate-based repositories.Unable to read consumer identity0 packages excluded due to repository protectionsSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package iotop.noarch 0:0.3.2-3.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved============================================================================================================================================================================================= Package Arch Version Repository Size=============================================================================================================================================================================================Installing: iotop noarch 0.3.2-3.el6 rhel-x86_64-server-6 49 kTransaction Summary=============================================================================================================================================================================================Install 1 Package(s)Total download size: 49 kInstalled size: 0Is this ok [y/N]: yDownloading Packages:iotop-0.3.2-3.el6.noarch.rpm | 49 kB 00:00Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Installing : iotop-0.3.2-3.el6.noarch 1/1Installed products updated. Verifying : iotop-0.3.2-3.el6.noarch 1/1Installed: iotop.noarch 0:0.3.2-3.el6Complete!Debian / Ubuntu Linux user try apt-get command as follows to install the same:$ sudo apt-get install iotopSample outputs:[sudo] password for vivek:Reading package lists... DoneBuilding dependency treeReading state information... DoneThe following NEW packages will be installed: iotop0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded.Need to get 26.5 kB of archives.After this operation, 168 kB of additional disk space will be used.Get:1 http://debian.osuosl.org/debian/ squeeze/main iotop all 0.4-2+squeeze1 [26.5 kB]Fetched 26.5 kB in 1s (17.0 kB/s)Selecting previously deselected package iotop.(Reading database ... 256274 files and directories currently installed.)Unpacking iotop (from .../iotop_0.4-2+squeeze1_all.deb) ...Processing triggers for man-db ...Setting up iotop (0.4-2+squeeze1) ...Processing triggers for python-support ...How do I use iotop command?iotop command displays columns for the I/O bandwidth read and written by each process/thread during the sampling period. It also displays the percentage of time the thread/process spent while swapping in and while waiting on I/O. For each process, its I/O priority (class/level) is shown. In addition, the total I/O bandwidth read and written during the sampling period is displayed at the top of the interface. Type the following command to run iotop (must run as root):$ sudo iotopOR# iotopSample outputs:iotop: Linux Disk I/O Monitor CommandFig.01: iotop: Linux Disk I/O Monitor Command in ActionHowever, I recommend that you start iotop with --only option to see only processes or threads actually doing I/O, instead of showing all processes or threads (you can set this mode dynamically too see keyboard shortcut o for more info):# iotop --onlySample outputs:iotop: Linux Disk I/O Tools To See Process Eating Disk I/OFig.02: Only See Process Eating Your Disk I/OOther supported options by iotop command: -o, --only Only show processes or threads actually doing I/O, instead of showing all processes or threads. This can be dynamically toggled by pressing o. -b, --batch Turn on non-interactive mode. Useful for logging I/O usage over time. -n NUM, --iter=NUM Set the number of iterations before quitting (never quit by default). This is most useful in non-interactive mode. -d SEC, --delay=SEC Set the delay between iterations in seconds (1 second by default). Accepts non-integer values such as 1.1 seconds. -p PID, --pid=PID A list of processes/threads to monitor (all by default). -u USER, --user=USER A list of users to monitor (all by default) -P, --processes Only show processes. Normally iotop shows all threads. -a, --accumulated Show accumulated I/O instead of bandwidth. In this mode, iotop shows the amount of I/O processes have done since iotop started. -k, --kilobytes Use kilobytes instead of a human friendly unit. This mode is useful when scripting the batch mode of iotop. Instead of choosing the most appropriate unit iotop will dis- play all sizes in kilobytes. -t, --time Add a timestamp on each line (implies --batch). Each line will be prefixed by the current time. -q, --quiet suppress some lines of header (implies --batch). This option can be specified up to three times to remove header lines. -q column names are only printed on the first iteration, -qq column names are never printed, -qqq the I/O summary is never printed.Important keyboard shortcuts for iotop command Hit the left and right arrow keys to change the sorting. Hit r to reverse the sorting order. Hit o only to see processes or threads actually doing I/O, instead of showing all processes or threads. Hit p only show processes. Normally iotop shows all threads. Hit a display accumulated I/O instead of bandwidth. In this mode, iotop shows the amount of I/O processes have done since iotop started. Ht i to change the priority of a thread or a process' thread(s) i.e. ionice. Hot q to quit iotop.Check out related media Sursa: Linux iotop: Check What’s Stressing And Increasing Load On Your Hard Disks Edited July 21, 2012 by Nytro Quote