CSCI 2150 -- Laboratory Experiment
Harddrive Measurements


hdparm

First, let's examine the performance of your hard drive. There is a utility that exists on most Linux installations, and it should be on yours if you installed the system tools. This utility, hdparm, allows you to measure the performance of your IDE drive and modify its settings in order to improve it.

Begin by booting your system into Linux. From X-Windows, get to a terminal. The easiest way to do this is to press Ctrl-Alt-F2. Once you get into the terminal, execute the command:

hdparm -I /dev/hda

This command will give you all of the information available for your drive including the organization of the data on the disks including bytes per track, bytes per sector, the number of heads, etc. It should also tell you whether your drive has S.M.A.R.T. capabilities. S.M.A.R.T. is a system available in newer hard drives that measures the drive's physical characteristics such as temperature, spin up time, power on time, etc. Through these features, the system can predict hardware failures before they occur giving the user the opportunity to backup data before a fatal crash. Be sure to note if your drive has SMART capabilities. This will be important for later steps in this lab.

Next, enter the command:

hdparm /dev/hda

This command polls the hard drive for its operational settings. You should see an output such as that shown below:

/dev/hda:
 multcount    = 16 (on)
 IO_support   = 0 (default 16-bit)
 unmaskirq    = 0 (off)
 using_dma    = 0 (off)
 keepsettings = 0 (off)
 readonly     = 0 (off)
 readahead    = 8 (on)
 geometry     = 782/128/63, sectors = 6306048, start = 0

Copy the parameters displayed for your hard drive onto the lab sheet provided by the instructor.

Now we are going to measure the performance of your hard drive. There are two performance parameters that are available through hdparm. The first measures the overall performance of the drive's cache system while the second measures the performance of the disk itself eliminating the speed-up realized with the cache. Enter the following command:

hdparm -Tt /dev/hda

The argument "T" instructs hdparm to test the throughput of the cache without accessing the physical disk. The argument "t" instructs hdparm to test the throughput of the drive, specifically, the sequential access of data from the disks without regard to any file system. The output of this command should look similar to that shown below.

/dev/hda:
 Timing buffer-cache reads:   128 MB in 1.33 seconds = 96.24 MB/sec
 Timing buffered disk reads:  64 MB in 20.64 seconds = 3.10 MB/sec

Perform this command three times copying the results to your lab sheet for each result. We do this three times so that we can get a good average reading of the performance of your drive.

Now most modern hard drives will be set up to perform better than the drive I used in this example. (The PC that I did this lab on is an old 500 MHz machine probably about 5 years old.) If, however, your hard drive has multcount, IO_support, unmaskirq, or using_dma turned off, i.e., values of zero, we might be able to squeeze a bit more performance out of it.

First, the multcount setting contains an integer representing a number of sectors. When the hard drive transfers data to the IDE interface, it does this by interrupting the processor then passing a block of data to memory. multcount represents the number of sectors in the block for a single transfer.

Next, IO_support defines how data is passed through the PCI interface. The settings are:

unmaskirq enables or disables the operating system's ability to service other hardware while the hard drive is busy retrieving data from its disks. This doesn't allow the hard drive to perform any better, but it may let the system as a whole perform better since the processor will be able to service other components while the hard drive is busy.

using_dma enables or disables the DMA support for the interface. DMA is a special mode of transferring data from the hardware to memory without involving the processor. When you entered the command "hdparm -I /dev/hda", you should have seen under the heading "Capabilities:" an item labeled DMA. If so, we should be able to enable it for your drive.

Below is the full command to improve the performance of your drive. Note that we will only be modifying it for the current session. Once your machine is powered down, your hard drive will go back to its original settings. Only include the settings you need: -c3 sets IO_support, -m16 sets multcount, -d1 turns on DMA, and -u1 unmasks the interrupts.

hdparm -d1 -u1 -m16 -c3 /dev/hda

After changing the parameters of your drive, be sure to run the performance test on it again, i.e., "hdparm -tT /dev/hda". Copy the new results to your lab sheet.

when I used this command on my 500 MHz machine, I got the following output.

/dev/hda:
 Timing buffer-cache reads:   128 MB in 1.33 seconds = 96.24 MB/sec
 Timing buffered disk reads:  64 MB in 7.18 seconds = 8.91 MB/sec

This tripled the throughput of my hard drive, nice results for typing a single command. There are more settings that hdparm allows you to change, but an in depth study of these is beyond the scope of this lab.

smartmontools

smartmontools is a set of programs used to monitor S.M.A.R.T. disks and other devices. Some of you may have seen a warning from the BIOS upon power up that claimed one of the drives was "operating outside of norms." This warning is not to be ignored. It typically indicates that some physical characteristic of the drive you are using has changed for the worse and that the drive probably will fail soon.

smartmontools allows us to access the data in the Self-Monitoring, Analysis and Reporting Technology System (S.M.A.R.T.) that are built into ATA and SCSI hard drives. We may need to do this if we suspect an error has occurred.

All of the information you will need to install smartmontools can be found at the smartmontools Home Page hosted by SourceForge.net.

The page is rather elaborate covering in detail the installation and use of smartmontools. This set of notes summarizes what we will be doing for our lab.

This lab assumes you have an RPM based installation of Linux. (If you installed Redhat, you will be fine.) For the RPM method, download this package (smartmontools-5.32.i386.rpm). The command to install the package is:

rpm -ivh smartmontools-5.32.i386.rpm

If this doesn't work, use:

rpm -ivh --nodeps --force smartmontools-5.32.i386.rpm

At this point, you should have the software correctly installed on your machine in the directory /usr/sbin. Go to the /usr/sbin directory by typing:

cd /usr/sbin

Now all we need to do is run the application. There are actually two applications in this package: smartctl and smartd. smartctl is the one we will be using. It allows us to access the S.M.A.R.T. information in our drive. smartd is a background process that constantly monitors the hard drive.

Start by typing the command:

./smartctl -i /dev/hda

This command will produce all of the general information on your drive. It is alot like the hdparm -I /dev/hda command we used earlier. It doesn't give us any new information.

The next command gives us a general idea of the status of our drive. Type:

./smartctl -H /dev/hda

This is a passed/failed type of test which simply tells us whether any of the S.M.A.R.T. parameters are outside of their specifications. Enter the results of this test on your lab sheet.

Lastly, we will look at the individual parameters for our drive. By typing the following command, we will get the full list of S.M.A.R.T. measurements along with an indicator telling us if any of them are predicting a failure. (Note that the "|more" is being used so that the text does not scroll past the top of the screen. Press the space bar to advance the results.)

./smartctl -A /dev/hda |more

The table that smartctl displays should have headings indicating the name of the attribute, measured values and thresholds for these values, the type of error, when it gets updated, and the time it failed if it failed. For my hard drive, the following measurements were displayed:

Make a list on your lab sheet of the attributes measured by your drive along with any errors that might have been recorded. (It is unlikely that your drive will have errors if you haven't received a warning on booting up the machine.)