Hierarchical File System Article Index for
Hierarchical
Website Links For
Hierarchical
 

Information About

Hierarchical File System




  Full Name Hierarchical File System
  Developer Apple Computer
  Introduction Os System 21
  Introduction Date September 17 1985
  Partition Id <tt>Apple_HFS</tt> ( Apple Partition Map )<br><tt>0xAF</tt> ( MBR )
  Directory Struct B-tree
  File Struct B-tree
  Bad Blocks Struct B-tree
  Max Files No 65535
  Max File Size 4 GiB
  Max Filename Size 31 characters
  Max Volume Size 2 TiB
  Dates Recorded Creation, modification, backup
  Date Range January 1, 1904 - February 6, 2040
  Forks Streams Only 2 (data and resource)
  Attributes Color (3 bits, all other flags 1 bit), locked, custom icon, bundle, invisible, alias, system, stationery, inited, no INIT resources, shared, desktop
  File System Permissions AppleShare
  Compression Yes (third-party), Stacker
  Encryption No


Hierarchical File System ('''HFS'''), is a File System developed by Apple Computer for use on computers running Mac OS . Originally designed for use on Floppy and Hard Disk s, it can also be found on read-only media such as CD-ROM s. HFS is the name used by developers, but in user documentation the format is referred to as '''Mac OS Standard''' to differentiate it from its successor HFS Plus which is called '''Mac OS Extended'''.


HISTORY

The Macintosh File System (MFS) was the original Macintosh file system, introduced in 1984. Because Macintosh computers use richer data than other commonly available file systems would allow (such as DOS 's FAT ), Apple developed a new file system. For example, MFS permits filenames up to 31 characters in length, and supports dual forked (separate data and Resource Fork s per file) files.

Since MFS was intended to be used on very small and slow media, namely Floppy Disk s, several design decisions were made to increase performance. This led to a number of unique design decisions. For instance, MFS refers to files not by name, but by a single volume-wide unique ID, the ''handle''. When a directory (folder) is opened, the Mac OS draws the contents of the folder and then caches the handles. When a user double-clicks a file to open it, the Finder simply passes the handle back into the system in order to find the file.

MFS stored all of the file and directory listing information in a single file. The Finder nevertheless supported the "illusion" of folders, by storing all files as a directory handle/file handle pair. To display the contents of a particular folder, MFS would scan the directory for all files in that handle. There was no need to find a separate file containing the directory listing.

While the MFS system worked well for small file systems, the introduction of larger media, notably Hard Drive s, revealed serious preformance problems. The main concern was the time needed to display the contents of a folder; under MFS the system had to search the entire directory and build up a list. This worked fine for a system with a few hundred kilobytes of storage and perhaps a hundred files, but as the systems grew into megabytes and thousands of files, the performance degraded rapidly.


Work on creating HFS from MFS was done by Patrick Dirks and Bill Bruffy. It was all written in 68K assembly language. The signature of an HFS disk is "BD", which stands for Big Disk, but also for Bruffy and Dirks!

Generally, HFS is very similar to MFS. As in MFS, the locations of files for the entire drive are stored in a single directory structure, the Catalog File. This contrasts strongly with almost all other file systems, where the directory information is isolated to those files in a particular directory – how most people would likely believe even HFS works. This leads to real performance problems when the system allows Multitasking , as only one program can write to this structure at a time, meaning that many programs may be waiting in queue due to one program "hogging" the system. It is also a serious reliability concern, as damage to this file can destroy the entire file system; with structure distributed across the disk, damaging a single directory is generally non-fatal and it can often be re-constructed with data held in the non-damaged portions.


While HFS is a proprietary file system format, it's well documented so there are usually solutions available to access HFS formatted disks from most modern Operating System s.

In 1998 , Apple introduced HFS Plus to address inefficient allocation of disk space in HFS and to add other improvements. HFS is still supported by current versions of Mac OS, but starting with Mac OS X an HFS volume cannot be used for Booting .


DESIGN


The Hierarchical File System divides a volume into ''logical blocks'' of 512 bytes. These logical blocks are then grouped together into ''allocation blocks'' which can contain one or more logical blocks depending on the total size of the volume. HFS uses a 16 bit value to address allocation blocks, limiting the number of allocation blocks to 65,536.

There are five structures that make up an HFS volume:
# Logical blocks 0 and 1 of the volume are the Boot Blocks , which contain system startup information. For example, the names of the System and Shell (usually the Finder ) files which are loaded at startup.
# Logical block 2 contains the Master Directory Block (aka '''MDB'''). This defines a wide variety of data about the volume itself, for example date & time stamps for when the volume was created, the location of the other volume structures such as the Volume Bitmap or the size of logical structures such as allocation blocks. There is also a duplicate of the MDB called the '''Alternate Master Directory Block''' (aka '''Alternate MDB''') located at the opposite end of the volume in the second to last logical block. This is intended mainly for use by disk utilities and is only updated when either the Catalog File or Extents Overflow File grow in size.
# Logical block 3 is the starting block of the Volume Bitmap, which keeps track of which allocation blocks are in use and which are free. Each allocation block on the volume is represented by a bit in the map: if the bit is set then the block is in use; if it is clear then the block is free to be used. Since the Volume Bitmap must have a bit to represent each allocation block, its size is determined by the size of the volume itself.


SEE ALSO



EXTERNAL LINKS