Monitor your hard disk activity with KSysGuard
From openSUSE
The KDE environment offers an excellent tool for monitoring your hard disk's activity. That program is called KSysGuard. This is not to say that GNOME doesn't offer equally excellent tools in this area; rather, the purpose of this article is limited to the KDE environment, and so I will be focusing on using KSysguard.
You can launch KSysguard from the Kmenu, which is the equivalent of the Start button for you new GNU Linux users who are coming to us from the Windows world. The Kmenu is the little picture of the SUSE lizard's head in the lower left-hand corner. Just click on System > Monitor > KSysguard . If you prefer to use the terminal to launch applications, then simply type ksysguard from a shell Konsole.
Once Ksysguard launches, you will notice that you are presented with a GUI (Graphic User Interface) composed of a navigation panel on the left, and two tabs on the right. The first tab is labeled System Load, and the second is labeled Process Table. By default, my copy of KSysGuard launches with four panels open in the System Load tab: one panel for CPU load; one for load average; one for physical memory; and one for swap memory. While each of these panels contains useful information, none of those panels contains exactly the information that we are going to be using for this particular purpose of monitoring hard drive activity.
Instead, we are going to need to open a new worksheet to monitor system activity. You do so by clicking on File > New Worksheet from the upper left-hand corner of the KSysGuard application. You will be presented with a dialog box that offers you the option of giving a title to your new worksheet, as well as choosing how many rows and columns you want in your new work sheet, as well as the refresh interval. For the purposes of this exercise, I accepted the default settings of calling the worksheet "Sheet 1" and one column and one row and a refresh rate of 2 seconds.
Once you click okay to accept the default settings, you will now have a fresh new blank work sheet in front of you. If you look to the navigation panel on the left hand side of the application window, you will notice that the word "localhost" appears with a plus sign in front of it. Please click on the plus sign, and you will see that you are given a tree of different parts of your system to monitor, such as CPU 0, CPU 1 (if you have more than one CPU), CPU Load, Disk Throughput, Memory, Network, and Partition Usage.
Please click on the plus sign in front of Disk Throughput, because the purpose of this exercise is to see what demand is being placed on your hard drives. When you click on that plus sign, you will notice that the system has given a series of ratio numbers with plus signs in front of them, such as + 1:1 and +1:10 or +8:16 and so forth. One of those ratio numbers represents the hard drive that you will want to monitor. You just need to figure out which one of those rations is the proper number.
To figure out which of those numbers is the proper number, you will need the assistance of another program. This program runs out of the shell Konsole, and is called cat. Cat is going to read a file called /proc/diskstats and print it to your shell Konsole where you can read it. To start this program, go to the Kmenu (the lizard head) and click on System > Terminal > Konsole . Please note that you will be given the option of using Konsole in the superuser mode, but you probably should not use that option, simply because a superuser has the power to really cause damage to your computer, whereas an ordinary Konsole user can only damage their own account, for the most part. Once you have launched the Konsole program, please type this command at the user prompt, which will look like a > sign. Be sure to hit the enter key after typing the command:
> cat /proc/diskstats
You should get several columns of output in your shell terminal. The first row will be a series of single numbers that looks something like this
1 13 ram13 0 0 0 0 0 0 0 0 0 0 0 1 14 ram14 0 0 0 0 0 0 0 0 0 0 0 1 15 ram15 0 0 0 0 0 0 0 0 0 0 0 8 0 sda 12654 12263 727639 146980 1923 6069 64993 56020 0 52690 203000 8 1 sda1 286 671 0 0 8 2 sda2 23324 718944 6495 51785 8 3 sda3 760 7474 1498 11984 8 16 sdb 183 1532 2695 400 3 6 16 10 0 300 410 8 17 sdb1 404 614 0 0 8 18 sdb2 1242 1529 9 16 8 32 sdc 154 1575 4152 240 2 3 16 20 0 210 260 8 33 sdc1 1653 3544 5 16
In this particular example, we can see that the line with the most activity is this line:
8 0 sda 12654 12263 727639 146980 1923 6069 64993 56020 0 52690 203000
So in this example, the ratio number that we are going to want to monitor in the KSysGuard application is probably going to be + 8.0 . To test this hypothesis, just hit the up arrow on your keyboard while in the shell Konsole to reinvoke the cat /proc/diskstats command, and you will notice that the numbers will change in your shell Konsole output:
1 14 ram14 0 0 0 0 0 0 0 0 0 0 0 1 15 ram15 0 0 0 0 0 0 0 0 0 0 0 8 0 sda 13622 12406 744431 149840 7086 13147 169217 90710 0 72390 240640 8 1 sda1 286 671 0 0 8 2 sda2 23617 729104 9804 78257 8 3 sda3 1578 14106 10457 83656 8 16 sdb 183 1532 2695 400 3 6 16 10 0 300 410 8 17 sdb1 404 614 0 0 8 18 sdb2 1242 1529 9 16 8 32 sdc 154 1575 4152 240 2 3 16 20 0 210 260 8 33 sdc1 1653 3544 5 16
In our example above, you will notice that the values for line 8 0 sda changed quite a bit, as compared with no change for sdb or sdc, which are my other two hard drives. So you will definitely want to watch + 8.0, which is sda, the active hard disk.
Now that you know which ration number to watch, please go back to KSysGuard, and click on the appropriate ratio number; in this case, + 8.0 . You will be given an option of choosing what kind of activity to monitor. You will have a choice of Read Accesses; Read Data; Total Accesses; Write Accesses; Write Data. At this point, you can just use your mouse to drag any one of these options to the blank gray area on the right hand side of your KSysGuard panel. Be sure to plan ahead what process you want to monitor, and label your tab accordingly, so that you will remember whether you are watching all activity to the hard drive, or just write processes or read processes.
When you drag the process over to the blank area, you will notice that you are given the option of choosing Signal Plotter; Multimeter; Bar Graph; or Sensor Logger. You will have to play with these options to see which option you prefer. I personally found the Signal Plotter to be the most useful. Your mileage may vary.
Remember when you were given the option of creating rows and columns for data? You could easily open a new worksheet by clicking once again on File > New Worksheet and choosing two rows and three columns, so that you have enough room for all of these 5 options. Then you can label one panel for each process, and drag a process to monitor to each window.
The bottom line is that KSysGuard gives you highly granular control over the type of activity that you want to monitor, and even divides the types of hard drive activity that you want to monitor into different graphs on different tabs.
As the SUSE developers say, Have Lots of Fun !

