BT

A Look at APFS, Apple’s New File System for iOS and macOS

| by Sergio De Simone Follow 14 Followers on Jun 20, 2016. Estimated reading time: 2 minutes |

Among the announcements Apple made at WWDC 2016, its new file system, called APFS, raised a lot of developer interest. According to the preliminary developer documentation that Apple made available, APFS:

is optimized for Flash/SSD storage and features strong encryption, copy-on-write metadata, space sharing, cloning for files and directories, snapshots, fast directory sizing, atomic safe-save primitives, and improved file system fundamentals.

Brief Comparison to HFS+

According to Apple, APFS supports all of HFS+ features and improves them in several ways:

  • Contrary to HFS+, which uses 32-bit file IDs, APFS will support 64-bit inode numbers, which will allow to store over 9 quintillion files on a single volume.
  • Whereas HFS+ is bound to initialize the entire storage of a file system at once, APFS sports an extensible block allocator that enables lazy initialization of its data structure, thus hugely improving performance with large volumes.
  • APFS supports three models of encryption: no encryption, single-key encryption, and multi-key encryption to manage per-file keys and a metadata key.

Additional APFS features that improve on HFS+ are support for sparse files, improved TRIM operations, built-in support for extended attributes.

New Features in APFS

APFS also provides a few advanced features that put it in the same category as modern file systems such as ZFS, which Apple tried to port to OS X a few years ago, and HAMMER:

  • APFS uses a new copy-on-write mechanism aimed to make updates crash-safe.
  • Space sharing allows multiple file systems to flexibly grow on a shared physical volume, without requiring a rigid partitioning.
  • Cloning allows to create copies of files and directories that do no take any additional space until they are modified, in which case only the modified blocks are stored on disk. This behavior is transparently enforced by NSFileManager methods such as copyItemAtURL:toURL:error: and copyItemAtPath:toPath:error:.
  • Snapshots are read-only instances of an entire file system which provide the base for efficient backups. However, no API is available yet for developers to manage snapshots.
  • Atomic saves are able to rename bundles or directories in a single transaction that either succeeds or fails. This new behavior is transparently enforced by NSFileManager methods such as moveItemAtURL:toURL:error: and moveItemAtPath:toPath:error:.

Using APFS

APFS is currently released as a Developer Preview in macOS 10.12, which provides an updated hdutil command able to work with the new file system. This is how you create an APFS partition:

$ hdiutil create -fs APFS -size 1GB foo.sparseimage

Being a developer preview, Apple warns developers of the possibility of malfunctions and data loss when using APFS. Additionally, it has a few limitations, such as:

  • It cannot be used on a startup disk.
  • It is case-sensitive.
  • It does not work with Time Machine, FileVault, or Fusion Drives.

For a detailed introduction to APFS, please refer to this collection of posts by Adam Leventhal.

APFS is scheduled to ship in 2017 and will eventually replace Apple’s almost 20 years old HFS+ file system. 

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

HFS+ Age by Josh Ross

I wouldn't say that HFS+ is 30 years old, 20 maybe, if you round up.

Re: HFS+ Age by Sergio De Simone

Thanks, fixed.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

2 Discuss

Educational Content

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT