HFS+ and HFS (an earlier version of the Hierarchical File System) were created in the days of floppy disks, the primary storage medium for the Mac back when spinning hard drives were an expensive option offered by third parties. Apple flirted with replacing HFS+ over the years. Eventually, APFS, which is already included in iOS, tvOS, and watchOS, became the default file system for Macs running macOS High Sierra and later.

Optimized for Modern Storage Technology

HFS+ was implemented when 800 KB floppies were king. Current Macs don’t use floppies, and spinning hard drives are beginning to seem just as archaic. With Apple emphasizing flash-based storage in all of its products, a file system optimized to work with rotational media and the inherent latency in waiting for a disk to spin around no longer make a lot of sense. Apple-designed APFS from the get-go for SSD and other flash-based storage systems. Even though APFS is optimized for solid-state storage, it performs well with modern hard drives.

Future-Proofing

APFS supports a 64-bit inode number. The inode is a unique identifier that identifies a file system object — a file or a folder. With a 64-bit inode, the APFS can accommodate roughly 9 quintillion file system objects blasting past the old limit of 2.1 billion. Nine quintillion is a big number, and you may rightly wonder what storage device is going to have enough space to hold that many objects. The answer requires a peek into storage trends. Consider this: Apple has already started moving enterprise-level storage technology to consumer-level products, such as the Mac and its ability to use tiered storage. This was first seen in fusion drives, which move data between a high-performance SSD and a slower, but much larger, hard drive. Frequently accessed data is kept on the fast SSD, while files that are used less often are stored on the hard drive. With macOS, Apple extended this concept by adding iCloud-based storage to the mix. Allowing users to store movies and TV shows they’ve already watched in iCloud frees up local storage. While this example doesn’t require a unified inode numbering system across all the disks in use by this tiered storage system, it does show a general direction Apple is moving to bring together multiple storage technologies that best fit the needs of the user and have the OS see them as a single file space.

APFS Features

APFS has a number of features that set it apart from older file systems.

Clones: Clones allow almost instantaneous file copies without using additional space. Instead of copying a file bit by bit from one location to another, clones instead reference the original file, sharing the blocks of data that are identical between the two files. Make changes to one file, and only the block of data that has changed is written to the new clone, while both the original and the clone continue to share unchanged blocks of data. This not only makes file copying and saving exceptionally fast but also saves on storage space needs. Snapshots: APFS can create a volume snapshot that represents a point in time. Snapshots facilitate efficient backups and allow you to go back to how things were at a particular point in time. Snapshots are read-only pointers to the original volume and its data. A new snapshot takes up no real space, other than the amount of space needed to store a pointer to the original volume. As time goes by and changes are made to the original volume, the snapshot is updated with only the changes that occur. Encryption: APFS supports strong full disk encryption using AES-XTS or AES-CBC modes. Both files and metadata are encrypted. Supported encryption methods include:Clear (no encryption) Single-key Multi-key, with per-file keys for both data and metadata Space Sharing: Space sharing puts an end to predefining partition sizes. Instead, all volumes share the underlying free space on a drive. Space sharing allows multiple volumes on a drive to grow and shrink dynamically as needed, without any need to repartition. Copy-On-Write: This data protection scheme allows data structures to be shared as long as no change is made. Once a change is requested (write), a new unique copy is made, ensuring the original is left intact. Only after the write is completed is the file information updated to point to the latest data. Atomic Safe-Save: This is similar to the idea of copy-on-write but applies to any file operation, such as renaming or moving a file or directory. Using rename as an example, the file that is about to be renamed is copied with the new data (the file name). Not until the copy process is complete is the file system updated to point to the new data. This ensures that if for any reason — such as a power failure or CPU hiccup — the write isn’t completed, the original file remains intact. Sparse Files: This more efficient way of allocating file space allows file space to grow only when needed. In non-sparse file systems, the file space must be reserved in advance, even when no data is ready to be stored.