What's new in ApFS?

ApFS is a big improvement over HFS+. Finally, we got a modern and reliable file system without the legacy of the 80s of the XX century and that's why:

  • Full Unicode support. In HFS+, file and folder names are normalized, ApFS stores them unchanged
  • snapshots of the file system for fast and effective backups
  • support for flash drives at the file system level which greatly improves read/write performance. ApFS writes data the way it will be located on a flash drive while HFS+ always assumes it writes to HDD
  • instant calculation of the directory size - in ApFS the directory size is stored separately, and not counted every time again

Nanosecond timestamps

ApFS significantly increased the accuracy of timestamps. ApFS supports time stamping accurate to the nanosecond.

Nanosecond timestamps are very important in modern file systems, because they help implement atomicity and atomic transactions - one of the main ACID requirements for a transaction system (for example, a DBMS). Atomicity ensures that no transaction is partially committed to the system. Either all of its sub-operations will be completed, or not a single one will be completed.

Failure Protection

ApFS implements an innovative copy-on-write metadata scheme, which Apple calls “Crash Protection”. It ensures that changes to the file system and logging are kept in sync if something happens during recording - for example, power is lost.

Sparse files

A file with the “sparse” attribute assumes the content of blocks of zero bytes, not stored on the drive, but implied. HFS+ did not have sparse file support.

Space sharing

One of the innovations of ApFS is the Space Sharing feature in which all volumes in the container share the same underlying space. Most likely this is the reason that the BMS (Bitmap System) is connected directly to the container's CSBD (Checkpoint Superblock Descriptor) and not to each individual volume. This is the opposite of what we are familiar with from other file systems where the space is restricted to the rigid partition scheme. On ApFS container with 3 volumes all the volumes will report the same amount of free space. In a container of 1000 Gb with 3 volumes (Vol-A, Vol-B and Vol-C) having 100, 200 and 300 Gb of allocated space accordingly. All 3 volumes will report 400 Gb of free space.

Extended Attributes

ApFS has built-in support for extended file attributes which in HFS+ was implemented through the Attributes file.

Encryption

Apple claims encryption is a fundamental property that is built into ApFS at the file system level. For each volume in the ApFS container one of the encryption models is installed: without encryption, encryption with one key, encryption with several keys. In the latter case individual keys are used to encrypt files and metadata. Depending on the hardware ApFS uses AES-XTS or AES-CBC encryption mode.

Data Cloning

Data Cloning - almost instantly copying a file or directory which does not require additional space for data storage. When a clone is modified the file system records only data changes. The metadata exists in the file structure multiple times but shares the same blocks. When one of the files is modified only the altered blocks are connected explicitly to the altered file. Thus the new file system can store many versions of large files consuming less disk space.