Heirarchical FileSystem (extended)

The default filesystem on Mac OS. Also known as Mac OS Extended.

When support for HFS+ was made available with Mac OS 8.1 in 1998, it offered several enhancements to HFS, the filesystem that it replaced. These included smaller allocation block size, which makes better use of disk space, and long Unicode file names. There are several significant differences between HFS+ and other filesystems, such as UFS.

  • Multiple forks
    Files may have a resource fork in addition to a data fork. This is used to store resources such as icons, graphics, localized strings and extended metadata. With Mac OS X, Apple discourages the use of resource forks, and provides a more elegant system of bundles to provide the benefits of the multi-fork system (such as easy internationalization), but without the drawbacks (cannot be transfered to other filesystems without additional encoding).
  • Case insensitive, case preserving
    Much like e2 node titles. The files foo.txt and Foo.txt are considered to be the same, and cannot both exist within the same directory. This can cause problems with *nix software on Mac OS X that expects to be able to have differently capitalized files within a directory. PHP is a case in point, which tries to create a directory called PEAR and a file named pear in the same place.
  • Path separators
    The colon (:) is used as the path separator, not the slash character. This means that colons cannot appear within filenames. Slashes may appear in names, but it is not recommended.
  • Extended metadata
    HFS+ supports creation dates as well as modification dates, and also stores creator and type information within the file.
  • Aliases
    Aliases are similar to symbolic links, in that they are a lightweight reference to another file. They differ from symlinks as the path to which they point is not hardcoded. In other words, you may move the referenced file and the alias will still point to that file. This is not always desiarable behaviour, so Mac OS X supports symbolic links as well as aliases.

A couple of things:

  • If a machine with File Sharing on is running Mac OS 8.1 or higher, even if the client machine isn't, the client can access and manipulate the files on the 8.1 machine perfectly.
  • If you try to access a hard drive on your own machine that is formatted as HFS+ and you're not running 8.1 or higher, all you see is a text file called "Where_have_all_my_files_gone?" that explains, well, where all your files have gone, and how to access them.
  • HFS, otherwise known as Mac OS Standard, divides the disk into a maximum of 65,000 allocation blocks. HFS+ (also called Mac OS Extended) increases this maximum limit to 4.29 billion allocation blocks.

It should also be noted that 68040 machines cannot read HFS+ disks, whether or not they are running Mac OS 8.1 (Except of course when accessing the disk via file sharing)

Other differences and improvements over HFS include:

  • Increased maximum file size: On an HFS disk, files are limited in size to 2GB (due to the used of signed 32 bit integers to store file lengths). Under HFS+, maximum file size is a tad over 9 exabytes (2^63 - 1).
  • The startup file: This is a special file that is easily locatable during startup, even by systems that do not support HFS/HFS+ in ROM. It is in maby ways a generalisation of HFS boot blocks. Not currently used by the Mac OS, it is designed to make it easier for alternative operating systems to boot from HFS+ formatted drives.
  • Dates: While HFS and HFS+ both store the date in seconds since midnight, January 1st 1904, HFS+ stores dates as GMT, whereas HFS uses local time. The exception to this is volume creation dates which are still given in local time.
  • Support for permissions: whereas HFS stores no permissions data with files/folders, HFS+ does.

Unfortunately, although all this was in place by Mac OS 8.1, it wasn't until Mac OS 9 that there was an API that would allow us mere mortals to use these capabilities. As a result there are precious few applications under Mac OS 9 that can handle large files or long file names. Even the Finder cannot display long file names. It was not until Mac OS X that we were to embrace the joys of 255 character file names.

A compatibility mechanism exists so that applications that were written with the APIs limited to 31 character names can sucessfuly access files with longer names. When a user tries to use a file with a long name with such an application, be it by doubleclicking on a file, AppleEvents etc., the application gets a mangled version of the file name. This name is obtained by shortening the name as necessary and adding a # sign followed by some hexadecimal numbers. If the file has an extension, it is left intact and the # and hexadecimal characters are put immediately before it. Untranslatable Unicode characters are replaced by question marks. For example, MyFileWithaVeryVeryLongAndQuitePointlessName.txt would become something like MyFileWithAVeryVeryLon#AC1D.txt
Applications can use this mangled name to refer to the file, open, move delete etc, as if it was the file's real name.

While HFS+ introduced some major changes, it was very much designed as an extension to HFS. Existing applications work transparently with HFS and HFS+ (except of course those working at a very low level with the disk, such as repair programs).

Log in or register to write something here or to contact authors.