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

APFS Will Be Included on macOS, iOS, watchOS, and tvOS

Generic SSD
APFS is optimized for use with SSD's. Wladimir Bulgar | Science Photo Library | Getty Images

The new macOS Sierra made a number of changes in managing a Mac's storage. Perhaps the biggest announcement was the hint at a new file system, APFS (APple File System), to replace the 30-year-old HFS+ that we all know and put up with.

HFS+ and HFS (a slightly earlier version of the Hierarchical File System) was an update to the MFS (Macintosh File System) that originally shipped with the Mac in 1984.

Both file systems were 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 seems like it’s the real deal. Here's why.

Optimized for Today and Tomorrow's Storage Technology

Did I mention 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 will perform quite well with modern hard drives as well.

Used on All Apple Devices

APFS will be the default on all Apple products that need to store data, and so far, that's every last one of them. That means APFS will be the file system for iOS, watchOS, tvOS, and of course, macOS. In the future, if Apple develops a new product line with the phrase OS in it, expect to see APFS as the file system.

Future Proofing

The new file system 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. HFS+ limits the number of file objects to 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 the future. 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 moved data between a high-performance SSD and a slower, but much larger, hard drive as needed. Frequently accessed data was kept on the fast SSD, while files used less often were stored on the hard drive.

With macOS Sierra, Apple extended this concept by adding iCloud-based storage to the mix. Allowing movies and TV shows you've already watched be stored in iCloud frees 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

I've already mentioned the support for 9 quintillion files on a single volume, so I think it's safe to assume our storage volumes aren't going to run out of inode numbers. But Apple has a few more tricks up its sleeve, to both ensure there's plenty of room, and to maximize performance of the file system.

  • Clones – If you've ever copied a large file, you've seen how long it can take. 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. A snapshot, then, is a record of changes that occurred to the original volume.
  • Encryption – The new file system will have strong full disk encryption using AES-XTS or AES-CBC modes. Both files and metadata will be encrypted. Supported encryption methods will include:
    • Clear (no encryption).
    • Single-key.
    • Multi-key, with per-file keys for both data and metadata.
  • Space Sharing – If you've ever tried to repartition a Mac's drive, you'll appreciate space sharing. Space sharing will put an end to predefining partition sizes; instead, the underlying free space on a physical volume is shared by all file systems. 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 are the directory structure and inode information updated to point to the new data. With APFS, copy-on-write is block oriented; only the data blocks that are changed within a file need to be copied.
  • Atomic Safe-Save – This is similar to the idea of copy-on-write but applies to any file operation, such as a 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 are the directory and inode data 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. The non-sparse system uses file space even if the file is empty.

When Will APFS Be Available?

Apple includes support for APFS with macOS Sierra and later. With Sierra, the APFS system isn't actively used; that is, you won't see any options for turning APFS on, or for using it for any of your drive volumes. HFS+ remains the default for macOS Sierra.

You can, however, experiment with APFS by using the Terminal app and the diskutil command. You can find a bit more information about using diskutil and APFS at the Apple developer site.

Before you try out APFS, make sure you're using a drive you can spare; do not mix APFS and other file systems on a single drive at this time. Also, be aware that the APFS code in macOS Sierra is beta, and like any beta software, can have bugs that could lead to unexpected results, such as crashing your Mac or losing stored data.

Apple plans a release of APFS sometime in 2017. I suspect we'll see the release of APFS alongside macOS 10.13, whenever that comes about.