Hierarchical File System (HFS)

J

Jarret W. Buse

Guest
Hierarchical File System (HFS)

The Hierarchical File System (HFS) was introduced in September 1985 by Apple Computers.

The maximum volume size supported by HFS is 2 TB with a maximum file size of 2 GB. The maximum file name length is 255 characters, but the older Apple systems only used 31 characters.

The directories and their contents are managed by a B-Tree file. The file allocation is stored in a bitmap file, while bad blocks are tracked by a B-Tree file. The directory and file name information is stored with its case intact. That is, a file with upper and lower case letters are saved with the upper and lower case letters. Even though the names are stored with its case, the file system is not case sensitive.

Stored dates can be in the range of January 1, 1904 to February 6, 2040.

HFS was introduced to replace the Macintosh File System (MFS). The MFS kept a flat file storing the directory and file structure. Searching the disk was slow on larger disks. MFS was more intended for use on floppies. HFS uses 32-bit integers for addressing and can support larger disks than MFS. In one area, 32-bit integers were not used, so the maximum number of files is 65,535 (the largest number represented by 16 bits).

NOTE: No matter what size the storage unit, an HFS volume can only hold 65,535 files.

These limitations were resolved with the introduction of HFS Plus (HFS+).

Beginning with OS X, HFS drives could not be bootable. Later, with OS X 10.6 (code named Snow Leopard), HFS volumes were accessed as read-only, making them inaccessible for changing data.

HFS divides the volume into 512 byte blocks. These blocks are then grouped to produce 65,535 allocation units. It is these units which are addressable.

Remember that the allocation units are the size of the volume divided into 65,535 units. This basically means the smallest amount used by a file is one allocation block. Let’s assume we use a 2 GB thumb drive. Each allocation unit would roughly be 30,518 bytes (30 KB). This means that files smaller than 30 KB would then use 30 KB of space.

The HFS volume is made up of five sections:

  1. Boot Blocks – Blocks 0 and 1 are used to startup an Operating System
  2. Master Directory Block (MDB) – Block 2 contains the MDB which holds various details about the volume including the location of the Bitmap information. A duplicate of the MDB is kept at the last block of the volume, which is called the Alternate MDB.
  3. Bitmap – file used to track the block usage. In the file, a ‘1’ represents that the block is in use. A ‘0’ shows the block is free. Since the Bitmap size varies on the volume size, the ending block varies.
  4. Extent Overflow – B-Tree file containing the information of which blocks belong to which file once the first three extents are used from the Catalog File. This file stores information on bad blocks as well.
  5. Catalog File – stores information on files and directories in a B-Tree file.

For systems that can multi-task, the Catalog File only allows one application to write to it at a time. When multiple applications are writing new files or directories, there is a bottleneck created here and the apps must wait in line to write the files and update the Catalog File.

Since the directory and file list are stored in the Catalog List, it is possible that if the Catalog List is damaged, then data corruption can occur on the whole file system.

HFS supports compression, but only by using a third party utility. HFS has no “bells and whistles”, but at the time was a major improvement for Apple over their previous file system (MFS).
 

Attachments

  • slide.jpg
    slide.jpg
    40 KB · Views: 97,676
Last edited:


For those of you that are using a Debian-based Linux distro that lacks the ability to use HFS filesystems, use this command to install the needed utilities. This also provides the tools needed for HFS+.

apt-get install hfsutils hfsprogs hfsutils-tcltk
 


Top