How do I find out Linux Disk utilization?

Posted on in Categories CentOS, Debian Linux, File system, Hardware, Howto, Linux, Monitoring, RedHat/Fedora Linux, Storage, Tips, Troubleshooting, Tuning last updated December 17, 2007

I’ve already written about finding out Linux / UNIX cpu utilization using various tools. You can use same iostat command to find out disk utilization and for monitoring system input/output device loading by observing the time the physical disks are active in relation to their average transfer rates.

iostat syntax for disk utilization report

iostat -d -x interval count

  • -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

Display 3 reports of extended statistics at 5 second intervals for disk

Type the following command:
$ iostat -d -x 5 3
Output:

Linux 2.6.18-53.1.4.el5 (moon.nixcraft.in)   12/17/2007

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sda               1.10    39.82  3.41 13.59   309.50   427.48    43.36     0.17   10.03   1.03   1.75
sdb               0.20    18.32  1.15  6.08   117.36   195.25    43.22     0.51   71.14   1.26   0.91

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.00   108.40  1.40 64.40    49.60  1382.40    21.76     0.04    0.67   0.44   2.92
sdb               0.00    37.80  0.00 245.20     0.00  2254.40     9.19    28.91  108.49   1.08  26.36

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.00    97.01  1.00 57.29    39.92  1234.33    21.86     0.03    0.58   0.50   2.89
sdb               0.00    38.32  0.00 288.42     0.00  2623.55     9.10    32.97  122.30   1.15  33.27

Where,

  • 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:

  1. The average service time (svctm)
  2. Percentage of CPU time during which I/O requests were issued (%util)
  3. 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

For example, from about iostat report it appears that /dev/sdb under load. Hope this information will help you diagnose and optimize disk related issues.

Related: How to find out Linux CPU utilization using vmstat, iostat, mpstat and sar commands.

Please note that command and information discussed here almost applies to any other UNIX like variant.

Ubuntu / Debian Linux: Services Configuration Tool to Start / Stop System Services

Posted on in Categories Debian Linux, Linux, Linux distribution, Monitoring, Networking, RedHat/Fedora Linux, Security, Sys admin, Tips, Ubuntu Linux last updated December 12, 2007

Your Debian / Ubuntu Linux box security depends upon access to system services (one of many aspects). For example, you may need to provide a web server (Apache service) to serve web pages. However, if you do not need use a service, you should always turn off all unused services to avoid exploits.

Traditionally, Debian provided various tools to manage services. There are various methods for managing access to system services:
a) /etc/init.d/service
b) rcconf
c) update-rc.d etc

Under Red hat and Centos Linux you can use chkconfig command (ntsysv command) to configure Sys V style init script links. There is also service command to stop / start / restart services.

So if you are addicted to the service command under RHEL / CentOS / Mandriva Linux and have wondered what to do in Debian / Ubuntu, Linux try sysvconfig package.
Continue reading “Ubuntu / Debian Linux: Services Configuration Tool to Start / Stop System Services”

Personal alarm message, command and email scheduler for Linux Desktop

Posted on in Categories Linux, Linux desktop, Monitoring, Ubuntu Linux last updated November 23, 2007

I was looking for a alarm GUI software and ended up my search with KAlarm. It allows me to schedule the display of personal alarm messages, the playing of sound files, the execution of commands and the sending of emails and so on without using ‘at command‘ and shell scripting hacks.

From the project home page:

KAlarm is a personal alarm message, command and email scheduler. It provides a graphical interface to set up personal alarm messages which pop up on the screen at the chosen time, or you can schedule commands to be executed or emails to be sent.
When creating or modifying an alarm, you can:
* choose whether the alarm should display a text message, display a text or image file, execute a command, or send an email.
* configure the alarm to recur on an hours/minutes, daily, weekly, monthly or annual basis, or set it to trigger every time you log in. You can also specify a repetition within a repetition.
* specify that a reminder should be displayed in advance of the main alarm time(s).
* choose a colour and font for displaying the alarm message.
* specify an audible beep or a sound file to play when the message is displayed, or specify that the message is to be spoken.
* choose whether or not the alarm should be cancelled if it can’t be triggered at its scheduled time. An alarm can only be triggered while you are logged in and running a graphical environment. If you choose not to cancel the alarm if it can’t be triggered at the correct time, it will be triggered when you eventually log in.

Install kalarm

Use apt-get command:
$ apt-get install kalarm

Start Kalarm > To create a new alarm > Select actions > New
Kalarm configuration:
Personal alarm message, command and email scheduler for Linux Desktop

Save the changes. KAlarm will run in a number of languages including Hindi and others. Overall I’m quite happy with this software and I highly recommend kalarm as personal alarm software.

Further readings:

=> kalarm project home page

Linux find the memory used by a program / process using pmap command

Posted on in Categories CentOS, Debian Linux, FreeBSD, Gentoo Linux, Hardware, Howto, Linux, Monitoring, RedHat/Fedora Linux, Tips last updated November 20, 2007

You can find the memory used by a program (process) by looking into /proc directory or using standard command such as ps or top. However, you must calculate all memory usage by hand i.e. add Shared Memory + mapped file + total virtual memory size of the process + Resident Set Size + non-swapped physical memory used by process.

So how do you find the memory used by a process or program under Linux? Continue reading “Linux find the memory used by a program / process using pmap command”

XEN Server Status Monitoring Command Cheat Sheet

Posted on in Categories CentOS, Debian Linux, Howto, Linux, Linux Virtualization, Monitoring, RedHat/Fedora Linux, xen last updated November 15, 2007

The xm command is the main command line interface for managing Xen guest domains. The program can be used to create, pause, and shutdown domains. It can also be used to list current domains, enable or pin VCPUs, and attach or detach virtual block devices.

Please note that before running any one of the following command you must run xend ( Xen control daemon aka service) and must be run as privileged user. Running xm command as non root will return an error.

I hope following XEN status monitoring cheat sheet will save your time.
Continue reading “XEN Server Status Monitoring Command Cheat Sheet”

Security Tip: Find Out Current Working Directory Of A Process Running on Linux/Unix

Posted on in Categories CentOS, Howto, Linux, Monitoring, RedHat/Fedora Linux, Security, Suse Linux, Sys admin, Tips, Ubuntu Linux last updated November 14, 2007

For security reason you may need to find out current working directory of a process. You can obtained this information by visiting /proc/pid/cwd directory or using the pwdx command. The pwdx command reports the current working directory of a process or processes.

Suse Linux: Nagios Basic Installation and Configuration

Posted on in Categories Hardware, Linux, Linux distribution, Monitoring, Networking, Suse Linux, Sys admin last updated October 24, 2007

Nagios is my favorite open source server and network monitoring application software. It watches hosts and services that you specify, alerting you when things go bad and again when they get better.

If you’re planning on installing Nagios, check out this installation guide from Rainer Brunold that gives you step-by-step instructions on how to set it up:

Nagios is a popular host and service monitoring tool used by many administrators to keep an eye on their systems.

Since I wrote a basic installation guide in Jan 2006 on Cool Solutions many new versions were published and many Nagios plugins are now available. Because of that I think it’s time to write a series of articles here that show you some very interesting solutions. I hope that you find them helpful and that you can use them in your environment. If you are not yet and nagios user I hope that I can inspire you and you give it a try.

I don’t want to write here a full documentation about Nagios, I prefer to give you a basic installation guide so you can set it up very easy and play with it yourself. The installation guide will show you how to install Nagios as well as some interesting extensions and how they integrate into each other. During this installation you will make many modifications to the installation that will help to understand how it works, how you can integrate systems and different services. I will also provide some articles about monitoring special services where I describe what they do and what configuration changes are needed. All together should give you a very good overview and documentation on how you can enhance the Nagios installation yourself.

=> Nagios 3.0 – A Extensible Host and Service Monitoring

Linux: Monitor Hard Disks Temperature With hddtemp

Posted on in Categories CentOS, Debian Linux, Hardware, Howto, Linux, Monitoring, RedHat/Fedora Linux, Suse Linux, Tips, Troubleshooting, Tuning, Ubuntu Linux last updated June 25, 2017

There is a nice utility to monitor hard drive temperature. Most modern x86 computer hard disk comes with S.M.A.R.T (Self-Monitoring, Analysis, and Reporting Technology). It is a monitoring system for computer hard disks to detect and report on various indicators of reliability, in the hope of anticipating failures.