Users coming to these forums frequently are having problems that could indicate a failing hard drive. Hard drives are mechanical parts of your computer, and are among the most frequent problems a computer can have. You were probably directed to look at this Hint if you described problems such as your computer becoming unresponsive (mouse moves but clicking doesn't do anything), are seeing the "colored spinning ball", or getting error messages that may indicate a hard drive problem.

This hint shows you how to run a very basic "surface scan" or "read scan" of your hard drive. It will attempt to read every block on your hard drive, to make sure they are all working. There are other pieces of software (such as TechTool) that can do a surface scan for you and are more user-friendly, but this is something you can do for free that may be enough to identify your problem.

You will need to be logged in as an admin on your computer. If you're the only user of the computer this shouldn't be a problem. If you're using your parents' or work computer and have only a standard (limited) account. you may need to have the owner log the computer in using an admin's account before using this Hint.

This hint will NOT work for you if you are using Leopard (10.5) and your password is blank. If you are running 10.5 and your password is blank, you will need to change your password to something before you can use this hint.

To get started, open the hard drive on the desktop. Open the folder Applications inside that, and then open the folder Utilities inside that. Double click on "Terminal". A new window will open up that looks a bit like a word processor, with text and you can type in it. You don't need to type anything, just get the window open. It will show something similar to this:

Last login: Sat Jun 21 08:55:49 on ttyp1
Welcome to Darwin!
jasons-macintosh:~ jason$ 

This next block of text you will need to highlight here, and select "Edit" and then "Copy" from the menubar above, to copy the text. It won't tell you it's done anything, so just select this entire block of purple text and then do Edit and then Copy.

clear;echo;echo "Enter your admin password to allow direct access to your hard drive.";echo;echo "(your password will not be shown as you type)";echo;sudo -k;r=1;while [ $r != 0 ];do sudo -v;r=$?;done;clear;echo "Password accepted.";echo;if [ "$(echo "$(diskutil list | grep "/dev/disk")" | wc -l | tr -d ' ')" == 1 ];then d="/dev/disk0";echo "(automatically selecting only attached hard drive)";else echo "Select number of device to scan:";select d in $(diskutil list | grep "/dev/disk" | cut -d '/' -f 3);do if ! [ -z "$d" ] ; then d="/dev/$d";break;fi;done;fi;passmb=10;passb=$((1024*1024*passmb));testmb=$((testmb));clear;echo;echo "Quick read-scanning $d:";echo;echo "(if the progress indicator stops responding, the drive is bad)";echo;while true;do echo -n "Test at ${testmb}MB ... ";start=$SECONDS;r=$(sudo dd if=$d of=/dev/null bs=1048576 count=$passmb iseek=$testmb 2>&1 | grep "bytes");time=$((SECONDS-start));if [ -z "$(echo "$r" | grep "$passb")" ];then echo "END OF DEVICE";echo;echo "If your hard drive capacity is rated $((testmb/953))GB, then it looks ok.";exit;elif [ $time -gt 10 ];then echo "SLOW READ";exit;else echo -n $'\r';fi;testmb=$((testmb+passmb));done

After you've done that, click once in the window that Terminal opened up, and then up top select "Edit" and then "Paste". The text should appear in the window. (but it will be black, not purple) It should show the blue message below now. If it still just shows the text you pasted, press Return to start it:

Enter your admin password to allow direct access to your hard drive.

(your password will not be shown as you type)

Password:

Type your password and press Return. (it won't show the password as you type it, just type it and press Return) If you entered the correct password, it will begin. If you only have one hard drive and do not have any attached firewire hard drives, time capsules, or flash drives, it will immediately begin scanning your hard drive. Otherwise it will ask you which drive to scan. This will look something like this:

Password accepted.

Select number of device to scan:
1) disk0
2) disk1
#? 

It can't tell what disk is what so you will need to select which one to scan. Enter the number of the disk (1 or 2 etc) and press return. The first one ("disk0") is usually your startup drive. If you are having problems with an external hard drive instead of your boot drive, you will want to select one of the other devices in the list besides the first one. Once selected, the scan will start.

Once started, it will display something like this:

Quick read-scanning /dev/disk1:

(if the progress indicator stops responding, the drive is bad)

Test at 30MB ... 

The test number will start at 0 and work its way up, until it reaches the end of the hard drive. This can be a VERY long process for large hard drives. (many hours) There are 1,000 MB in each GB, so if you have an 80 gigabyte ("80GB") hard drive, it will have to test 80,000 MB.

You won't need to watch it while it runs, but you should check on it from time to time to make sure it's still going. The test should continue at a steady pace. If the numbers stop changing, it has found a problem with your hard drive.

When it reaches the end of your hard drive, or if the test finds a bad block, the scan will stop, and this will be displayed:

Quick read-scanning /dev/disk0:

(if the progress indicator stops responding, the drive is bad)

Test at 190780MB ... END OF DEVICE

If your hard drive capacity is rated 200GB, then it looks ok.
logout

[Process completed]

The test number will be different for you, but the GB number is what's important to look at. If your hard drive size is not what it says, then it found a problem at that point on your hard drive. So in the above scan, I have a 200GB hard drive so my hard drive has passed the test.

Or you might see this when you come back to the computer:

Quick read-scanning /dev/disk1:

(if the progress indicator stops responding, the drive is bad)

Test at 7660MB ... SLOW READ
logout

[Process completed]

Again the test number will be different for you. But what this means is it was able to read that part of your hard drive, but it took a very long time, and something is wrong with it. This may be what you get if your computer has had problems showing the spinning wheel but if you leave it alone for awhile the ball goes away and you can get back to work.

Please don't post replies or questions to this hint here. Post replies and questions in the original thread that directed you to this hint.

if this scan indicates a problem you should start a thread in one of the forums here or follow up on the one that directed you here, to discuss your options for repair. When the scan is done you can just close the Terminal window and quit terminal.