Classic Computer Magazine Archive COMPUTE! ISSUE 158 / NOVEMBER 1993 / PAGE 64

CMOS failure. (losing the setup information) (Column)
by Mark Minasi

How can you find out your hard drive type when you lose your setup? Use Norton's Diskedit to find that hard-to-trace information.

I got a letter from a reader in Sioux City, a fellow named Chuck Rearden. Chuck had a common problem: Something had blown away his system's setup information, and he didn't know where to get the information to restore it.

The best solution to this sort of problem, as it turns out, is fairly simple (but not obvious), so I though I'd share it with you.

"I did something dumb, and now I'm paying for it," Chuck told me in his letter. "In the cold of our dry South Dakota winter, I walked into my office and touched the case of my PC. I felt the shock of a static zap jump from my finger to the PC's case, and when I turned my PC on, my worst fears were confirmed.

"I got a message saying CMOS memory checksum failure, press F1 to continue. I didn't know what that meant, but it didn't look good. So I pressed F1, but then all I got was a message saying disk boot failure."

By the time I got Chuck on the phone, it was three weeks after the date of his letter. He'd progressed a bit. In three weeks, Chuck had learned what a CMOS memory checksum failure is.

"I've found out that I've got to fix the CMOS information with a program called Setup, which is built into my computer," he explained. "I can only get into it when booting the system; if I press the Delete key, the Setup program appears.

"It needs to know a bunch of information about the computer, but most of it's pretty simple. It wants to know the date and time, and that I can handle, and even filling in the type of floppy drives isn't too hard--the dealer helped me out with that. I didn't touch the display type, as it said VGA/PGA/EGA. I left it untouched, even though I've got Super VGA, because there wasn't an option for Super VGA, and the dealer told me to leave it as is.

"What stumps me, and the dealer too, is the drive type. Setup needs to know the number of cylinders, sectors, and heads, and the write precompensation--whatever that is--for the hard drive. I don't know the information, and the dealer. . .doesn't, either. So we're stuck until I can find out how the drive's laid out."

One of the more annoying events in any PC support person's life (or any PC owner's life) is dealing with a four- or five-year-old computer that's lost its setup information (also known as its CMOS data). The CMOS includes data that is, in general, easy to retrieve--what kinds of floppy drives you've got and how much memory is in the system.

But losing the CMOS does cause one major problem: You lose the drive type information. Setting up the CMOS again for a hard drive requires that you know four things about a drive: how many read/write heads in the drive, how many cylinders on the drive, how many sectors on each hard disk track, and which cylinder to start doing write precompensation on (don't worry about write precomp).

Sometimes you'll lose your setup information by overwriting it or by some electrical or mechanical mishap, but most commonly the CMOS is lost because the battery that maintains the CMOS information runs out of power--usually about three to five years after you've purchased the computer. If the CMOS's battery loses power, then the CMOS forgets what it knows about your system. When you power it up, the computer detects that the CMOS's battery is dead and says, in effect, "I have no idea what kind of equipment is in me--what kind of floppies, display, hard drive, or even the date or time. If you press F1, then I'll take the best guess that I can." Unfortunately, its best guess about hard drive type is that there's no hard drive at all. Since the system thinks that there's no hard drive present, it only tries to boot from the floppy. The floppy drive, however, probably doesn't contain a bootable floppy, so the boot-failure message appears.

Many people find that when the battery gets low, the date and time are fine, but the other CMOS information is gone. That's fairly common. The clock is maintained by a simple clock circuit, but the other information is maintained by a memory circuit. Memory circuits draw more power than clock circuits, so it's quite reasonable for the clock to continue to keep fairly accurate time despite the loss of the CMOS memory.

Anyway, back to solving the problem. As the computer is about four or five years old (which is, again, the life expectancy of the average CMOS battery), you've probably mislaid the documentation (if you ever got it in the first place) about the hard disk. How are you to find out the disk's geometry? (For geometry, read the number of heads, cylinders, and sectors.)

One surefire approach is to take the cover off the computer, remove the hard disk, and look for a model and serial number, like XTOR-TECH model E425523-SW. You'd then find the number for the hard disk maker, call, and ask what the geometry of the hard disk is. There are, however, two problems with this method. The first problem is that it's a pain in the neck to have to remove the drive, find a phone number for the vendor, and try to get through to the tech support department. The second problem is that many manufacturers have gone out of business in the past five years, so you may not find anyone to talk to anyway.

Fortunately, there is a better way. The vital statistics for most disks are sitting right on the disks themselves.

Every hard disk that's ever been used in a PC has been partitioned, a process usually performed by the Fdisk program. Partitioning was originally created to allow multiple operating systems to coexist on a single hard disk, but you (or the person who sets up your computer) must partition the disk even if that means allocating the whole disk to just one partition. The information that describes how a disk is partitioned is stored in an area called the partition table, which is part of the master boot record, or MBR, which is on every PC disk.

Partition information describes each partition by including both its starting address--which cylinder, head, and sector it starts on--and also its ending address--which cylinder, head, and sector it ends on. Assuming that whoever set up the disk used all of it, the coordinates of the last cylinder, head, and sector on the partition should also be the coordinates of the last cylinder, head, and sector on the disk.

The MBR is always located at cylinder 0, head 0, sector 1. Cylinder 0/0/1 is readable from drive type 1 (a 10MB drive description), and drive type 1 will make any hard disk's MBR readable. It won't make it bootable, but it'll make it readable. So you can boot from a floppy and use a disk utility to read 0/0/1.

Putting this all together, you can find out the vital statistics on any mystery disk by following these steps.

Step 1: Create a bootable floppy disk, and put the Norton program DISKEDIT.EXE on it. It's part of the Norton Utilities (and has been since version 2.0). My explicit instructions will be for version 7.0.

Step 2: Boot from the floppy containing Diskedit.

Step 3: Run your PC's Setup program. Under hard disk drive type number, you'll see that it probably says drive type 0 or no hard disk. Change it to drive type number 1.

Step 4: Run Diskedit by typing diskedit c: at the command line. If you see a message box warning you that Diskedit is in read-only mode and that no changes that you make to the disk with Diskedit will be actually written, that's fine because you don't want to accidentally make things worse by overwriting information on your hard disk. Just press Enter to clear the message box.

Step 5: Diskedit may complain about your hard disk not making sense; that's to be expected, so just tell Diskedit to ignore any problems. Don't let Diskedit make any changes to your system.

Step 6: You'll see a menu across the top of the screen with these options: Object, Edit, Link, View, Info, Tools, and Help. You pull down a menu by pressing the Alt key and the first letter of the menu option, so press Alt-O to pull down the Object menu. The Object menu starts off with the options Drive and Directory. Look for an option that says Partition Table Alt+A. If this option is grayed out, you'll have to choose the Drive menu selection. (If Partition Table Alt+A isn't grayed out, just skip to the next step.)

You'll see a dialog box asking which drive to edit and whether the drive is a logical or physical disk. Select the radio button for Physical disks, and select Hard Disk 1.

Step 7: Now tell Diskedit to get the MBR and show you the partition table inside it. Just press Alt-A to tell Diskedit to load the MBR into memory, and then press F6 to tell Diskedit to show you the partition table within the MBR. You'll probably see one or two partitions; look at the partition whose ending location contains the larger numbers. For example, the disk that I'm looking at reports an ending location of side 15, cylinder 993, sector 63 (what Setup calls heads, Diskedit calls sides). Write down the side, cylinder, and sector numbers.

Step 8: Exit Diskedit (press Esc and then confirm that you want to exit the program).

Step 9: Assuming that whoever originally partitioned this disk used up all the cylinders, that would mean that the last sector on my particular disk was the sector at cylinder 993, head 15, sector 63. That implies that there were 994 cylinders on this disk, because the first cylinder's number is 0, not 1. It also implies that the number of heads is 16, because the first head's number is also 0. For some reason, sectors are numbered starting with 1, not 0 (don't ask me why; I have no idea), so if the last sector is 63, the number of sectors is also 63. So add 1 to the cylinders and sides to get total numbers of cylinders and heads, and don't do anything to the sectors to get total numbers of sectors.

Armed with this knowledge, you can then match these values to your system's drive table to find out which drive type the disk is. On more modern systems, you wouldn't find a drive type; instead, you'd pick drive type 47, the user-definable type, and directly punch in 994 for the cylinders, 16 for the heads, and 63 for the sectors.