CSCI 2150 -- Laboratory Experiment
Hard Drive Measurements


Objectives

The purpose of this lab is to give you some experience with accessing the parameters of a physical hard drive for the purpose of assessing the drive's health or diagnosing problems. Remember to use a real installation of Windows XP, not your virtual installation.

What you will turn in

You will use the applications discussed in this lab to pull information from your hard drive regarding its performance and health. You will submit the results of your lab work using the Hard Drive Performance Lab Worksheet I have provided. Half of the points for this lab will come from this worksheet.

To receive credit for the lab, you must fill out and submit the lab worksheet.
This lab is to be performed on an individual basis. Do not share computers or data on the worksheets.

What you will need

To perform this experiment, you will need two software packages. Both of these packages are available in Linux and Windows versions. For the purpose of simplification and ubiquity, the Windows XP versions will be discussed here.

The first application is hdparm. The purpose of hdparm is to view or modify the parameters of PATA and SATA drives. hdparm was originally developed for Linux, the latest version of which can be downloaded from the hdparm project page at Sourceforge. There is, however, a Windows version of hdparm available from DynDNS. Both of these are command line applications.

Perform the following steps to install hdparm on your system.

  1. Log in as an administrator on your Windows XP system.
  2. Download the Windows version of hdparm from http://hdparm-win32.dyndns.org/hdparm/.
  3. Locate the downloaded software on your machine and run it.
  4. After reading and accepting the licensing agreement, you should come to an install options window. Select "Full."
  5. Select a destination folder (the default should be C:\Program Files\hdparm), and then install the software.

The second application you will be using is a program used to access the S.M.A.R.T. data from your hard drive. This application is called smartmontools. smartmontools is available from the smartmontools page at Sourceforge.

Perform the following steps to install smartmontools on your system.

  1. Log in as an administrator on your Windows XP system.
  2. Download the Windows version of smartmontools by performing the following steps.
    1. From the smartmontools page, select the link, "How to download and install smartmontools."
    2. Scroll down to the section titled, "Sixth Method (Windows) - Install the Windows package."
    3. Download the latest smartmontools NSIS-installer (*.win32-setup.exe) by clicking on the given link. (When this lab was written, the link took you to the URL: http://sourceforge.net/project/showfiles.php?group_id=64297.)
    4. From the list of available versions of smartmontools given, be sure to download the win32 version. It should have "win32-setup" somewhere in the title.
  3. Locate the downloaded software on your machine and run it.
  4. After reading and accepting the licensing agreement, you should come to an install options window. Select "Full."
  5. Select a destination folder (the default should be C:\Program Files\smartmontools), and then install the software.

hdparm

To run hdparm, you will need to be in a command window with the current folder set to the folder where you installed hdparm. Perform the following steps to enter the 32-bit command window and change to the hdparm directory.

  1. From the "Start" menu, click "Run."
  2. In the text field of the "Run" window, type "cmd" and click "OK."
  3. If the drive displayed at the cursor is not the drive where you installed hdparm, type "C:" to change to the correct drive. (This assumes you installed the software on the C-drive.)
  4. To change to the proper folder, type

    cd "\Program Files\hdparm\bin"

    where "\Program File\hdparm" is the folder where you installed the software. (Be sure to include the quotation marks in your command.) The folder "bin" was created below the installation folder and is where the executable is located.
  5. Typing "hdparm-run.bat" should give you the command line syntax which may be similar to that shown below:
Examples (for first ATA/SATA drive):
hdparm -I hda              Show disk identity, features, and current settings
hdparm -I scd0             Same for first CD-ROM
hdparm -M 128 hda          Set acoustic management to "quiet"
hdparm -M 254 hda          Set acoustic management to "fast"
hdparm -t hda              Perform disk read timings
hdparm -T hda              Perform cached read timings
hdparm -y hda              Set disk to standby mode
hdparm --security-freeze hda    Freeze security settings
Use "hdb", "hdc",... for second, third, ... ATA/SATA drive.
See man page (hdparm.8.*) for further info.

Note that the Windows version of hdparm still uses the Linux method for describing hard drives, and therefore, "c:" is actually represented using the string "hda". Therefore, the examples shown above that use hda in their command line are actually referring to the C-drive. To access the D-drive, you would use "hdb" instead, and so on.

Now that we have access to hdparm, we need to use it to pull some information out of our drive. Enter the following command.

hdparm -I 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.

From the output from the hdparm -I hda command, you should be able to fill out all of the details from the Hard Drive Information section of the worksheet. Note that the command hdparm -I hda outputs a lot of information, so you may have to scroll up to find the details asked for by the worksheet.

Now, let's examine the performance of your hard drive using hdparm. Years ago, hard drives would come from the manufacturer with the performance settings configured for reliability, not performance. hdparm could be used to change the operational settings in order to focus on performance. Hard drives now come from the manufacturer configured for speed, so the feature of hdparm where the user can modify the drive's configuration is not as important. Still, it would be nice to know what you can modify. Enter the following command.

hdparm -h hda

This command displays hdparm's usage information. Use this screen to determine what the hdparm switch -g does. Enter this description on your worksheet.

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 cached reads:   360 MB in  2.00 seconds = 180.00 MB/sec
 Timing buffered disk reads:  182 MB in  3.00 seconds =  60.67 MB/sec

Perform this command three times copying the best performance measurement to your worksheet. We do this three times in case another process is accessing the drive which could have a significant affect on the measurements. This is highly likely due to the multitasking nature of modern operating systems. The best way to do this is to come up in a mode like safe mode at the command line.

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.

To run smartmontools, you will need to be in a command window with the current folder set to the folder where you installed smartmontools. Perform the following steps to enter the 32-bit command window and change to the smartmontools directory. (Note that this is basically the same thing that you did to access the hdparm folder.)

  1. From the "Start" menu, click "Run."
  2. In the text field of the "Run" window, type "cmd" and click "OK."
  3. If the drive displayed at the cursor is not the drive where you installed hdparm, type "C:" to change to the correct drive. (This assumes you installed the software on the C-drive.)
  4. To change to the proper folder, type

    cd "\Program Files\smartmontools\bin"

    where "\Program File\smartmontools" is the folder where you installed the software. (Be sure to include the quotation marks in your command.) The folder "bin" was created below the installation folder and is where the executable is located.

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 hda

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

Note: If the machine you are on does not have SMART support enabled, please use another machine that has a drive with SMART support enabled.

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

smartctl -H 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 worksheet.

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

There is a lot of information on this table including the attribute's name, its value (an integer from 0 to 255), the type of measurement it is, when the failure occurred, and the raw value. For example, one of the values from my hard drive came up as:

ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_
FAILED RAW_VALUE
  3 Spin_Up_Time            0x0003   206   199   021    Pre-fail  Always       -
       2658

The value is an integer from 0 to 255. The closer the value is to 255 on Pre-fail types, the better the drive is performing.

The type is either Pre-fail or Old_age. Pre-fail indicates that the drive is in trouble and should be backed up and replaced. Old_age simply indicates that the drive is getting rather old and you should probably schedule a replacement to be on the safe side.

The value beneath the attribute's name (it's 2658 on my attribute print out shown above) is the raw value. In the case of spin up time, it is typically measured in milliseconds (thousandths of a second.) You might not be able to figure out the measurement units on some attributes while other attributes such as power on hours or temperature Celsius should use an obvious unit of measurement.

On your lab sheet, copy the value, type, and raw value of the following attributes.

It is unlikely that your drive will have errors if you haven't received a warning on booting up the machine.

Remember to submit your recorded data on the Hard Drive Performance Worksheet.