This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Hierarchical File System" Apple – news ·newspapers ·books ·scholar ·JSTOR(July 2020) (Learn how and when to remove this message) |
Developer(s) | Apple Computer |
---|---|
Full name | Hierarchical File System |
Introduced | September 17, 1985; 39 years ago (1985-09-17) withSystem 2.1 |
Preceded by | MFS |
Succeeded by | HFS Plus |
Partition IDs | Apple_HFS (Apple Partition Map)0xAF (MBR)HFS and HFS+ |
Structures | |
Directory contents | B-tree |
File allocation | Bitmap |
Bad blocks | B-tree |
Limits | |
Max volume size | 2 TB (2 × 10244 bytes) |
Max file size | 2 GB (2 × 10243 bytes) |
Maxno. of files | 65535 |
Max filename length | 31 characters |
Allowed filename characters | All 8-bit values except:. Discouragednull and non-printing characters. |
Features | |
Dates recorded | Creation, modification, backup |
Date range | January 1, 1904 – February 6, 2040 |
Date resolution | 1s |
Forks | Only 2 (data andresource) |
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 |
Transparent compression | Yes (third-party);Stacker,AutoDoubler, TimesTwo,Now Compress,StuffIt SpaceSaver, Alysis Software products (SuperDisk!, More Disk Space, The Alysis Disk Expander and eDisk), AutoSqueeze |
Transparent encryption | No |
Other | |
Supported operating systems | Classic Mac OS,macOS,GS/OS,Linux,Microsoft Windows (through MacDrive orBoot CampIFS drivers)[citation needed] |
Hierarchical File System (HFS) is aproprietaryfile system developed byApple Inc. for use in computer systems runningMac OS. Originally designed for use onfloppy andhard disks, it can also be found on read-only media such asCD-ROMs. HFS is also referred to asMac OS Standard (orHFS Standard), while its successor,HFS Plus, is also called Mac OS Extended (or HFS Extended).
With the introduction ofMac OS X 10.6, Apple dropped support for formatting or writing HFS disks andimages, which remained supported asread-only volumes untilmacOS 10.15.[1] Starting with macOS 10.15, HFS disks can no longer be read.
Apple introduced HFS in September 1985, specifically to support Apple's firsthard disk drive for the Macintosh, replacing theMacintosh File System (MFS), the original file system which had been introduced over a year and a half earlier with the firstMacintosh computer. HFS drew heavily upon Apple's first operating system with ahierarchical file system,SOS for the failedApple III, which also served as the basis for hierarchical file systems on theApple IIe andApple Lisa. HFS was developed by Patrick Dirks and Bill Bruffey. It shared a number of design features with MFS that were not available in other file systems of the time (such asDOS'sFAT). Files could have multiple forks (normally a data and aresource fork), which allowed the main data of the file to be stored separately from resources such as icons that might need to be localized. Files were referenced with unique file IDs rather than file names, and file names could be up to 31 characters long.
However, MFS had been optimized to be used on very small and slow media, namelyfloppy disks, so HFS was introduced to overcome some of the performance problems that arrived with the introduction of larger media, notablyhard drives. The main concern was the time needed to display the contents of a folder. Under MFS all of the file and directory listing information was stored in a single file, which the system had to search to build a list of the files stored in a particular folder. This worked well with 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.
The solution was to replace MFS's directory structure with one more suitable to larger file systems. HFS replaced the flat table structure with theCatalog File which uses aB-tree structure that could be searched very quickly regardless of size.[2] HFS also redesigned various structures to be able to hold larger numbers, 16-bit integers being replaced by 32-bit almost universally. Oddly, one of the few places this "upsizing" did not take place was the file directory itself, which limits HFS to a total of 65,535 files on each logical disk.
While HFS is a proprietary file system format, it is well-documented; there are usually solutions available to access HFS-formatted disks from most modernoperating systems.
Apple introduced HFS out of necessity with its first 20 MBhard disk offering for the Macintosh in September 1985, where it was loaded into RAM from a MFS floppy disk on boot using a patch file ("Hard Disk 20"). However, HFS was not widely introduced until it was included in the 128KROM that debuted with theMacintosh Plus in January 1986 along with the larger 800 KB floppy disk drive for the Macintosh that also used HFS. The introduction of HFS was the first advancement by Apple to leave a Macintosh computer model behind: the original128K Macintosh, which lacked sufficient memory to load the HFS code and was promptly discontinued.
In 1998, Apple introducedHFS Plus to address inefficient allocation of disk space in HFS and to add other improvements. HFS Plus is still supported by current versions of Mac OS, but starting withMac OS X, an HFS volume cannot be used forbooting, and beginning withMac OS X 10.6 (Snow Leopard), HFS volumes are read-only and cannot be created or updated. InmacOS Sierra (10.12), Apple's release notes state that "The HFS Standard filesystem is no longer supported."[3] However, read-only HFS Standard support continued to work until the release ofmacOS 10.15,[4] ending official support for classic HFS Standard after 35 years.
A storage volume is inherently divided intological blocks of 512 bytes. The Hierarchical File System groups these logical blocks intoallocation 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,535 (216-1).
Five structures make up an HFS volume:
The Catalog File, which stores all the file and directory records in a single data structure, results in performance problems when the system allowsmultitasking, 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.[5] It is also a serious reliability concern, as damage to this file can destroy the entire file system. This contrasts with other file systems that store file and directory records in separate structures (such as DOS's FAT file system or theUnix File System), where having structure distributed across the disk means that damaging a single directory is generally non-fatal and the data may possibly be re-constructed with data held in the non-damaged portions.
Additionally, the limit of 65,535 allocation blocks resulted in files having a "minimum" size equivalent 1/65,535th the size of the disk. Thus, any given volume, no matter its size, could only store a maximum of 65,535 files. Moreover, any file would be allocated more space than it actually needed, up to the allocation block size. When disks were small, this was of little consequence, because the individual allocation block size was trivial, but as disks started to approach the 1 GB mark, 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. This situation was less of a problem for users having large files (such as pictures, databases or audio) because these larger files wasted less space as a percentage of their file size. Users with many small files, on the other hand, could lose a copious amount of space due to large allocation block size. This made partitioning disks into smaller logical volumes very appealing for Mac users, because small documents stored on a smaller volume would take up much less space than if they resided on a large partition. The same problem existed in the FAT16 file system.
HFS saves the case of a file that is created or renamed but is case-insensitive in operation.