TMAP version 1.02 960420, (C) Thomas M. Allen TMAP presents a graphical display of the fragmentation of the clusters on any floppy or hard disk using DOS' FAT file system. What's a Cluster? In the DOS world, disk space is allocated to files on an as- needed basis. The basic allocation storage unit is called a cluster, and the size of a cluster varies by the type of disk, its format and the disk's size. Typical floppy disks have cluster sizes of 1024 bytes, while on a hard disk a cluster may range from 2048 to 16384 bytes depending on the capacity of the disk. There may be tens of thousands of clusters (allocation units) on a hard disk; the FORMAT command determines these sizes. The clusters are numbered and a file on the disk consists of one or more of these allocation units. A directory entry is little more than a file's name, date, time and the disk's file allocation table (FAT) entry that represents the first cluster of the file contents. This ordered list of cluster numbers comprising the file are coded in the FAT, and is the sequence in which the clusters must be read or written so the individual pieces of the file get accessed in the right order. What's Fragmentation? Fragmentation is the natural consequence of creating and deleting files on most file systems. Since a file is made up of one or more clusters whose order is known, a file may be spread out all over the disk. Resaving the file from, say, a word processor, writes the file somewhere else on the disk, freeing up the original space to be used for something else. DOS merely follows the current chain of cluster numbers in the FAT to read or write the file. It doesn't care how many pieces there are nor how they're scattered around the disk. But jumping all over the disk to read and write the bits and pieces slows things down. If the pieces of a file are not located together, we say the file is fragmented, and being fragmented can make it extremely difficult to unerase or to recover it if destroyed, deleted or lost somehow. TMAP shows the relative level of fragmentation of all the files on the disk, nothing more. It doesn't write to the disk nor is there any user interaction. If the display from TMAP looks like a bad case of acne, you are long overdue for running a cleanup utility on your disk! The idea for TMAP came from a utility program called VMAP from Golden Bow Systems of San Diego. According to a representative of Golden Bow, VMAP and its mainstream disk de-fragmenter product, VOPT, were distributed together as demo programs (the VOPT demo went through the actions but didn't actually change the disk). They ended up on bulletin boards around the country. When VMAP was written (1987 timeframe), hard disks were relatively small. An earlier version of VMAP didn't work on disk partitions larger than 32 megabytes. A subsequent version only worked properly on partitions smaller than 128 Mb. The reason? The size of the disk's file allocation table (FAT) changes as disk partitions get larger. On the version I used, VMAP assumed it could read the FAT as a single 64k block. However, on disks larger than 128 Mb, the FAT size exceeded 64k and VMAP did not work right. Since there are only 1560 display positions on TMAP's display, we make each position represent more than one cluster. The symbol displayed is therefore a composite of those adjacent clusters grouped together. The scale, or the number of clusters represented by each symbol, is noted above the map. So, Now What? Every user of DOS should have a utility program that does maintenance on his own hard disk. Besides frequently running CHKDSK to ensure consistency in the file system, Golden Bow's VOPT utility does a stellar job of defragmenting and I highly recommend it. Norton's Speed Disk works great too. The defragmenter that comes with DOS (defrag) is suitable too. Personally I like ORG, a shareware disk organizer written by Grev‚ and Rifkind. TMAP was authored primarily by Ronald E. Raikes out of our mutual desire to have a "VMAP" that worked with our large disks. He wanted it to be a character-based utility that would function over his serial port. With his permission, I have modified his character-based version, changing the output format, adding color and doing additional testing on other hardware and DOS versions using Borland C++. Its output looks very much like the old VMAP from Golden Bow. I've tested TMAP with a wide range of types and sizes of floppy and hard disks (SCSI, ESDI, IDE) on a variety of machines and display adapters. It executes under DOS 4.01 and above, including the Novell implementations of DOS. It does not work on a CD-ROM (CDs don't use the FAT file system) nor on a networked drive. I have not tried it on a Doublespaced volume. Just before releasing the first version of TMAP, a friend gave me a version of VMAP that I didn't even know existed. Voila, here was the version I had wanted all along! I'm pleased to report we get the same display... Thomas M. Allen thos@deltanet.com / 72537.1143@compuserve.com North Orange County Computer Club (NOCCC) Orange, California 1.02 20 April 1996: Fixed a condition where the computer would lock up when reading the file allocation table of a large hard disk partition. 1.01 13 December 1993