Further Reading New file system spotted in macOS Sierra [Updated]

Though the feature wasn’t mentioned in Apple’s WWDC 2016 keynote, I’m most excited about the introduction of the Apple File System, or APFS. The preliminary version of the developer documentation is online now, and it looks like the new file system introduces a whole boat-load of solid features—including a few out of the ZFS playbook.

APFS looks to be a major update over Apple’s old and creaky HFS+ file system, which has been around in one form or another for decades. It has been the subject of expansions and additions over the years, but HFS+ never approached the extensibility and flexibility of current next-generation file systems. Rather than continuing to bolt stuff onto the old code, we now (finally!) get a new file system that has some truly compelling features.

First, the caveats

But before we get into the good stuff, let’s real quick talk about the bad stuff—or, at least, the "this is still in development so here’s what doesn’t quite work" stuff. Apple’s documentation notes that because APFS is still a developer preview, you cannot use an APFS volume as a startup disk. You also can’t use it as a Time Machine volume or part of a Fusion Drive configuration, nor can you use File Vault encryption on it.

Perhaps most importantly, the file system currently is case-sensitive, and this cannot be disabled. HFS+ breaks with most Unix-y file systems in that it can be configured to not use case sensitivity; in fact, running OS X—ahem, macOS, sorry—with case-sensitive HFS+ can lead to its own problems. But, for now, if you want to use APFS, you’re going to do so on a non-startup volume, and you’re going to have to deal with case sensitivity.

In light of the current limitations, Apple recommends you test APFS on an external volume that doesn’t contain anything important. You can get started with the hdiutil utility—presuming you've got access to Sierra.

The first fun bits

APFS also adds a copy-on-write metadata scheme

The documentation lists a number of characteristics of the file system. To start, it shows that APFS is based around inodes, with 64-bit inode numbering support. It also massively increases the granularity of object time-stamping: APFS supports nanosecond time stamp granularity rather than the 1-second time stamp granularity in HFS+. Nanosecond timestamps are important in a modern file system because they help with atomicity—in a file system that keeps a record of writes, having nanosecond-level granularity is important in tracking the order of operations.

APFS also adds a copy-on-write metadata scheme that Apple calls "Crash Protection," which aims to ensure that file system commits and writes to the file system journal stay in sync even if something happens during the write—like if the system loses power.

There are a few other neat things in the first section of documentation, including support for sparse files, TRIM support (presumably for Apple and non-Apple SSDs alike by default), Extensible Block Allocation support for lazily initializing data structures as needed on a huge disk instead of having to set everything up at once, and, interestingly, mandatory use of SMB for sharing APFS volumes over a network. AFP is not supported for APFS sharing. And, lest we forget our roots, the documentation notes that APFS has built-in support for extended object attributes, which should help if you still have some need of resource forks.

The more exciting stuff

The new file system offers an improvement over Apple’s previous full-disk encryption File Vault application. For one, APFS supports encryption natively instead of through File Vault. There are three modes of operation: no encryption, single-key encryption, and multi-key encryption with per-file keys and another key for sensitive metadata. Both AES-XTS and AES-CBC cipher variants are supported, "depending on hardware." This lets you apply an adaptable amount of encryption depending on what your security needs might be—from "I don’t care" to "I don’t want anyone swiping the disk out of my computer" up to "NO ONE ELSE MUST KNOW MY SECRETS."

NO ONE ELSE MUST KNOW MY SECRETS

Write coalescing finally makes an appearance on Apple hardware. Long a staple of enterprise disk arrays, this feature gives the file system some latitude in committing data to disk, taking a bunch of short potentially unrelated writes and combining them together into one longer write that more efficiently uses the physical storage beneath it.

A feature called "fast directory sizing" is purported to give macOS a fast way to query the size of a directory and all its child objects, rather than having to wait while a bunch of stat calls complete.

The most exciting stuff

Snapshots and clones both are going to be available in APFS. Snapshots let you throw off a read-only instance of a file system at any given point in time; as the file system’s state diverges away from the snapshot, the changed blocks are saved as part of the snapshot. This is similar in concept to Microsoft’s shadow copies, and it’s an incredibly handy feature. There are obviously huge implications here in how Time Machine works—a true file system set of snapshots could totally replace the kludgy and aging mechanism of hard links that Time Machine builds and maintains.

Snapshots and clones both are going to be available

Clones differ from snapshots in that clones are writable instead of read-only. According to the documentation, APFS can create file or directory clones—and like a proper next-generation file system, it does so instantly, rather than having to wait for data to be copied. A cloned file or directory stores the changes made between it and the original objects, giving you a writable, editable, point-in-time copy of a file or a directory. As the documentation points out, this is an easy way to create document revisions or do versioning of anything you might want to track.

Also interesting is the concept of "space sharing," where multiple volumes can be created out of the same chunk of underlying physical space. This sounds on first glance a lot like enterprise-style thin provisioning, where you can do things like create four 1TB volumes on a single 1TB disk, and each volume grows as space is added to it. You can add physical storage to keep up with the volume’s growth without having to resize the logical volume.

First chance to see

Devs at WWDC are getting their hands on APFS today, and the first formal session walking through the technology is tomorrow, so we’re expecting lots more news to bubble up over the next couple of days. We’re also keenly interested in getting our hands on the tech and putting it through its paces—that’ll have to wait until the developer preview of macOS Sierra becomes available to us, but we’ll start diving in as soon as we can.