You can use iostat command to check your disk utilization and monitoring sistem I/O device loading by observing the time the physical disks are active in relation to their average transfer rates.
Step 1: Install Sysstat Package
CentOS:
1 |
# yum install sysstat |
Debian/Ubuntu:
1 |
# apt-get install sysstat |
step 2 : iostat command for disk utilization report
iostat -d -x interval count
Description:
- -d : Display the device utilization report (d == disk)
- -x : Display extended statistics including disk utilization
- interval : It is time period in seconds between two samples . iostat 2 will give data at each 2 seconds interval.
- count : It is the number of times the data is needed . iostat 2 5 will give data at 2 seconds interval 5 times
e.g: To display 3 reports of extended statistics at 5 second intervals for disk
1 |
# iostat -d -x 5 3 |
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
[root@xen ~]# iostat -d -x 5 3 Linux 2.6.18-348.3.1.el5xen (xen.asep.us) 04/11/2013 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util sda 4.62 26.68 29.89 6.77 3604.88 247.62 105.09 0.15 3.98 1.16 4.24 sda1 0.00 0.00 0.01 0.00 0.73 0.00 121.76 0.00 4.16 2.02 0.00 sda2 0.30 3.82 2.38 0.59 330.32 35.26 123.22 0.01 4.01 1.07 0.32 sda3 0.01 0.00 0.11 0.00 15.12 0.01 131.79 0.00 2.61 0.56 0.01 sda4 0.00 0.00 0.00 0.00 0.00 0.00 2.00 0.00 2.00 2.00 0.00 sda5 4.31 22.87 27.39 6.18 3258.71 212.35 103.40 0.13 3.98 1.19 4.00 sdb 4.19 26.68 27.97 6.77 3586.86 247.62 110.37 0.32 9.22 1.22 4.22 sdb1 0.00 0.00 0.01 0.00 0.73 0.00 122.56 0.00 3.05 1.93 0.00 sdb2 0.38 3.82 2.26 0.59 330.64 35.26 128.55 0.02 7.31 1.13 0.32 sdb3 0.01 0.00 0.11 0.00 15.10 0.01 138.45 0.00 6.10 0.54 0.01 sdb4 0.00 0.00 0.00 0.00 0.00 0.00 2.00 0.00 2.00 2.00 0.00 sdb5 3.80 22.86 25.59 6.19 3240.40 212.35 108.64 0.30 9.40 1.25 3.98 sdc 4.49 25.75 29.88 4.84 3602.92 224.71 110.21 0.13 3.87 1.15 3.99 sdc1 0.00 0.00 0.01 0.00 0.73 0.00 119.01 0.00 6.49 2.02 0.00 sdc2 0.27 3.70 2.38 0.30 329.13 32.04 135.00 0.01 4.32 1.15 0.31 sdc3 0.01 0.00 0.11 0.00 15.10 0.01 134.07 0.00 3.48 0.49 0.01 sdc4 0.00 0.00 0.00 0.00 0.00 0.00 2.00 0.00 1.00 1.00 0.00 sdc5 4.21 22.04 27.39 4.54 3257.96 192.66 108.05 0.12 3.83 1.17 3.75 sdd 4.23 25.74 28.02 4.85 3588.55 224.71 116.02 0.17 5.09 1.11 3.63 sdd1 0.00 0.00 0.01 0.00 0.73 0.00 125.99 0.00 12.05 2.12 0.00 sdd2 0.32 3.70 2.33 0.30 331.70 32.04 138.52 0.02 5.80 1.16 0.30 sdd3 0.01 0.00 0.11 0.00 15.10 0.01 134.65 0.00 5.32 0.52 0.01 sdd4 0.00 0.00 0.00 0.00 0.00 0.00 2.00 0.00 0.00 0.00 0.00 sdd5 3.90 22.04 25.58 4.55 3241.03 192.66 113.98 0.15 5.02 1.13 3.39 md1 0.00 0.00 1.39 8.19 142.05 65.54 21.66 0.00 0.00 0.00 0.00 md3 0.00 0.00 22.00 52.52 175.39 380.08 7.45 0.00 0.00 0.00 0.00 md2 0.00 0.00 0.00 0.00 0.03 0.01 8.00 0.00 0.00 0.00 0.00 md0 0.00 0.00 0.00 0.00 0.01 0.00 3.99 0.00 0.00 0.00 0.00 dm-0 0.00 0.00 3.40 3.30 27.18 26.44 8.00 0.07 10.70 0.56 0.37 dm-2 0.00 0.00 3.56 6.07 28.46 48.57 8.00 0.08 8.59 0.42 0.41 dm-4 0.00 0.00 0.99 8.14 7.91 65.15 8.00 0.08 8.32 0.45 0.41 dm-6 0.00 0.00 1.97 3.80 15.77 30.39 8.00 0.08 13.65 0.63 0.36 dm-8 0.00 0.00 0.38 7.76 2.45 21.99 3.00 0.40 48.81 0.59 0.48 dm-10 0.00 0.00 1.00 2.35 8.01 18.78 8.00 0.07 20.18 0.60 0.20 dm-12 0.00 0.00 2.07 3.69 16.59 29.54 8.00 0.07 12.77 0.46 0.27 dm-14 0.00 0.00 1.55 2.77 12.40 22.14 8.00 0.07 16.55 0.48 0.21 dm-16 0.00 0.00 1.65 4.71 13.18 37.67 8.00 0.07 11.64 0.84 0.54 dm-18 0.00 0.00 0.46 3.00 3.65 24.03 8.00 0.12 34.63 0.18 0.06 dm-20 0.00 0.00 0.13 1.50 1.02 11.98 8.00 0.06 37.64 0.15 0.02 dm-22 0.00 0.00 2.40 3.04 19.21 24.29 8.00 0.36 65.49 0.04 0.02 dm-23 0.00 0.00 2.40 2.39 19.19 19.10 8.00 0.04 7.51 0.07 0.03 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util sda 273.60 2391.80 2143.00 38.40 19332.80 19441.60 17.78 0.70 0.32 0.19 41.68 sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.16 sda3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sda4 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sda5 273.60 2391.80 2143.00 38.40 19332.80 19441.60 17.78 0.70 0.32 0.19 41.44 sdb 2084.00 2384.60 306.60 45.60 19124.80 19441.60 109.50 0.25 0.71 0.52 18.32 sdb1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdb2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.16 sdb3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdb4 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdb5 2084.00 2384.60 306.60 45.60 19124.80 19441.60 109.50 0.25 0.71 0.52 18.16 sdc 290.00 2390.80 2316.40 26.00 20851.20 19334.40 17.16 0.65 0.28 0.17 38.96 sdc1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdc2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.16 sdc3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdc4 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdc5 290.00 2390.80 2316.40 26.00 20851.20 19334.40 17.16 0.65 0.28 0.17 38.96 sdd 2065.00 2384.00 120.00 32.80 17480.00 19334.40 240.93 0.26 1.67 0.97 14.80 sdd1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdd2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.16 sdd3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdd4 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdd5 2065.00 2384.00 120.00 32.80 17480.00 19334.40 240.93 0.26 1.67 0.96 14.64 md1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 md3 0.00 0.00 9598.60 4844.60 76788.80 38756.80 8.00 0.00 0.00 0.00 0.00 md2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 md0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-2 0.00 0.00 0.20 0.20 1.60 1.60 8.00 0.01 14.00 14.00 0.56 dm-4 0.00 0.00 2.40 66.60 19.20 532.80 8.00 0.30 4.34 1.59 10.96 dm-6 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-8 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-10 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-12 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-14 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-16 0.00 0.00 0.20 11.60 1.60 92.80 8.00 0.03 2.37 0.88 1.04 dm-18 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-20 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-22 0.00 0.00 4817.40 0.60 38539.20 4.80 8.00 14.58 3.03 0.02 11.68 dm-23 0.00 0.00 4778.40 4765.60 38227.20 38124.80 8.00 77.06 8.07 0.07 63.52 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util sda 634.80 2161.00 1801.60 55.00 19491.20 17728.00 20.05 0.85 0.46 0.26 47.92 sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sda2 0.00 0.00 0.00 2.20 0.00 17.60 8.00 0.04 18.55 13.45 2.96 sda3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sda4 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sda5 634.80 2161.00 1801.60 52.80 19491.20 17710.40 20.06 0.81 0.44 0.25 47.28 sdb 1438.20 2156.80 378.20 59.20 14531.20 17728.00 73.75 0.30 0.69 0.49 21.52 sdb1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdb2 0.00 0.00 0.00 2.20 0.00 17.60 8.00 0.02 8.73 8.00 1.76 sdb3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdb4 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdb5 1438.20 2156.80 378.20 57.00 14531.20 17710.40 74.08 0.28 0.65 0.47 20.64 sdc 540.00 2156.00 1949.20 44.80 19913.60 17606.40 18.82 0.70 0.35 0.22 44.08 sdc1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdc2 0.00 1.40 0.00 1.20 0.00 20.80 17.33 0.01 11.33 10.00 1.20 sdc3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdc4 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdc5 540.00 2154.60 1949.20 43.60 19913.60 17585.60 18.82 0.69 0.35 0.22 43.36 sdd 1529.00 2153.20 246.80 47.60 14206.40 17606.40 108.06 0.34 1.17 0.70 20.56 sdd1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdd2 0.00 1.40 0.00 1.20 0.00 20.80 17.33 0.01 6.67 5.33 0.64 sdd3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdd4 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdd5 1529.00 2151.80 246.80 46.40 14206.40 17585.60 108.43 0.34 1.14 0.68 19.92 md1 0.00 0.00 0.00 3.20 0.00 25.60 8.00 0.00 0.00 0.00 0.00 md3 0.00 0.00 8518.00 4410.40 68144.00 35283.20 8.00 0.00 0.00 0.00 0.00 md2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 md0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-4 0.00 0.00 7.40 246.40 59.20 1971.20 8.00 1.45 5.70 1.34 33.92 dm-6 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-8 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-10 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-12 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-14 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-16 0.00 0.00 0.40 22.20 3.20 177.60 8.00 0.08 3.50 1.06 2.40 dm-18 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-20 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-22 0.00 0.00 4253.80 0.60 34030.40 4.80 8.00 16.39 3.85 0.03 13.20 dm-23 0.00 0.00 4256.80 4141.20 34054.40 33129.60 8.00 69.49 8.28 0.08 65.84 |
Decription the output above:
- rrqm/s : The number of read requests merged per second that were queued to the hard disk
- wrqm/s : The number of write requests merged per second that were queued to the hard disk
- r/s : The number of read requests per second
- w/s : The number of write requests per second
- rsec/s : The number of sectors read from the hard disk per second
- wsec/s : The number of sectors written to the hard disk per second
- avgrq-sz : The average size (in sectors) of the requests that were issued to the device.
- avgqu-sz : The average queue length of the requests that were issued to the device
- await : The average time (in milliseconds) for I/O requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.
- svctm : The average service time (in milliseconds) for I/O requests that were issued to the device
- %util : Percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100%.
How do I interpret the output result for optimization?
First you need to note down following values from the iostat output:
- The average service time (svctm)
- Percentage of CPU time during which I/O requests were issued (%util)
- See if a hard disk reports consistently high reads/writes (r/s and w/s)
If any one of these are high, you need to take one of the following action:
- Get high speed disk and controller for file system (for example move from SATA I to SAS 15k disk)
- Tune software or application or kernel or file system for better disk utilization
- Use RAID array to spread the file system
source: http://www.cyberciti.biz/tips/how-do-i-find-out-linux-cpu-utilization.html