HFS+

Introduction:

The Mac OS Extended Volume Hard Drive Format, otherwise known as HFS+, is the file system found on Mac OS 8.1 and later, including Mac OS X. It is an upgrade from the original Mac OS Standard Format known as HFS (HFS Standard), or Hierarchical File System, supported by Mac OS 8.0 and earlier.

Overview:  

Mac OS Extended format (HFS+) is a hard disk format introduced on January 19, 1998, by Apple Inc. to replace their HFS and the primary file system in Macintosh computers and iPod music players.

Up from HFS, HFS+ increases the number of allocation blocks on the disk and decreases the minimum size of a file, thus optimizing the storage capacity of a large hard disk.

Therefore, HFS+ allows for a larger maximum number of files than its' HFS counterpart. Note the difference between HFS and HFS+ in the following example:

Example:

On a 4 GB hard drive, a file containing 4 KB of information would require 64 KB of space with HFS. With HFS+, it would only require 4 KB on the 4 GB hard drive. This is because the HFS allocation block size would be 16 KB and HFS+'s increased number of allocation blocks of the disk and the decreased minimum size of the blocks allows for less wasted space.

HFS+ also supports much larger files than HFS, with 32-bit block addresses as opposed to HFS's 16-bit length.

It uses Unicode to name files, encoded in UTF-16 and normalized to a form similar to Unicode Normalization Form D (NFD).

HFS+ permits file names of up to 255 UTF-16 characters in length and n-forked files. HFS+ uses a 32-bit allocation mapping table, as opposed to HFS's 16-bit table. Also, unlike most other file systems; HFS+ supports hard links to directories. HFS+ uses B-trees to store most volume metadata.

HFS+ File Limits in Mac OS X:  

Volume and File Limits in Mac OS X
Maximum number of volumes: No limit
Maximum number of files and folders in a file: Up to 2.1 billion
Maximum volume size and file size: (Mac OS X v 10.0 – 10.1.5) 2 TB
Maximum volume size and file size: (Mac OS X v 10.2 – 10.2.8) 8 TB
Maximum volume size and file size (Mac OS X v 10.3 – 10.3.9) 16 TB
Maximum volume size and file size (Mac OS X v 10.4 and later) Almost 8 EB

Why HFS+?  

HFS's 16-bit allocation mapping table was a serious limitation for the file system. It meant that HFS could not support more than 65, 536(216) allocation blocks. This problem became apparent as disks became larger and the smallest amount of space that a file could take up became excessively large. With the same idea as Example 1 in mind, even a 1 byte file on a 1 GB disk would require 16 KB of disk space. This is why HFS+ was needed.

Benefits of HFS versus HFS+:  

Typically, the HFS+ file system is better than its predecessor, but there is one case where the Mac OS Standard beats out the Mac OS Extended format. Volumes that are smaller than 32 GB cannot be initialized as Mac OS Extended format. Upon attempting a Drive Setup application, HFS+ will give an "Initialization Failed" message. Floppy disks cannot be initialized with the HFS+ format.

Structures of an HFS+ Volume:  

An HFS+ volume consists of 9 main structures:

  1. Boot Blocks: are found in sectors 0 and 1 and are identical to the boot blocks found in HFS.
  2. Volume Header: is found in sector 2 and is the equivalent to the Master Directory Block in an HFS volume. It stores data about the volume, including the size of allocation blocks, timestamps and the locations of other volume structures such as the Catalog File or Extent Overflow File. It is always found in the same place.
  3. Allocation File: keeps track of which bocks are free and which blocks are in use. Like in the Volume Bitmap in HFS, each allocation block is represented by one bit. A zero bit means the block is free, while a one bit indicates towards a block in use. The Allocation File differs from the HFS Volume Bitmap by being stored as a regular file, not occupying a special reserved space at the beginning of the volume. It can also change in size and does not have to be stored contiguously within a volume.
  4. Catalog File: is a B-tree containing records for all the files and directories stored in the volume, comparable to the HFS Catalog file. Their main difference is that records with HFS+ are larger to allow more fields and allow these fields to be larger. This is seen in the size of the HFS+ Catalog File being 4 KB in Mac OS and 8 KB in Mac OS X, as opposed to the HFS Catalog File, being only 512 bytes in size. Fields in HFS+ also vary depending on the data they store, unlike HFS where the fields are fixed.
  5. Extents Overflow File: is a B-tree that records the allocation blocks that are allocated to each file as extents. Each file in the Catalog File record can record up to eight extents for each fork of a file; additional extents are recorded in the Extents Overflow File. Bad blocks are also recorded as extents here. The default sizes for this file are 1 KB in Mac OS and 4 KB in Mac OS X.
  6. Attributes File: is a B-tree only found in HFS+. It can store three types of 4 KB records: Inline Data Attribute records, Fork Data Attribute records and Extension Attribute records. Their purposes are listed in the table below.
  7. Startup File: is designed for non-Mac OS systems without HFS or HFS+ support; comparable to the HFS volume Boot Blocks.
  8. Alternate Volume Header: is found in the second last sector of an HFS+ volume and is the equivalent of the HFS Alternate Master Directory Block.
  9. Last sector: Is reserved for use by Apple during the computer manufacturing process.

The following is a table of each of the Attribute File records:  

Type of record: Purpose:
Inline Data Attribute records contain 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 Attribute records are used to extend a Fork Data Attribute record when its eight extent records are already used

HFS+ with Mac OS 8.0 and earlier:  

If a Mac OS Extended format volume is connected to a computer running Mac OS 8.0 or earlier, the files will not be visible or accessible, but will still exist. There will be a single document accessible, explaining that the files on the disk are present but inaccessible. Mac OS Extended format volume format volumes can, however, be seen on a computer running Mac OS 8.0 or earlier if the HFS+ file is shared on a network by a computer running Mac OS 8.1 or later.

Overview of HFS+:  

Developer Apple Inc.
Full Name Hierarchical File System Plus
Alternative Names Mac OS Extended File System
HFS Plus
HFS+
Introduced January 19, 1998
Partition Identifier Apple Partition Map Apple_HFS
MBR 0xAF
Apple Partition Map with HFS X Apple_HFSX
GPT 48465300-0000-11AA-AA11-00306543ECAC
Directory Contents B-tree
File Allocation Bitmap
Bad Blocks B-tree
Maximum File Size 8 exabyte
Maximum Number of Files 4 294 967 295
Maximum Filename Length 255 characters
Maximum Volume Size 8 exabyte
Allowed characters in file names Unicode
Dates Recorded Access, attributes modified, backed up, contents modified, created
Date Range January 1, 1904 – February 6, 2040
Date Resolution 1 s
Forks Yes
Attributes Colour (3 bits, all other flags 1 bit), locked, custom icon, bundle, invisible, alias, system, stationery, inited, no INIT resources, shared, desktop
File System Permissions Unix permissions, NFSv4, ACLs (OS X v10.4 onward)
Transparent Compression Yes (OS X 10.6 and higher)
Transparent Encryption Yes (OS X 10.7 and higher)
Supported Operating Systems Mac OS 8.1, Mac OS 9, OS X, & Darwin, Linux, Microsoft Windows

fat32 HFS+

Google+