By Eric Bennett
Please send me email to report any errors in this document (technical, grammatical, or other).
The correct address of MacSlack's Internet web page is
http://www.pobox.com/~ericb/software/macslack/.
Other
addresses may change without notice.
The current version of MacSlack is 1.0.2 (click to download). The current version of this documentation is 1.0.2.
There is a beta version which can erase a disk with a new, empty HFS+ volume with an allocation block size of your choice. Please read the beta notes carefully before trying it.
If you already know why slack space is bad and how to get rid of it, you can skip down to "How do I use MacSlack?"
Dividing the drive into large clusters as in Figure 1 usually results in wasted space. Suppose that you have a file that is 2460 characters (bytes) long, and your cluster size is 1024 bytes (such a situation is depicted for the yellow file in Figure 2 below). The Macintosh must allocate three clusters (totalling 3072 bytes) for this file even though only 2460 bytes are used. The remainder of the third cluster, called slack space, is wasted. Note that all 14 clusters in Figure 2 contain file data (represented by color); there are no free clusters, so no new files can be created on this area of the disk.
This wasted space can be a serious problem on large drives with lots of small files: the larger the drive, the larger the cluster size, and the smaller the files, the greater the amount of wasted space in each file's last cluster. If you decreased the size of the partitions on your hard drive (by splitting large partitions into multiple smaller ones), the clusters on each drive would be smaller, and you could reclaim some of the wasted space. For example, you might split the partition in Figure 2 into two smaller partitions so that the cluster size was only 512 bytes (as in Figure 3). The yellow file would take five clusters totalling 2560 bytes.
There would still be 100 wasted bytes, but 512 of the bytes that were wasted in Figure 2 are now a free cluster, which can hold a new file. On large partitions, where the cluster size can reach 32,000 bytes or more, you can lose a significant amount of space. A friend of mine discovered last year that his Windows 95 system was wasting 28% of the space on his drive for exactly this reason (the common DOS/Windows "FAT16" filesystem has the same 65,536 clusters-per-volume limit that the Mac does). The main hard drive on my own computer has one four gigabyte partition, and 25% of the space allocated to files is slack space.There are, in theory, two ways to reduce the cluster size. Each has its drawbacks. MacSlack should help you decide whether the space savings you're likely to see make it worthwhile to deal with the drawbacks.
Figure 4 below shows the actual change in disk use for an 8.4 gigabyte partition that was converted from HFS to HFS+. Note the change in the "Format" information; the left window shows the drive in Standard (HFS) format, and the right window shows Extended (HFS+) format:
Under HFS, the 4,161 items used 952 megabytes; under HFS+, they use 443. Thus, 509 megabytes were regained.
But there are potential problems with changing a drive to HFS+:
Since the cluster size must always be a multiple of 512 bytes, and
since there are a maximum of 65,536 clusters under HFS, you can
calculate the following table:
Partition Size (megabytes) |
Cluster Size (bytes) |
---|---|
1-32 | 512 |
33-64 | 1024 |
65-96 | 1536 |
97-128 | 2048 |
129-160 | 2560 |
161-192 | 3072 |
193-224 | 3584 |
225-256 | 4096 |
etc... |
As you can see, the cluster size increases by 512 bytes for every 32 megabytes of partition size. If you decide to repartition your hard drive, consider this: as you can see in Figure 2, the green file has more total wasted space than the blue file, but since it is a big file, it is a smaller percentage of space wasted than the blue file. Therefore, when creating new partitions, it is a good idea to make one small partition to hold a large number of small files, while keeping one larger partition for a smaller number of large files. You could also simply make a large number of small partitions, but it then becomes more difficult to manage files (suddenly you have more free space, but it is spread around multiple partitions) and your desktop becomes more cluttered.
There are two additional drawbacks to repartitioning:
While the usual procedure is to drop your hard disk icon onto MacSlack, you can also calculate slack for any group of files, folders, or volumes. If you find a volume that has a lot of wasted space, you might want to inspect some of the folders on that volume individually to see whether one of them is responsible for most of the waste. If so, you may simply be able to move that directory to another, smaller drive (if you have one) and not have to repartition the entire disk.
As MacSlack is scanning folders that you explicitly told it to scan, it may encounter subfolders inside those folders. You can tell MacSlack to ignore any subfolders it encounters by un-checking the "Scan nested folders" item in the "File" menu.
There is a rudimentary help window available in the help menu (also known as the balloon help menu), but this manual is more detailed.
If rebuilding the desktop does not work, please contact me by email.
After you have set the desired cluster size, drag and drop the desired files and folders onto the MacSlack icon in the Finder. MacSlack will predict how much space the files would occupy on the type of volume you chose. Because of the drawbacks mentioned earlier (see How do I eliminate slack space on a Macintosh?), changing to HFS+ or repartitioning your drive will not release quite as much space as MacSlack predicts. In most situations, however, the savings should be within a few megabytes of what MacSlack predicts.
Also, note that Apple defines a megabyte as 1024 kilobytes and a gigabyte as 1024 megabytes (1,073,741,842 bytes), while most hard disk manufacturers define a megabyte as 1,000,000 bytes and a gigabyte as 1,000,000,000 bytes. MacSlack uses Apple's definition because it more accurately reflects the sizes you will see displayed by the Finder.
You may redistribute the original, unmodified MacSlack archive, provided that you do not charge for this service (media and duplication costs excepted). You may not distribute MacSlack except as just described.
MacSlack can be obtained from the Info-Mac archives or from the author's web site. The MacSlack 1.0.2 distribution is available as a StuffIt archive (250k; click to download) or a BinHexed StuffIt archive (345k; click to download) . Please send any bug reports or suggestions to me by email.
Please note that MacSlack 1.0.x is not distributed under this license, and its source is not currently available.
This information was last modified on January 24, 1999.