HFS Plus
From Wikipedia, the free encyclopedia
HFS+ | |
---|---|
Developer | Apple |
Full name | Hierarchical File System Plus |
Introduced | January 19, 1998 (Mac OS 8.1) |
Partition identifier | Apple_HFS (Apple Partition Map) 0xAF (MBR) Apple_HFSX (Apple Partition Map) when HFSX 48465300-0000-11AA- AA11-00306543ECAC (GPT) |
Structures | |
Directory contents | B*-tree |
File allocation | B*-tree |
Bad blocks | B*-tree |
Limits | |
Max file size | 16 EiB |
Max number of files | Unlimited |
Max filename size | 255 characters |
Max volume size | 16 EiB |
Allowed characters in filenames | Unicode, any character, including NUL. OS APIs may limit some characters for legacy reasons |
Features | |
Dates recorded | Creation, modified, backed-up, access, changed |
Date range | January 1, 1904 - February 6, 2040 |
Forks | Yes |
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 | Unix permissions, ACLs (Mac OS X v10.4 onward) |
Transparent compression | No |
Transparent encryption | Per-home directory AES using HFS+ formatted .dmg volumes (FileVault in Mac OS X v10.3 onward) |
Supported operating systems | Mac OS 8, Mac OS 9, Mac OS X, some Linux |
HFS Plus or HFS+ is a file system developed by Apple Computer to replace their Hierarchical File System (HFS) as the primary file system used on Macintosh computers. It is also one of the formats used by the iPod digital music player. HFS Plus is the name used by developers, but in user documentation the format is referred to as Mac OS Extended. 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 (instead of Mac OS Roman) for naming the items (files, folders). HFS Plus permits filenames up to 255 UTF-16 characters in length, and n-forked files similar to NTFS, though almost no software takes advantage of forks other than the data fork and resource fork. 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 they started to approach the 1 GB mark, it meant that the smallest amount of space that any file could occupy (a single allocation block) became excessively large, wasting significant amounts of disk 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.
Like HFS, HFS Plus uses B*-trees to store most volume metadata.
Contents |
[edit] History
HFS Plus was introduced with the January 19, 1998 release of Mac OS 8.1. However its first appearance, as a beta filesystem, was in the never-released Copland OS betas.
With the release of the 10.2.2 update on November 11, 2002, Apple added optional journaling 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 support case sensitivity for file and folder names. HFSX volumes can be recognised by two entries in the Volume Header, a value of HX in the signature field and 5 in the version field.
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, but always marked as "reserved for future use". Until the release of Mac OS X Server 10.4, HFS Plus only supported the standard UNIX file system permissions, however 10.4 introduced support for access control list-based file security, which is designed to be fully compatible with the file permission system used by Microsoft Windows XP and Windows Server 2003.
While the HFS Plus format provides for almost limitless capacity, the various Mac OS versions support only a subset of it:
Mac OS | files per folder | max. file size | max. volume size |
---|---|---|---|
Mac OS 8 | 32767 (2^15) | 2 GiB | 2 TiB |
Mac OS 9 | 32767 (2^15) | 2 TiB | 2 TiB |
Mac OS X 10 & 10.1 | 2^31 | 2 TiB | 2 TiB |
Mac OS X 10.2 | 2^31 | 8 TiB | 8 TiB |
Mac OS X 10.3 & 10.4 | 2^31 | 16 TiB | 16 TiB |
HFS Plus | unlimited | 16 EiB | 16 EiB |
The maximum number of files or folders within a folder is further limited by the maximum volume size divided by the block size.
More information on limitations can be found in file system comparison.
[edit] 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.
Typically an HFS Plus volume is embedded inside an HFS Wrapper, although this is becoming less prevalent. 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, bootable HFS volume with a read-only file called Where_have_all_my_files_gone?, explaining to users with versions of the Mac OS 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:
- Sectors 0 and 1 of the volume are HFS boot blocks. These are identical to the boot blocks in an HFS volume. They are part of the HFS wrapper.
- 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.
- 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, 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.
- The Catalog File is a B*-tree 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 names in HFS Plus). A record in the HFS Catalog File is 512 bytes in size, a record in the HFS Plus Catalog File is 4KB in Mac OS and 8KB 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.
- The Extents Overflow File is another B*-tree 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.
- The Attributes File is a new B*-tree 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.
- 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.
- The second to last sector contains the Alternate Volume Header equivalent to the Alternate Master Directory Block of HFS.
- The last sector in the volume is reserved for use by Apple. It is used during the computer manufacturing process.
[edit] See also
[edit] External links
- Apple Technote 1150 HFS Plus Volume Format
- Apple Technote 1189 - The Monster Disk Driver Technote
- HFS+: Taking a walk in the orchard - A critical view of HFS Plus
Applications
Address Book • Automator • Backup • Calculator • Chess • Dashboard • Dictionary • DVD Player • Finder • Front Row • Grapher • iCal • iChat • iSync • iTunes • Mail • Photo Booth • Preview • QuickTime Player • Safari • Sherlock • Stickies • TextEdit
Utilities
Activity Monitor • AirPort Admin Utility • Audio MIDI Setup • Bluetooth File Exchange • BOMArchiveHelper • Classic • ColorSync Utility • Console • Crash Reporter • DigitalColor Meter • Directory Access • DiskImageMounter • Disk Utility • Font Book • Grab • Help Viewer • Image Capture • Installer • Internet Connect • Keychain Access • Migration Assistant • NetInfo Manager • Network Utility • ODBC Administrator • Printer Setup Utility • Software Update • System Preferences • System Profiler • Terminal • Universal Access • VoiceOver • X11
Technology & User interface (future features italicized)
⌘ • ⌥ • Apple Advanced Typography • AppleScript • Aqua • ATSUI • Audio Units • Bonjour • Boot Camp • Carbon • Cocoa • ColorSync • Core Animation • Core Audio • Core Data • Core Foundation • Core Image • Core Video • CUPS • Darwin • Exposé • FileVault • Inkwell • icns • Keychain • Mach-O • OpenGL • plist • Quartz • QuickTime • Rosetta • Smart folder • Spaces • Spotlight • Time Machine • Uniform Type Identifier • Universal binary • WebKit • Xgrid • XNU
Applications |
---|
Apple File Security · Calculator · Chooser · Drive Setup · DVD Player · Finder · Graphing Calculator · Keychain Access · PictureViewer · QuickTime Player · Sherlock · Software Update · Stickies · Apple System Profiler · SimpleText |
Developer |
Technology |
Command (⌘) · Option (⌥) · AppleScript · Code Fragment Manager · Control Strip · Creator code · Hierarchical File System · HFS Plus · Keychain · Macintosh File System · PICT · QuickDraw · QuickTime · Resource fork · Type code · WorldScript |
Related articles |