Last updated on May 11, 2024
This is a copy of Apple Knowledge Base Article 8647 taken from the internet archive (for some reason it was not included in the TIL articles I found on CD, or the TA articles I scraped from Apple’s site), this article explains the various limits for partition sizes, and number of files under different versions of the OS
Before discussing hard drive block allocation, and the intricacies of determining allocation block sizes and such, let’s first review the Macintosh Standard format/Hierarchical File System (HFS) used for hard drives and larger removable media (not floppies).
Below are some specifications and associated terminology used to describe the Macintosh Standard format structure.
Volume
A volume is either a full disk, or a section of a disk, partitioned into separate parts. If you partition a single drive then each partition is considered a volume.
- The maximum volume size under System 6 and System 7 is 2 GB (reduced by 2k to 2,097,150KB using Apple’s HD SC Setup 7.3.5). System 7.5 increased that limit to 4 GB (reduced down to 4,151,534KB, 42,770KB less than 4GB, when using Apple’s HD SC Setup 7.3.5) and System 7.5.2 (and later) increases that limit to 2 TB on some computers, including:
- any computer that came with System 7.5.2 or newer.
- any Macintosh computer with PCI slots.
- The maximum number of volumes is theoretically limited to 173 due to the maximum number of open files in the Mac OS. Since there are other files that are opened when the computer boots up, the actual maximum will vary depending upon how many other files are open by the operating system.
- The maximum file size is 2 GB.
- The maximum number of files on a volume is 65,536.
- The maximum number of files in a folder is 32,767.
- The maximum size of the data fork in a file is 2 GB.
- The maximum size of the resource fork in a file is 16 megabytes.
Note that AppleShare, including Personal File Sharing, has its own volume size limitations. For more information, please see technical document 15460
Logical block
A logical block is a unit of drive space composed of up to 512 bytes. A logical block is numbered from 0 to n, n being the last block on the volume – not necessarily the hard disk. Take the volume size, divide it by 512 bytes, and you have the number of logical blocks.
Allocation block
An allocation block is a unit of storage on a volume, composed of one or more logical blocks. The larger the volume, the more logical blocks comprise one allocation block. The maximum number of allocation blocks per volume is 65,536; most volumes have slightly less.
In both the Macintosh and DOS environments, the maximum number of blocks on a driver is 65,536 because both operating systems address the allocation blocks with a 16-bit address. Drives larger than 512 MB cannot use a block size of 8K or less because there just aren’t enough addresses. Thus, if a 2 GB drive is one Macintosh partition, the smallest file size allowed is 32K. (If you save a SimpleText file with one character in it, it would take up 32K of disk space.) This means that the size of your hard drive determines the minimum size of each file.
A non-empty file fork always occupies at least one allocation block, no matter how many bytes of data the file fork contains. If the data fork and resource fork of a file contain data, the file uses two allocation blocks. If all the files are only one allocation block long, then there can be as many files on the volume as there are allocation blocks for the volume. However, when a file is longer than one allocation block, the total number of possible files decreases. For example, on a volume with 65,535 allocations block, you can have:
- 65,536 files, each 1 allocation block long.
- 32,768 files, each 2 allocation blocks long.
- 2048 files, each 32 allocation blocks long.
- 1024 files, each 64 allocation blocks long.
All of the numbers above refer to the System’s record structures. Other elements place tighter restrictions on the actual number of usable files in the root directory. The Standard File dialog uses the List Manager. The List Manager has a limit of 32K of data, which is somewhere between 800 and 900 files. Though more files can be handled in a directory, the List Manager will only display the first 32K.
A second element concerns the performance of the Finder when approaching 800 to 900 files per directory. Even simple operations, such as moving the icon of a file, tend to slow down considerably when this number of files exists in a directory. This limitation changes depending on the speed of the individual Macintosh model.
Determining Allocation Block Size
Follow these steps to calculate the allocation block size:
- Take the size of the drive in megabytes and multiply it by 2000 (there are 2000 disk blocks in 1 MB of disk space).
- Divide that number by 65,536, since the Macintosh cannot have more than 65,536 allocation blocks.
- Round this number up and multiply it by 512.
- The result is the number of bytes in the allocation block. Here is an example using a 230 MB drive:
- 230 x 2000 / 65536 = 7.019
- 7.019 rounded up = 8
- 8 x 512 = 4096 bytes
So what does this mean to you? The larger the hard drive, the larger the allocation block size, and the more space that is wasted on small files. If you have a large drive with a lot of small files, the hard drive space is being used less efficiently than if most of your files average 32K in size.
Note : Since drives come from different manufacturers, it is possible to get different values. This is because a 500 MB drive is not exactly 500 MB but is usually somewhat larger. This could result in different logical block sizes than those listed in the chart (see Allocation Block Size Table below), but the difference should not be more than +/- 512 bytes. This difference is most noticeable on the larger drives. For example, the 500 MB drive actually calculates to 8192 bytes but the 500 MB drive in some Macintosh computers is actually 540 MB, which has a logical block size of 8704, as listed in the chart.
Volume Organization of Macintosh Standard Format
The first two logical blocks (labeled 0 and 1) of a volume are the boot blocks. This is where the information for mounting the volume is stored.
The third logical block (labeled 2) is the Master Directory Block, or MDB for short. This block contains part of the data structure of a flat directory volume. It contains the volume information and the volume allocation block map. This block is where the information for the hard disk, such as number of files in the directory and the last time the drive was initialized, is stored.
Logical blocks 3 to x (see the following table) contain the volume bitmap. This block is a data structure containing a sequence of bits, one bit for each allocation block. The volume bitmap stores a reference to every piece of data that is in the allocation blocks and indicates whether the block is allocated or free for use. Volume bitmaps exist both on hierarchical directory volumes and in memory.
Volumes may have as few as 32,768 allocation blocks and as many as 65,536 allocation blocks. This table defines what logical block the volume bitmap ends on based on the number of allocation blocks:
Allocation Blocks | Last Volume Bitmap Logical Block |
---|---|
61,440 | 18 |
57,344 | 17 |
53,248 | 16 |
49,152 | 15 |
45,056 | 14 |
40,960 | 13 |
36,864 | 12 |
32,768 | 11 |
Allocation blocks begin after the volume bitmap. Contained in the allocation blocks are the catalog, extents and data files.
The catalog file is a list of all files and folders stored in a volume. The catalog file maintains the relationships between the files and directories on a hierarchical directory volume. It corresponds to the file directory on a flat directory volume. The catalog file is organized and accessed using a B- tree structure. The files are arranged in alphabetical order evenly balanced on the tree so that finding a “Z” doesn’t take any longer than finding an “A”. This structure is the glue that keeps the catalog file together.
The extents tree file contains the locations of all the files on a volume (An extent is a series of contiguous allocation blocks). The extents tree file is where the information (such as where to find file, and how many extents a file is divided into) about the data files you have created is stored. Any given file you create may be broken up into multiple extents. When extents are linked together, behind the scenes, with information from the extents tree file, the appearance is of one data file.
The next, and largest, section of the volume contains all the actual data files and applications which are referenced using the above files.
The next to last block on the hard disk contains the alternate master directory. This alternate is a backup to the MDB kept on logical block 2. It is used when the file manager determines that the MDB is corrupt and needs to be rewritten with the correct information.
The very last block is empty. It is used to check for bad sections of the hard disk.
What You Can Do
So, can you do anything to decrease the file size on a large hard drive? One solution is to partition larger drives into smaller partitions, or logical drives, each with a maximum of 65,536 blocks.
Apple’s Drive Setup can be used to partition qualified Apple hard drives and some removable devices as listed in the Drive Setup Guide file. Unsupported hard drives will show up in the device list by name, however, if you select an unsupported hard drive you will get the message, “Cannot modify a disk in an unsupported drive.”…. unless you use the patched version supplied on my drive images….
Drive Setup is supported on all of the Power Macintosh computers. This includes the original Power Macintosh computers and the new PCI-based Power Macintosh computers. Drive Setup is also compatible with 68040 and 68LC040 processor-based systems that have IDE drives installed. Drive Setup is not supported with the Power Macintosh Upgrade Card. Drive Setup 1.0.2 is available from online services.
There are third parties that offer a solution for creating multiple Macintosh partitions on Macintosh systems not supported by Drive Setup. A few are:
- Hard Disk Toolkit (HDT) by FWB Software, Inc.
- Silverlining by La Cie Ltd.
- Micronet Utility by MicroNet Technology
- MicroTech Utility by MicroTech International
- Drive 7 by Casa Blanca Works, Inc.