Back to 9/96 Analysis: Dialog Box
Up to Table of Contents
Ahead to 9/96 How To: Optimizing Windows

9/96 How To: Optimizing Windows

The Skinny On the FAT System

By John Woram

BACK IN THE JURASSIC age-that is, about 15 years ago-a 10MB hard drive was about as good as it got. In those days, who could imagine a time when the 1-gigabyte drive would be standard issue, and drives of double or quadruple that size would be readily available? Who even knew what 1GB meant? The giga prefix means 109 bytes-that is, 1,000,000,000 of them. Because the computer world deals in powers of 2, the closest binary value is 230, or 1,073,741,824 bytes. So, a 2GB drive will store 2,147,483,648 (231) bytes. Talk about orders of magnitude!

If you already have one of these gigantosaurus drives, you've probably discovered the drive isn't the only thing that's big. Due to the limitations of the present 16-bit FAT (file allocation table) system, a 1GB or larger hard drive writes all files into allocation units (or clusters) of 32,768 bytes each. That's fine for large files, because the fewer clusters required, the less time the computer spends looking through the FAT for them. But it means a file as small as 1 byte must eat up 32,768 bytes of disk real estate.

To conserve a bit of space, most power users set up at least two partitions. If you divided a 1GB drive into two partitions of 512MB each, the resultant cluster would be half the size-only 16,384 bytes. If you made four equal-sized partitions, you'd reduce the cluster size in half again to a more reasonable 8,192 bytes. So by dividing a large drive into smaller partitions, you can reduce cluster size accordingly.

Cluster size notwithstanding, a two-partition drive is still a good idea. By segregating applications and data files, you can back up important information on drive D: without having to wade through the executable files on drive C:. If you work a lot with really big graphics or other such files, you may even want a third and larger partition. But if you have to cut up a monster drive into still more partitions solely to trim cluster size, it's time to look for a better way. Before I show you the way, here's a rundown of the present state of the FAT art, in which a 1GB or larger drive gets those 32KB clusters, and a 2GB partition is the maximum size permitted.

FAT has its limits

When I told you a 2GB drive will store 2,147,483,648 bytes, I wasn't completely honest. Here's why. The current limit on the number of sectors in a FAT is 256. At 512 bytes per sector, that works out to 131,072 bytes. Each cluster needs a 2-byte pointer, so there's room for 65,536 such pointers in the FAT. Because the maximum cluster size is 32,768 bytes, the 16-bit FAT should be able to handle 2,147,483,648 bytes (65,536 x 32,768). But the FAT itself takes up space on the drive, as does a backup copy. And then there's the MBR (master boot record), and of course we mustn't forget the directory. This means there's room left for only 65,525 clusters, which works out to 2,147,123,200 bytes-not small, but a few bytes short of a full 2GB.

There's still no one ideal way to partition a hard drive, which is probably why most new computers come with the whole works as a single partition on drive C:. And because the current market trend is to pre-load every piece of software that might lure you away from the competition, repartitioning will take a fair amount of work. Repartitioning is even worse if you've already spent a few months putting important information onto the drive.

That old DOS relic known as Fdisk does an efficient repartitioning job, if you don't mind trashing your entire directory structure and then reformatting each newly created partition. If that doesn't sound like a great little project for a rainy day, grab a copy of PartitionMagic from PowerQuest Corp. (800-379-2566, 801-226-8977). It will create one or more new partitions on a hard drive without harming its present contents. It's probably best not to ask how it's done (or at least, don't ask me), but on the outside looking in, it's a simple two-step procedure. First, trim the size of your present drive C:, creating a certain amount of free space on the hard disk. Then create one or more new partitions in the free space. After that, you'll have the time-consuming chore of moving your data files from drive C: to the new drive D: (or whichever drive you've selected).

Strictly on the up and up

With a few exceptions, PartitionMagic doesn't do anything illegal. However, if you create a new partition, it might not create the FAT structure you'd expect-at least not at first. For instance, I used it to trim 5MB from an existing 100MB single-partition drive on a 386 system that's beginning to feel its age. Despite the diminutive size of this new partition, PM gave it a 16-bit FAT, instead of the 12-bit FAT customarily found on diskettes and hard drives of less than 16MB. This would be a nonissue, but PM also increased the size of the new partition's root directory block, making room for 544 32-byte entries instead of the default 512. The Root Resize option on the Advance menu was disabled, so I thought I was stuck with those extra directory entries. Then I noticed my original drive D: was also set for 544 directory entries, and although its Root Resize option was enabled, it wouldn't let me reset it to the 512 default.

In noodling around (a technical term), I discovered I could specify a 512-entry root directory as part of the partition reformatting procedure. Once I did that, the reformatted partition was set for a 12-bit FAT. This doesn't seem to be a user-selectable option, though; it just happened as part of the format.

Pump up that old 386

Click Here to see a 34.0 KB bitmap image of artwork which goes with this article, entitled:
Cut That Drive Down To Size

And now, the reason for creating that 5MB partition. According to the folks at PowerQuest, many 386 users report a performance improvement when they put the Windows swap file into its own partition. To maximize the improvement, PartitionMagic lets you increase the cluster size of any partition to 32,768 bytes, which is the opposite direction from where you'd ordinarily want to go. But for a dedicated swap file partition, you needn't worry about wasting space. The swap file is much larger than even the largest cluster size, and if file size is an exact multiple of 32,768, there's zero space waste. Each FAT on my new swap file partition occupies a grand total of one sector, and some 165 pointers have nothing to do all day but point to the swap file's clusters.

Now if I could only reduce the directory block to one entry, I'd really be ready to fly. Well, maybe not, but the new configuration does seem to have a bit more pep to it. I still prefer my Pentium, though.

By the way, PartitionMagic won't create smaller-than-legal clusters, which would require an extensive rewrite of the FAT and cause the operating system a lot more confusion. But if you insist on smaller clusters, and on squeezing more than 2GB into a single partition, Microsoft might have a solution by the time you read this, in the form of a new FAT32 File System. Each cluster in this system will get a 4-byte pointer in the FAT, and FAT32 will handle drive capacities up to 2 terabytes. One terabyte is 240, or 1,099,511,627,776 bytes. If you can't relate that number to anything in the real world, just line up about 105,000 of those old 10MB drives and you'll get the picture.

If even an 8KB cluster is too big for you, FAT32 will support a cluster half that size on a drive up to 8GB. And according to Microsoft, FAT32 involves "very little change to Windows 95." That is, if you consider a two-sector boot record, more reserved sectors, larger FAT's (each pointer will now get 4 bytes) and a root directory you can store anywhere on the drive "very little change." There's one other very little change: the Format, Fdisk, Disk Defragmenter, ScanDisk and DriveSpace utilities will all be revised to support FAT32. Microsoft says that although "existing utilities and drivers should continue to work ... Microsoft is working with leading device driver and disk utility vendors to support them in revising their products to support FAT32."

What could be clearer? Perhaps instructions on where you can get it (if you still want it). Presumably, it will first find its way into OEM systems that come with Win95 pre-installed. At about the same time, it will probably show up for downloading from some of Microsoft's Web sites. That is, if you can get a connection.

With or without PartitionMagic, if you're going to increase the number of partitions on your hard drive, now is the time to think about changing your CD-ROM drive letter. If it is currently drive D:, it becomes E: if you add one more partition, F: if you add two and so on. You'll also have to redo your CD-ROM shortcuts, .INI files and Registry entries each time you add a new partition or other device. So make it drive M:, or whatever it takes to get it safely out of the way. To do so, open Device Manager by right-clicking on My Computer and selecting Context/Properties, then click on the plus sign next to CDROM, highlight the specific CD-ROM drive, click on the Properties button and then on the Settings tab. Click on the down arrow next to the Start Drive Letter box and select the desired drive letter.

After that, use Explorer's Find option to search all .INI files for anything that cites the current drive letter (path=D:\, for instance), and edit those files. Next, search the Registry's Data column for the same drive letter. You can ignore any reference you find in the AutoRun subkey under the HKEY_CLASSES_ROOT key, because Win95 always erases this key when you exit, and then rewrites it the next time you insert a disc in the CD-ROM drive (assuming it has an AUTORUN.INF file in its root directory). If you find a reference to an old CD-ROM drive letter in any key that includes "MRU" or "Recent" as part of its name, you can ignore it. In the Registry, go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion and highlight the Setup key. Double-click on SourcePath to bring up the Edit String dialog box and change the entry to X:\WIN95 (where X is the new drive letter). This is where Win95 will look if it needs to find its own CD-ROM disc.

Once you do all that, your existing CD-ROM library should be back in business, and you can partition your drive to your heart's content-or at least to the letter L-without worrying about your CD-ROM drive letter getting in the way.

Senior Contributing Editor John Woram is the author of Windows Configuration Handbook (Random House, 1993). Contact John in the "Optimizing Windows" topic of the WINDOWS Magazine areas on America Online and CompuServe. John Woram's e-mail ID is:

Back to 9/96 Analysis: Dialog Box
Up to Table of Contents
Ahead to 9/96 How To: Optimizing Windows