What Is APFS (Apple's File System for macOS)?

APFS is used on macOS, iOS, watchOS, and tvOS

Generic SSD rendering

 Wladimir Bulgar / Getty Images

APFS (Apple File System) is a system for organizing and structuring data on a storage system. APFS originally released with macOS Sierra replaces the 30-year-old HFS+.

HFS+ and HFS (a slightly earlier version of the Hierarchical File System) was originally created back in the days of floppy disks, which were the primary storage medium for the Mac when spinning hard drives were an expensive option offered by third parties.

In the past, Apple has flirted with replacing HFS+, but APFS which is already included in iOS, tvOS, and watchOS, is now the default file system for macOS High Sierra and later.

APFS Is Optimized for Today and Tomorrow's Storage Technology

HFS+ was implemented when 800 kb floppies were king. Current Macs may not be using floppies, but 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 just doesn't make a lot of sense.

APFS is designed from the get-go for SSD and other flash-based storage systems. Even though APFS is optimized for how solid-state storage works, 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 system object can be anything; a file, a folder. With a 64-bit inode, the APFS could hold roughly 9 quintillion file system objects blasting past the old limit of 2.1 billion.

Nine quintillion may seem like a pretty big number, and you may rightly ask what storage device is going to have enough space to actually 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 that move data between a high-performance SSD and a slower, but much larger, hard drive. Frequently accessed data was kept on the fast SSD, while files used less often were stored on the hard drive.

With macOS, Apple extended this concept by adding iCloud-based storage to the mix. Allowing movies and TV shows you've already watched to be stored in iCloud freeing up local storage. While this last 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 may be moving in; 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 especially fast but also saves on storage space needs.
  • Snapshots – APFS can create a volume snapshot that represents a point in time. Snapshots can be used to facilitate efficient backups as well as 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 will be 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 will allow 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 new 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 files system updated to point to the new data. This ensures that if for any reason, such as a power failure, or some type of 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 actually needed. In non-sparse file systems, the file space must be reserved in advance, even when no data is ready to be stored.