Photo by Jeff Carlson
When Apple released macOS 10.13 High Sierra in 2017, one of its most notable features was nearly invisible. Installing the update on a Mac with a solid-state drive (SSD)—but not a Fusion drive—automatically switched the underlying file system from Mac OS Extended (also known as HFS+) to APFS (Apple File System).
The file system is the bedrock-level technology that specifies where data is stored—not just in terms of how files and folders are represented in the operating system, but where individual bits are physically stored in the cells of an SSD chip or on the magnetic surfaces of the spinning platters in a mechanical hard disk drive.
There are any number of ways the switch to APFS could have gone wrong, but for most people the shift was seamless—if a bit more time consuming than most macOS upgrades. You may not even have noticed that your Mac is now running APFS. To find out, open Disk Utility, click your startup disk in the sidebar, and look under the disk name.
High Sierra converted my 2016 MacBook Pro when I upgraded and, since nothing blew up, I filed APFS away as another technology shift that Apple managed efficiently. But in the process of writing my just-released book Take Control of Your Digital Storage, I learned why Apple went to all the trouble. APFS offers a few notable automatic benefits and some useful things you can do directly.
What Does APFS Do for Me?
Let’s start with why Apple made the switch from Mac OS Extended to APFS in the first place. Although mechanical hard disk drives are still widely used and offer the best price per gigabyte, solid-state storage media is the future. (In fact, APFS is the file system used by iOS devices, Apple Watches, and Apple TVs—all of which store data in solid-state memory.) An SSD provides much faster performance because it doesn’t suffer from the lag between macOS asking for data and a mechanical disk’s armature skipping to the correct positions on the platters to read it. An SSD also has no moving parts, so the likelihood of mechanical failure is extremely low.
However, the file system in use before APFS, Mac OS Extended, isn’t as efficient when working with SSDs. It was designed—many years ago—with magnetic disks in mind, where a file is preferably written in a long stretch across the surface. In reality, most files are split up into many tiny pieces, which is why we used to optimize performance by “defragmenting” disks, a practice largely unneeded these days except in rare circumstances.
On an SSD, data is written to cells regardless of where they are located in relation to one another. But there’s a catch: data can be written to the cells only a finite number of times, so APFS efficiently shuffles data around to manage SSD wear. Also, if you duplicate a file on an SSD, APFS uses the stored data of the original file and writes just the changes rather than writing an entirely new file. In terms of performance that you can see, duplicating that file—or folder, or hundreds of files—happens nearly instantaneously because APFS makes metadata links to the originals.
So, underneath the surface, APFS handles data more efficiently. That said, Apple is still working on APFS, making it a moving target for developers of backup and disk utility software and limiting the compatibility of the file system. APFS currently works only with SSDs, although Apple says that full support for mechanical hard disks and Fusion drives is coming in macOS 10.14 Mojave. It’s possible to format a hard disk drive as APFS, but you’re likely to experience a performance hit compared to it formatted with Mac OS Extended. It will be interesting to see how Apple addresses that in Mojave.
APFS also isn’t supported on Time Machine drives. Even if your startup disk is an SSD, your Time Machine drive needs to remain in Mac OS Extended format for the time being.
What Can I Do with APFS?
That’s all behind-the-scenes stuff, but what does APFS enable you to do? One of its most powerful user-facing features is how it enables you to create multiple, resizable volumes on your drive. Sometimes people want to split a drive into multiple virtual volumes to separate data such as files for work and files for home or to encrypt one for storing sensitive data and leave the other unencrypted.
To explain how Mac OS Extended and APFS each handle that task, imagine the drive is a factory that builds rockets. I could instead use an office building as a metaphor, but wouldn’t you rather visualize spaceships?
On a drive formatted as Mac OS Extended, the factory is a giant open space where the rockets can be assembled and parts can be stacked. The factory floor is the free space on the drive.
(There’s also a secret door to a hidden room of emergency equipment that nobody pays attention to unless something goes wrong on the factory floor. That room represents macOS Recovery, the invisible startup partition that runs a scaled-down version of the operating system when you need to repair your main macOS installation.)
Now, let’s say you want to partition the drive into two volumes or, in our example, to split the factory into two sections to build two rockets simultaneously. Under Mac OS Extended, you’d erect a permanent wall between the sections, creating two separate rooms. (The hidden macOS Recovery room is still there, too. Safety first, people.)
Soon your rocket business is growing quickly, and you realize you need to build a larger rocket that will get a spacecraft to Mars. The problem is, this new rocket won’t fit into either of the two rooms. So, to make way for it, you have to take everything out of the factory (back up all the data and erase the volume), smash the wall (reformat the drive), build a brand-new wall that allocates enough space for the large rocket and leaves a smaller second room for the first rocket design and components (repartition the drive), and put everything back (restore the data from backup).
(Technically, there’s another option. If one of the rooms (partitions) is empty, Mac OS Extended enables engineers to move the wall, resizing the partition non-destructively. But when there’s equipment (data) in each room, the wall has to come down first.)
If, instead, you decide to go back to the one-room layout, you need to take everything out of both rooms and start over (back up all the data, erase the entire drive, and restore the data).
Now, let’s look at an APFS-powered rocket factory.
In terms of how space is allocated when formatting or partitioning a drive, APFS creates containers that include volumes, which can be dynamically adjusted as needed.
In our rocket factory analogy, APFS starts as a large open building, but even before a single piece of machinery is installed, a border of bright yellow-and-black tape is put onto the floor to indicate the active work area. That’s the container, and it encompasses nearly all of the factory area. That large area is also a single volume.
(If the drive is a startup disk, there are two other small areas taped off, one for the macOS Recovery room, and one for virtual memory, basically a small spot to store equipment—data—for short periods of time to make it easier to access.)
In this scheme, all the space in the volume is available for use, just as in the Mac OS Extended factory, but the factory manager is better about positioning tools and equipment near each other for a more efficient workflow.
As production ramps up and the factory floor needs to split into two sections, the APFS factory doesn’t build a physical wall. Instead, the manager merely moves the tape to indicate that there are now two work areas: adding a new volume and making the original volume smaller. The equipment in the area that becomes the second work area moves as needed—rather than being removed (erased) to create the volume. (You can also set minimum and maximum size limits for a container when you create it.) In the Finder, you see two volumes.
When the order comes in to start manufacturing bigger rockets, the volume that needs the extra space automatically grows as needed: redrawing the taped area and taking space from the second volume dynamically. No walls need to be torn down; no volumes need to be erased and then restored.
(Note that it is possible to partition an APFS drive, which gives you multiple immovable containers, but then they have the same limitations as Mac OS Extended partitions. So there isn’t much point.)
Another major benefit to APFS is its support for snapshots, which are a record of a drive’s state at a point in time. When you apply a system update, macOS automatically creates a new snapshot, so if anything goes wrong, you can roll the Mac back to the exact state it was in before the update. A snapshot is also created once every hour. These snapshots also enable you to retrieve deleted files or to go back to an earlier version of a file.
Sound familiar? Except for the automatic pre-update backup, that’s how Time Machine works. In fact, to access snapshots, you use the Time Machine interface (even if you haven’t yet set up Time Machine). But two separate things are going on behind the scenes.
When a Time Machine drive is connected, macOS makes regular Time Machine backups, not APFS snapshots, to that drive. Since a Time Machine drive must be formatted as Mac OS Extended, macOS copies to the drive any files that were changed since the last backup.
If the Time Machine drive is not connected—let’s say you’re traveling with your MacBook Pro—macOS creates APFS snapshots every hour and stores them on the startup disk or any APFS-formatted SSD directly connected to the Mac. The snapshots don’t take up much extra space, because they only contain metadata describing the states and locations of every file, plus data that’s been removed or replaced. Snapshots also age out after 24 hours and are automatically deleted.
On Macs running macOS versions earlier than High Sierra or those with hard disk drives or Fusion drives still formatted as Mac OS Extended, Time Machine creates similar local “mobile Time Machine” snapshots when the Time Machine drive is disconnected. But because the drive isn’t formatted as APFS, those local snapshots are not the same as APFS snapshots.
On a drive formatted as APFS, you can see how many snapshots are present by opening the Terminal app and typing:
tmutil listlocalsnapshots /
You can also create a snapshot at any time by typing:
If you need to restore deleted files or go back to an earlier version of a file, you use the Time Machine interface to do it. Click the Time Machine icon in the Dock or choose Enter Time Machine from the Time Machine menu bar icon, and then use the timeline on the right to navigate to the version of the file you want.
Should you need to restore the entire startup disk to a previous state, restart into macOS Recovery (hold Command-R at startup until you see the macOS Utilities screen), and choose Restore from Time Machine. You’ll be given the option to select one of the local snapshots.
(Speaking of macOS Recovery, if you open Disk Utility and run First Aid on the startup disk, it also checks all the snapshots. So if you have a lot, be prepared to wait quite some time for First Aid to complete.)
You may never need to take advantage of snapshots, but it’s comforting to know that macOS has a built-in data protection mechanism in place at the file-system level.
Take Control of Your Digital Storage
APFS is just one part of our modern storage picture. In Take Control of Your Digital Storage, I also investigate the other acronyms that bedevil us when contemplating adding capacity: what to look for when buying a NAS (Network-Attached Storage), understanding the difference between HDDs (hard disk drives) and SSDs (solid-state drives), and explaining RAID (Redundant Array of Independent Disks) and, related to RAID, possibly my favorite acronym ever, JBOD (just a bunch of disks). You’ll also learn more about creating partitions and volumes, using Disk Utility and First Aid, encrypting drives and data, and more.
The book is available now for $12.99 at the Take Control bookstore.