Apple File System (APFS) and what you need to know!

APFS is Apple's next-generation File System for Apple Watch, iPhone, iPad, and Mac.

Updated March, 2017: APFS is now live for everyone as part of the iOS 10.3 general release.

APFS is the Apple File System. It was introduced at WWDC 2016 and, starting this year, it will replace the existing HFS+ file system on Apple Watch, Apple TV, iPhone, iPad, MacBook, iMac, and Mac Pro.

Apple made a developer preview available for macOS Sierra back at WWDC and, with iOS 10.3, Apple's released APFS to every modern iPhone and iPad owner on the planet as well. Yeah, pedal to the metal.

Most of us don't need to know much about Apple File System. It's an implementation detail that will be largely transparent as it rolls out. Any future features it enables, like smarter backups and faster updates, and things we haven't even thought about yet, will no doubt get marketed all on their own anyway. For them, APFS will likewise be an implementation detail as well.

For anyone interested in file systems, though, there's a lot in APFS to find interesting.

Why is Apple replacing HFS+?

HFS+ has been around since 1998 — almost twenty years ago — and has been updated and McGyver'd in almost every way imaginable since then in order to try and keep up with the demands of modern computing.

Since then we've gone from the Mac to iPhone, Apple TV, iPad, and Apple Watch, from a few million devices to over a billion devices, and from kilobytes and megabytes of data to gigabytes, terabytes, and beyond.

We've also gone from hard drive platters to solid state disks, from physical installs to digital downloads, and from manual backups to Time Machine and iCloud. We've gone from rigid, single-threaded data structures to more flexible approaches.

Through it all, HFS+ and its valiant crew have kept it running. Running in the red, maybe, held together with bubblegum and paperclips, but running.

But running in the red is no way to get to the future. For that, you need something new.

Sometimes, to make it to the future, you need a fresh approach.

What makes APFS more consistent?

While HFS+ runs on all of Apple's current devices, from Apple Watch to Mac Pro, there are differences in how it's been implemented across those devices, including key areas like encryption. That means different source code and separate maintenance and development.

APFS was designed to scale more consistently across Apple's platforms, now and into the future. That should allow for a single code base with fewer resources need to develop and maintain it and allow it to grow faster and better.

Will APFS be faster?

A great deal of speed has to do with perception. It's faster to reach for a drink on the table next to you than to have to get up and go get it from the fridge. APFS does several things to make Apple devices feel faster.

APFS, for example, focuses on low-latency. So, it prioritizes things like app launches and data delivery. That should minimizing beach balls and spinners.

It also does fast directory re-sizing, which means you shouldn't have to wait to see how big a directory is, if you're in the habit of looking.

How does APFS better suit SSDs?

Apple says APFS has been written with solid state storage in mind. That's the flash storage chips inside Apple Watch, Apple TV, iPhone, iPad, MacBooks, and high-end Mac desktops.

What Apple means by this is that APFS writes in a way optimized for solid state, and supports the TRIM command which is helpful for people who delete a lot of files and like to keep a lot of space free.

Snapshots and clones... What about the snapshots and clones?

Two of the most high-profile features of APFS are snapshots and clones.

Snapshots create a read-only copy of the system at that single point in time. It's initially more space-efficient, because it doesn't duplicate any data until changes begin to be made. It also means changes can be reverted.

Clones are copies of "files" (both real files and the Mac's bundled folders-as-files). They're similarly more space-efficient at first, also not duplicating data until changes are made.

This makes creating both snapshots and clones far faster and more efficient than making traditional copies.

Will APFS help with storage space

For macOS users who employ partitions, AFS fixes a long-standing limitation. Basically, APFS sidesteps the issue of one partition running out of space when there's free space elsewhere on the drive by creating a container around all the partitions. If a partition needs more space it can claim it from the container, regardless of whether or not that space is physically adjacent to the partition.

Questions remain about how APFS will handle recovering storage from deleted files that have been cloned, though, since space can't be reclaimed as long as a single clone still exists.

APFS also supports sparse files, so storage is only allocated when it's really needed.

What about data integrity and crash protection?

APFS has atomic-level save state. That has to do with how it handles committing writes for files — they're either verified as completed or it appears as though they never happened at all. In other words, files use copy-on-write so a new version is created and the old version only released when the save is successful.

There are also checksums on metadata, though not on user-data.

APFS is better for encryption, though, right?

Apple makes security and privacy first-class, public facing, top-down features for their products and APFS is no different. Unlike current implementations, where macOS has disk-level encryption and iOS has file-level encryption, thanks to differences in implementation and hardware capabilities, APFS has a more consistent single-key and multi-key implementations for system-level, file level, and even specific data and metadata.

The type of encryption can vary between AES-XTS and AES-CBC depending on hardware.

Is APFS missing anything?

APFS is in its first generation, and that means not everything is included yet. Things like compression aren't yet available, which feels like an obvious next step. Likewise checksums on data. (Though Apple seems to believe Error Correction Code — ECC — on modern flash storage currently handles that well enough.)

While iOS is now public, APFS for Mac is still in beta and there are several things you can't yet do with it:

  • Startup disks
  • Time Machine
  • FileVault
  • Fusion Drive

Will APFS be open sourced?

APFS is not currently open source. Over the years, Apple has either kept open and continued to contribute to, or themselves open sourced, the Mach Kernel, WebKit, LLVM, and Swift, among other projects.

Whether that will eventually include APFS we'll have to wait and see.

Should you use APFS?

If you've updated to iOS 10.3, you're on APFS. iOS is well contained and controlled environment, so it makes sense for Apple to start there. No transition is 100% safe, but iOS is as safe as they come.

If you're on the macOS Sierra beta, you can play around with APFS but the limitations listed above make it a relatively small playground. Just don't trust any important data to any APFS volumes until it's out of beta and into release.

Where can you learn more about APFS?

For more on the Apple File System, check out these resources: