Classic Computer Magazine Archive START VOL. 3 NO. 6 / JANUARY 1989

Small
Tools

Hard Disk Lore and First Aid Part II:
A Peek at Partitions

by David Small

See what your hard drive is made of! File PARTLOOK.ARC on your START disk.

This month we continue the no-holds-barred introduction to the truth behind hard disks. We'll cover partitions and the Desktop icons, and demolish several myths about same.

Partitions
The first rule is that because of a typo in the GEMDOS program, you can't have a hard disk directory structure that's bigger than 16 megabytes. (True! It should be a 32-megabyte limit. Why 32 megabytes? Because that's the limit Microsoft designed into MS-DOS for the IBM PC, and GEMDOS is an IBM look-alike.) ST hard disks are typically 20 megabytes, but they're getting bigger all the time, (See my article Megabytes, Not Megabucks, in the Winter 1987 issue of START for an example of how Atari hard disk owners are doing this.)

To get around this 16-megabyte limit, we have to subdivide or "partition" the hard disk into pieces smaller than 16 megabytes.

First Atari (and then various after-market manufacturers) released a partitioning program, which subdivides the
hard disk into many hard disklets, called "partitions." In a very common example, we take a 20-megabyte hard disk and split it up into four 5-megabyte partitions. Lots of people do this.
 
Enter SCSI device:
Enter SCSI unit:
 
Stats for device 0 unit 0
Partition onfo:
# start size meg type  
1: 1 22148 11 GEM enabled bootable
2: 22149 22128 11 GEM enabled
3: 0 0 0    
4: 0 0 0    
5: 0 0 0    
6: 0 0 0    
7: 0 0 0    
8: 0 0 0    
9: 0 0 0    
10: 0 0 0    
11: 0 0 0    
12: 0 0 0    

Dump another? no
Prartlook gives you the complete breakdown of partitions on your hard drive.
Learn where each partition begins and ends, and its size, type and status.

At this point, GEMDOS is fooled into thinking you've got four separate 5-megabyte hard disk units hooked to your ST. Most hard disks begin as drive C; in our example, the hard disk would be drives C, D, E and F.

Now, how do partitions work? The first sector of the hard disk, sector #0 (programmers often begin counting at 0), contains a "partition table." This tells GEMDOS how the hard disk is subdivided, in our example it looks like this:

(partition sector: sector #0:).
Drive C: Sectors 1 - 10,001 (10,000 sectors long, 5 mb)
Drive D: Sectors 10,002-20,002 (10,000 sectors long, 5 mb)
Drive E: Sectors 20,003-30,003 (10,000 sectors long, 5 mb)
Drive F: Sectors 30,004-40,004 (10,000 sectors long, 5 mb)
Total: 40.000 sectors, or 20 megabytes
Let's say GEMDOS asks for the first sector of drive C from the hard disk unit. Hard disk physical sector number 1 is returned to GEMDOS. So far, no surprises. But if GEMDOS asks for the first sector of drive E, then the hard disk code looks in this partition table, sees that E begins at physical sector 20,003, and actually returns physical sector number 20,003 (the first sector of E).

For example, this is why you can have only one drive "letter" damaged on your hard disk. Let's say sector number 20,003, which I happen to know GEMDOS will need for any access to drive E, is damaged. Then, anything you try to do to drive E will fail. But, drives C. D and F will work just fine, because you're skipping over the damaged region. GEMDOS thinks these are totally separate disk drives; while it thinks the drive you have hooked up as drive E is defective, it also thinks the other drives are fine.

And, of course, if your partition sector gets damaged, you are doomed. There's no access to the hard disk without the tables in this first sector. That's why Dan and I included a special option to "Restore Partition Sector" in Meg-A-Minute, and always backed up the partition sector. It is the one sector on the hard disk that is essential to getting to everything else.

Remember, there is nothing magical about these partitions. There's nothing in hardware that prevents you from overriding them in software. It's all done by this partition table and by the hard disk handler software; all the hardware knows about it is reading or writing sectors.

So, we've seen how we can break up a hard disk into four partitions. Now, that still limits us to 64 megabytes (four 16-megabyte partitions), but aftermarket drive makers like Supra wanted to sell (and people wanted to buy) units much bigger than 64 megabytes. So, Supra came up with the "expanded" partition sector design, which lets you have 12 partitions, not just four. It works just the same way as Atari's scheme shown above. As I understand it, Astra, BMS and ICD agreed to Supra's 12-partition scheme. so now everyone except Atari uses it.

Supra's Utilities
Supra also wrote the Supra utilities to examine your hard disk and fix it if need be. You want a copy of these, regardless of whose brand disk drive you've got. They're the best hard disk tools around. They'll work on any brand hard disk; many are the times they've saved me. They are my first line of defense against hard disk troubles; one of the few disks I keep on my actual desk. As far as I know, there isn't anything like them available from anyone else.


Mac partitions show
up as Ack; we
named them for Bill
the Cat.

Supra's tools let you examine and change any sector on the hard disk, reformat or repartition the hard disk, make the hard disk autoboot (boot without floppy) and even give you source code for the driver if you'd like to access the hard disk directly, bypassing GEMDOS.

Desktop Icon Letters
Now that you understand what partitions are, let's talk about the drive letters you see on your Desktop icons. There is a great deal of confusion on this subject, so let's walk through it.

Doubtlessly you've gone through the Install Disk Drive pull-down menu on the Desktop in order to make a C icon to talk to the hard disk's first partition. Now what does this do? Does it somehow magically activate the hard disk?

Nope. Most people have the wrong image of what the "Desktop" is about.

The Desktop is just a program that happens to be put into the Atari's ROMs. There is nothing special about it. The ST runs it as a program just as it runs Publishing Partner or any other program; it happens to be the program run when the ST finishes its powerup work, and happens to be what is run when other programs finish up. That's all. It is not even needed to run the ST; you can do everything via a "Command Line Interpreter", or CLI, where, for example, you type in commands (DIR C:, etc) instead of double-clicking on drive icons.

The important thing to realize is that the Desktop is just a program for dealing with disks visually. An icon gives you the ability to double-click on it to get a directory, move files to and from it, etc. Whether you have a Desktop icon for the hard disk has nothing to do with whether or not the system can field hard disk requests right then! That was determined at startup time, when the partition sector of the hard disk was read in by the hard disk driver program.

Desktop icons, their names, and their screen positions are stored in a file called DESKTOP.1NF. This file is created or updated anytime you choose Save Desktop under the Options menu. The Desktop reads in that file at startup to determine what icons it plots.

That's where icons come from, not from any such "working hard disk." You can edit or remove those icons with Install Disk Drive, but don't kid yourself; you're not installing or removing anything but an icon.

In summary, the Desktop is just an alternative program for dealing with disks, and it has no idea of whether or not its disk icons even hook to anything.

Poking Around
Since the partition sector is the key to everything we've talked about this month, we're including a program to dump its information out to you so you can look it over.

To run this program, copy PARTLOOK.ARC and ARCX.TTP onto a blank, formatted disk and un-ARC the file, following the Disk Instructions elsewhere in this issue. Double-click on PARTLOOK.TOS.


The Desktop is just a
program for dealing
with disks visually.

When Partlook runs, it will ask you which SCSI device and unit numbers to read; press Return for the defaults of 0. Next. it will read the partition sector off that hard disk drive and output the partition's number, starting sector and length, the partition type (GEMDOS, Macintosh, etc.). This is a three-letter code: GEM is short for GEMDOS, ACK partitions are Macintosh. We named them for Bill the Cat from the Bloom County comic strip, there during the long nights of writing the Magic Sac hard disk support. The listing will also tell whether the partition is enabled and whether it is bootable or not.

To look at another partition, press Return at the 'Dump another?" prompt; otherwise, type "no" and press Return.

lf you want to back up your hard disk's partition sector (if you get nothing else out of this article, do this), use Meg-a-Minute Elite from the November 1988 issue of START and back up any partition: the partition sector will be backed up as well. At restore time. you can pick to restore only the partition sector if you wish.

Coming next month: A discussion of RWABS. the system call that handles disk access.

Dave Small's new company, Gadgets by Small, is currently marketing the Spectre 128 Macintosh emulator.

PRODUCTS MENTIONED

Hard Disk Utilities, $24.95. Supra Corp., 1133 Commercial Way, Albany, OR 97321, (503) 967-9075.