A Look Inside Your Mac: What You Need to Know about HFS+

There is nothing more tedious than waiting for a sluggish gadget, so, no wonder that from pricey Apple products, apart from aesthetically pleasing look and varied functionality, we naturally expect speedy and smooth performance. In order to meet users’ requirements, it must be able to access tremendous amounts of data in the blink of an eye, which is, in essence, just scores of meaningless nulls and zeros stored on the hard drive or SSD. Certain logic has to be applied to transform these digits into files, which, in turn, are to be organized so efficiently that the operating system could instantly find any whenever it is needed. This is exactly what HFS+, the major Apple’s file system, is in charge of – serving as an interface between a physical storage device and the OS. You are likely to have come across it, for instance, when formatting a new drive in Disk Utility, but it is actually hardly surprising if you didn’t: a file system is pretty well hidden from ordinary Apple users. Nevertheless, but for it, none of your Mac, iPhone, iPad or even your Apple Watch would be able to store and access your stuff.

HFS+, which stands for the Hierarchical File System Plus and is also referred to as Mac OS Extended, is a slightly improved version of the earlier Hierarchical File System Standard that came along in the early days of personal computing and thus wasn’t designed to be able to handle storage media of large capacity. That is why HFS+ was introduced by Apple in 1998 with the release Mac OS 8.1 and has been used by default ever since. Although the Cupertino company has already announced their new next-generation APFS file system, which is meant to entirely replace this almost two-decades-old tech, currently, HFS+ can still be found on the internal partitions of most devices running macOS, iOS, tvOS and watchOS. Also, to avoid compatibility issues, some external drives that are frequently used in the Apple environment are formatted with HFS+ as well.

Advertisement

Volumes formatted with HFS+ are typically divided into logical blocks of 512 bytes each, which are then grouped into allocation blocks. A file will occupy at least one allocation block, even if its size is much smaller (the remaining space will be just wasted). Contiguous allocation blocks that belong to a file are grouped into extents. Each extent has a starting block and a block count, which indicates the number of blocks it consists of. HFS+ is seeking to maintain the integrity of all your data and reduce file fragmentation, therefore, for larger files, it unites all allocation blocks belonging to a file into a clump of a fixed size.

To organize all your files and be able to quickly access any of them, HFS+ employs a special complicated structure called a B-tree (balanced tree), which is comprised of a series of nodes of different types: “leaf” nodes are where all the data resides, “index” nodes contain only keys and pointers, “map” nodes store information about which nodes of the tree are in use and which of them are free, while a “header” node is the first node of the tree keeping all crucial information about it. Each of the nodes contains a number of records and its own descriptor indicating its type, how many records it contains, where it belongs in the tree and links to the previous or next nodes. All records store some data (their actual contents depend on the particular type of the node) and are identified by their own unique keys, which help to promptly locate them via search.

The most crucial components of HFS +, with the help of which it keeps track of all the data stored on a volume, are implemented as special system files that are hidden from the user and cannot be accessed through the standard system interface. They include the Volume Header (contains all important information about the volume as a whole and its structure, the Catalog File (maintains all the information about the location of all files and folders within a volume and indicates their hierarchy), the Extents File (contains pointers to additional extents for files that require more than eight contiguous groups of blocks); the Attributes File (contains all custom file attributes); the Allocation File (provides a map of used and unused blocks in the volume) and the Startup File (holds information required at boot time).

Advertisement

In spite of its advanced age, HFS+ can boast the following strong points:

Better space management

HFS+ allows utilizing disk space more efficiently, especially on large volumes. As has been previously mentioned, even the tiniest file needs to occupy at least one allocation block on the disk. In comparison to HFS, to address a single block HFS+ uses 32 bits rather than 16 bits thus significantly increasing the maximum number of files which can be stored by the system. As the minimum amount of space that a file must take up is smaller, less room gets just frittered away. Moreover, HFS+ is theoretically able to manage files and volumes of up to just over a million terabytes.

Advertisement

Journaling

Journaling is enabled by default on all new volumes formatted with HFS+. The journal keeps a record of all changes to files stored on the disk and makes it possible bring the system back to the last known “healthy” state in case of its abrupt shutdown, which may happen due to a power outage or any other failure. This helps to avoid the corruption of a volume and a lengthy check-and-repair process.

Advertisement

Hard links

Any file in HFS+ can have a number of physical references to it. These references are called hard links. They allow creating copies of the same file in different places without actually duplicating its content. At first sight, such a link is no different from an average file and even shares the same file type with the original one, but as it just points to the contents of the original file and is not really a separate file, it takes up no additional space on the disk. However, when the contents of a file get modified, the change will be seen in both the original file and its “hard link” files.

Advertisement

On-the-fly defragmentation

If an opened file satisfies certain conditions, the system will attempt to perform its defragmentation by looking for a contiguous sequence of blocks for this file. A successful reallocation procedure will result in a file being defragmented.

Advertisement

Hot file clustering

HFS+ constantly monitors which files are frequently accessed by the OS, defragments these files and moves them to a special “hot” zone on the drive. The operating system can communicate with this zone much faster than with other parts of the storage and this results in improved performance.

Advertisement

Permissions

HFS+ supports file permissions, which enables the administrator to restrict the rights of particular users or user groups to read and or write certain files within a certain folder.

Advertisement

Disk quotas

HFS+ supports volume-level quotas which allows limiting the amount of disk space used by a certain user or user group and even define the maximum number of files they can store on the drive.

Advertisement

Compression

HFS+ gives the user the ability to economize storage space by compressing certain files.

Advertisement

Nevertheless, despite having been incrementally improved over the years, the technology underlying this file system is seriously old and has a bunch of critical shortcomings:

Performance and speed

HFS+ was introduced back in the era of Mac OS Classic when Apple’s state of the art computers had 16-bit processors and hard drives with the capacity of about 6GB. Things are really different now, with some modern Macs supporting 12-core CPUs 256 bits wide each and up to 3 TB SSDs. Apparently, a file system that was intended for such slow computers and small disks is simply not able to make full use of enormously large amounts of resources the present-day machines can provide. That actually means that, no matter how powerful the hardware is, with such an outdated file system you won’t be able to utilize all its potential and your computer will always feel sluggish.

Advertisement

No sparse file support

Sparse files allow a file system to use the storage space much more efficiently in case a mostly empty file needs to be stored. The matter is that such files contain a lot of zeros which consume storage space the same way as “real” data. Storing these zeros does not present a problem when files themselves are considerably small, but with large files that contain huge areas of empty space, a lot of precious space gets wasted. Modern file systems the support for sparse files store them in a way that is different from regular files: only the “real” data is written to the disk, while those zeros are returned only when they are needed for a certain application so that a sparse file should appear like a regular one.

Advertisement

Data integrity

Over time data stored on the hard disk drive or SSD is likely to degrade and become corrupted, which may result in a certain file, directory or even the entire disk becoming unreadable. Modern file systems can guarantee data integrity through the use of checksums: when the damaged file is accessed, the file system detects the corruption and throws an error. HFS+ doesn’t employ checksums, so the corruption is very likely to go unnoticed. Over time, it can even spread to your backups and it may be too late to do anything about it when the mishap is finally discovered. Lost data can always be recovered with the help of a quality data recovery utility, but if it gets overwritten (and it eventually will), even the most advanced tools cannot remedy the problem.

Advertisement

In fact, HFS+ lacks a lot in comparison to most modern file systems, such as snapshots, data deduplication, transactional updates and so on and so forth, and since the file system uses some rigid data structures, it is practically impossible to keep adding new features to it without breaking compatibility. That is why the Apple company decided to make a fresh start with the APFS file system. However, as this replacement of HFS+ is not coming for general release until this fall, HFS+ is still deployed on most macOS, iOS, tvOS and watchOS devices. Linux OS is also able to support this file system with correct permissions, while Windows can only read HFS+-formatted drives, at least without special third-party software.

If you want to check which file system your drive is currently formatted with, the first thing you should do is go to Applications > Utilities, which can be found through the Finder, and launch Disk Utility. On the left, you will see a list of available drives. Choose the one you want to examine and click on the Partition tab you’ll find in the main window. There you will see the name and the format of the drive under the Volume Information header. If the Format field says Mac OS Extended, Mac OS Extended (Journaled), Mac OS Extended (Case-Sensitive, Journaled) or Mac OS Extended (Case-Sensitive), you have HFS+.

Advertisement

Overall, one must admit that HFS+ has extraordinarily aged and sooner or later it must pass from this world, but before rushing to upgrade your boot drive to APFS, you’d better think twice: for all noteworthy improvements it offers, like any new technology, it needs to be thoroughly field-tested and fine-tuned before being able to prove trustworthy and reliable.

Share This Story

Get our newsletter