HFS Plus
Encyclopedia
HFS Plus or HFS+ is a file system
File system
A file system is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device which contain it. A file system organizes data in an efficient manner and is tuned to the...

 developed by Apple Inc. to replace their Hierarchical File System
Hierarchical File System
Hierarchical File System is a file system developed by Apple Inc. for use in computer systems running Mac OS. Originally designed for use on floppy and hard disks, it can also be found on read-only media such as CD-ROMs...

 (HFS) as the primary file system used in Macintosh
Macintosh
The Macintosh , or Mac, is a series of several lines of personal computers designed, developed, and marketed by Apple Inc. The first Macintosh was introduced by Apple's then-chairman Steve Jobs on January 24, 1984; it was the first commercially successful personal computer to feature a mouse and a...

 computers (or other systems running Mac OS
Mac OS
Mac OS is a series of graphical user interface-based operating systems developed by Apple Inc. for their Macintosh line of computer systems. The Macintosh user experience is credited with popularizing the graphical user interface...

). It is also one of the formats used by the iPod
IPod
iPod is a line of portable media players created and marketed by Apple Inc. The product line-up currently consists of the hard drive-based iPod Classic, the touchscreen iPod Touch, the compact iPod Nano, and the ultra-compact iPod Shuffle...

 digital music player. HFS Plus is also referred to as Mac OS Extended (or, erroneously, “HFS Extended”), where its predecessor, HFS, is also referred to as Mac OS Standard (or, erroneously, as “HFS Standard”). During development, Apple referred to this filesystem with the codename Sequoia.

HFS Plus is an improved version of HFS, supporting much larger files (block addresses are 32-bit length instead of 16-bit) and using Unicode
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

 (instead of Mac OS Roman
Mac OS Roman
Mac OS Roman is a character encoding primarily used by Mac OS to represent text. It encodes 256 characters, the first 128 of which are identical to ASCII, with the remaining characters including mathematical symbols, diacritics, and additional punctuation marks. It is suitable for use to represent...

 or any of several other character sets) for naming the items (files, folders) – names which are also character encoded in UTF-16 and normalized to a form very nearly the same as Unicode Normalization Form D (NFD)
Unicode equivalence
Unicode equivalence is the specification by the Unicode character encoding standard that some sequences of code points represent essentially the same character...

 (which means that precomposed characters like å are decomposed in the HFS+ filename and therefore count as two characters and UTF-16 implies that characters from outside the Basic Multilingual Plane – often seldom used and characters from ancient writing systems – also count as two characters in an HFS+ filename). HFS Plus permits filenames up to 255 UTF-16 characters in length, and n-forked files similar to NTFS
NTFS
NTFS is the standard file system of Windows NT, including its later versions Windows 2000, Windows XP, Windows Server 2003, Windows Server 2008, Windows Vista, and Windows 7....

, the one which was changed was taken into the systems software takes advantage of forks other than the data fork and resource fork
Resource fork
The resource fork is a construct of the Mac OS operating system used to store structured data in a file, alongside unstructured data stored within the data fork. A resource fork stores information in a specific form, such as icons, the shapes of windows, definitions of menus and their contents, and...

. HFS Plus also uses a full 32-bit allocation mapping table, rather than HFS’s 16 bits. This was a serious limitation of HFS, meaning that no disk could support more than 65,536 allocation blocks under HFS. When disks were small, this was of little consequence, but as larger-capacity drives became available, it meant that the smallest amount of space that any file could occupy (a single allocation block) became excessively large, wasting significant amounts of space. For example, on a 1 GB disk, the allocation block size under HFS is 16 KB, so even a 1 byte file would take up 16 KB of disk space. Unlike most other file systems HFS Plus supports hard link
Hard link
In computing, a hard link is a directory entry that associates a name with a file on a file system. . The term is used in file systems which allow multiple hard links to be created for the same file. This has the effect of creating multiple names for the same file, causing an aliasing effect: e.g...

s to directories.

Like HFS, HFS Plus uses B-tree
B-tree
In computer science, a B-tree is a tree data structure that keeps data sorted and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-tree is a generalization of a binary search tree in that a node can have more than two children...

s to store most volume metadata.

History

HFS+ was introduced with the January 19, 1998 release of Mac OS 8.1
Mac OS 8
Mac OS 8 is an operating system that was released by Apple Computer on July 26, 1997. It represented the largest overhaul of the Mac OS since the release of System 7, some six years previously. It puts more emphasis on color than previous operating systems...

. However, its first appearance, as a beta filesystem, was in the never-released Copland OS
Copland (operating system)
Copland was a project at Apple Computer to create an updated version of the Macintosh operating system. It was to have introduced protected memory, preemptive multitasking and a number of new underlying operating system features, yet still be compatible with existing Mac software...

 betas.

With the release of the 10.2.2
Mac OS X v10.2
Mac OS X version 10.2 "Jaguar" is the third major release of Mac OS X, Apple's desktop and server operating system. It superseded Mac OS X v10.1 code name Puma and preceded Mac OS X Panther...

 update on November 11, 2002, Apple added optional journaling
Journaling file system
A journaling file system is a file system that keeps track of the changes that will be made in a journal before committing them to the main file system...

 features to HFS Plus for improved data reliability. These features were easily accessible in Mac OS X Server, but only accessible through the command line in the standard desktop client. With Mac OS X v10.3, all HFS Plus volumes on all Macs are set to be journaled by default. Within the system, an HFS Plus volume with a journal is identified as HFSJ.

10.3 also introduced another version of HFS Plus called HFSX. HFSX volumes are almost identical to HFS Plus volumes, except that they are never surrounded by the HFS Wrapper that is typical of HFS Plus volumes and they optionally support case sensitivity
Case sensitivity
Text sometimes exhibits case sensitivity; that is, words can differ in meaning based on differing use of uppercase and lowercase letters. Words with capital letters do not always have the same meaning when written with lowercase letters....

 for file and folder names. HFSX volumes can be recognized by two entries in the Volume Header, a value of HX in the signature field and 5 in the version field.

Additionally, Mac OS X 10.3 marked Apple's adoption of Unicode 3.2 decomposition, superseding the Unicode 2.1 decomposition used previously. This change has caused problems for developers writing software for Mac OS X.

With 10.4, Apple added support for Inline Attribute Data records, something that had been a part of the Mac OS X implementation of HFS Plus since at least 10.0
Mac OS X v10.0
Mac OS X version 10.0, code named "Cheetah", is the first major release of Mac OS X, Apple’s desktop and server operating system. Mac OS X v10.0 was released on March 24, 2001 for a price of US$129...

, but always marked as "reserved for future use". Until the release of Mac OS X Server 10.4
Mac OS X Server
Mac OS X Server is a Unix server operating system from Apple Inc. The server edition of Mac OS X is architecturally identical to its desktop counterpart, except that it includes work group management and administration software tools...

, HFS Plus supported only the standard UNIX file system permissions
File system permissions
Most current file systems have methods of administering permissions or access rights to specific users and groups of users. These systems control the ability of the users to view or make changes to the contents of the filesystem....

, however 10.4 introduced support for access control list
Access control list
An access control list , with respect to a computer file system, is a list of permissions attached to an object. An ACL specifies which users or system processes are granted access to objects, as well as what operations are allowed on given objects. Each entry in a typical ACL specifies a subject...

-based file security, which provides a richer mechanism to define file permissions and is also designed to be fully compatible with the file permission models on other platforms such as Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

 Windows XP
Windows XP
Windows XP is an operating system produced by Microsoft for use on personal computers, including home and business desktops, laptops and media centers. First released to computer manufacturers on August 24, 2001, it is the second most popular version of Windows, based on installed user base...

 and Windows Server 2003
Windows Server 2003
Windows Server 2003 is a server operating system produced by Microsoft, introduced on 24 April 2003. An updated version, Windows Server 2003 R2, was released to manufacturing on 6 December 2005...

.

In Mac OS X Snow Leopard 10.6 file system compression was added.

Design

HFS Plus volumes are divided into sectors (called logical blocks in HFS), that are usually 512 bytes in size. These sectors are then grouped together into allocation blocks which can contain one or more sectors; the number of allocation blocks depends on the total size of the volume. HFS Plus uses a larger value to address allocation blocks than HFS, 32 bits rather than 16 bits; this means it can access 4,294,967,296 (= 232) allocation blocks rather than the 65,536 (= 216) allocation blocks available to HFS.

Formerly, HFS Plus volumes were embedded inside an HFS standard filesystem. This was phased out by the Tiger transition to Intel Macs, where the HFS Plus filesystem was not embedded inside a wrapper. The wrapper was designed for two purposes; it allowed Macintosh computers without HFS Plus support in their ROM to boot HFS Plus volumes and it also was designed to help users transition to HFS Plus by including a minimal HFS volume with a read-only file called Where_have_all_my_files_gone?, explaining to users with versions of Mac OS 8.0 and earlier without HFS Plus, that the volume requires a system with HFS Plus support. The original HFS volume contains a signature and an offset to the embedded HFS Plus volume within its volume header. All allocation blocks in the HFS volume which contain the embedded volume are mapped out of the HFS allocation file as bad blocks.

There are nine structures that make up a typical HFS Plus volume:
  1. Sectors 0 and 1 of the volume are HFS boot blocks
    Boot sector
    A boot sector or boot block is a region of a hard disk, floppy disk, optical disc, or other data storage device that contains machine code to be loaded into random-access memory by a computer system's built-in firmware...

    . These are identical to the boot blocks in an HFS volume. They are part of the HFS wrapper.
  2. Sector 2 contains the Volume Header equivalent to the Master Directory Block in an HFS volume. The Volume Header stores a wide variety of data about the volume itself, for example the size of allocation blocks, a timestamp that indicates when the volume was created or the location of other volume structures such as the Catalog File or Extent Overflow File. The Volume Header is always located in the same place.
  3. The Allocation File which keeps track of which allocation blocks are free and which are in use. It is similar to the Volume Bitmap in HFS, in which each allocation block is represented by one bit. A zero means the block is free and a one means the block is in use. The main difference with the HFS Volume Bitmap, is that the Allocation File is stored as a regular file, it does not occupy a special reserved space near the beginning of the volume. The Allocation File can also change size and does not have to be stored contiguously within a volume.
  4. The Catalog File is a B-tree
    B-tree
    In computer science, a B-tree is a tree data structure that keeps data sorted and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-tree is a generalization of a binary search tree in that a node can have more than two children...

     that contains records for all the files and directories stored in the volume. The HFS Plus Catalog File is very similar to the HFS Catalog File, the main differences being records are larger to allow more fields and to allow for those fields to be larger (for example to allow the longer 255-character unicode file nameas of which the things was having a S Catalog File is 512 bytes in size, a record in the HFS Plus Catalog File is 4 KB in Mac OS and 8 KB in Mac OS X. Fields in HFS are of fixed size, in HFS Plus the size can vary depending on the actual size of the data they store.
  5. The Extents Overflow File is another B-tree
    B-tree
    In computer science, a B-tree is a tree data structure that keeps data sorted and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-tree is a generalization of a binary search tree in that a node can have more than two children...

     that records the allocation blocks that are allocated to each file as extents. Each file record in the Catalog File is capable of recording eight extents for each fork of a file; once those are used extents are recorded in the Extents Overflow File. Bad blocks are also recorded as extents in the Extents Overflow File. The default size of an extent record in Mac OS is 1 KB and 4 KB in Mac OS X.
  6. The Attributes File is a new B-tree
    B-tree
    In computer science, a B-tree is a tree data structure that keeps data sorted and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-tree is a generalization of a binary search tree in that a node can have more than two children...

     in HFS Plus that does not have a corresponding structure in HFS. The Attributes File can store three different types of 4 KB records: Inline Data Attribute records, Fork Data Attribute records and Extension Attribute records. Inline Data Attribute records store small attributes that can fit within the record itself. Fork Data Attribute records contain references to a maximum of eight extents that can hold larger attributes. Extension Attributes are used to extend a Fork Data Attribute record when its eight extent records are already used.
  7. The Startup File is designed for non-Mac OS systems that don't have HFS or HFS Plus support. It is similar to the Boot Blocks of an HFS volume.
  8. The second to last sector contains the Alternate Volume Header equivalent to the Alternate Master Directory Block of HFS.
  9. The last sector in the volume is reserved for use by Apple. It is used during the computer manufacturing process.

Linux

The Linux kernel
Linux kernel
The Linux kernel is an operating system kernel used by the Linux family of Unix-like operating systems. It is one of the most prominent examples of free and open source software....

 includes the hfsplus module for mounting HFS+ filesystems. HFS+ fsck
Fsck
The system utility fsck is a tool for checking the consistency of a file system in Unix and Unix-like operating systems such as Linux.-Use:...

 and mkfs
Mkfs
mkfs is the Linux/GNU command for formatting a disk partition with a specific filesystem.- Syntax :The basic syntax is: mkfs -t type device...

 have been ported to Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 and are part of the hfsprogs package.

In 2009, these drivers were diagnosed to be corrupting HFS+ drives with a capacity greater than 2 TB. Consequently, Linux distributions such as Debian and Ubuntu also stopped allowing mounting of HFS+ drives or partitions greater than 2 TB. , work is in progress to lift this restriction.

The Linux HFS+ kernel driver has support to read and write to HFS+ non-journaled drives/partitions but only has read support of journaled HFS+. Journaling is a redundant behavior of a filesystem that helps protect against data loss. If planning to write to an HFS+ partition then drive journaling must be turned off in Mac OS X.

Windows

There are a few commercial products that allow Windows users to read and write to HFS Plus formatted media, but to date Apple has only released read-only HFS+ drivers for Windows XP, Windows Vista, and Windows 7 as part of the Boot Camp software in Mac OS X 10.6. This means users on these systems can read data on the HFS+ drive, but not write to them. Microsoft has created an HFS+ driver for the Xbox 360 mainly for the purpose of reading HFS+ formatted iPods.

A free
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...

 (GPL
GNU General Public License
The GNU General Public License is the most widely used free software license, originally written by Richard Stallman for the GNU Project....

) alternative is HFSExplorer written by Erik Larsson. HFSExplorer is an application for viewing and extracting files from an HFS+ volume (Mac OS Extended) or an HFSX volume (Mac OS Extended, Case-sensitive) located either on a physical disk, on a .dmg disk image
Apple Disk Image
Apple Disk Image is a proprietary disk image format commonly used with the Mac OS X operating system. The format allows secure password protection as well as file compression and hence serves both security and file distribution functions; it is most commonly used to distribute software over the...

, or in a raw file system dump. However HFSExplorer can only read, but not write to HFS formatted volumes.

A free and opensource software – jHFSplus, based on HFSExplorer and jpfm – can be used to mounting hfs/hfs+ partitions as read-only virtual folders.

A freeware plugin for Total Commander
Total Commander
Total Commander is an Orthodox File Manager software for Windows, Windows CE, and Windows Mobile. Some features include a built-in FTP client, file compare, archive file navigation, and a versatile multi-rename tool with regular expression support....

exists, that can read, amongst others, HFS and HFS+ filesystems.

External links

  • hfsexplorer - Open Source Explorer for MS-Windows® written in Java, with support for HFS, HFS+, and HFSX
  • Apple "legacy" Technote 1150 - HFS Plus Volume Format
  • Apple "legacy" Technote 1189 - The Monster Disk Driver Technote
  • hfsdebug - A debugger for HFS Plus volumes by Amit Singh
  • hfsprogs - Userspace support tools for HFS+ filesystems under Linux systems (adapted from Apple's native tools).
  • iBored - A disk editor and viewer supporting HFS Plus



The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK