Apple File System (APFS) is a proprietary file system developed and deployed by Apple Inc. for macOS Sierra (10.12.4) and later, iOS 10.3 and later, tvOS 10.2 and later, watchOS 3.2 and later, and all versions of iPadOS. It aims to fix core problems of HFS+ (also called Mac OS Extended), APFS's predecessor on these operating systems. APFS is optimized for solid-state drive storage and supports encryption, snapshots, and increased data integrity, among other capabilities.

History

Apple File System was announced at Apple's developers’ conference (WWDC) in June 2016 as a replacement for HFS+, which had been in use since 1998. APFS was released for 64-bit iOS devices on March 27, 2017, with the release of iOS 10.3, and for macOS devices on September 25, 2017, with the release of macOS 10.13.

Apple File System

Apple released a partial specification for APFS in September 2018 which supported read-only access to Apple File Systems on unencrypted, non-Fusion storage devices. The specification for software encryption was documented later.

Apple File System

Design

The file system can be used on devices with relatively small or large amounts of storage. It uses 64-bit inode numbers, and allows for more secure storage. The APFS code, like the HFS+ code, uses the TRIM command for better space management and performance. It may increase read-write speeds on iOS and macOS, as well as space on iOS devices, due to the way APFS calculates available data.

Apple File System

Partition scheme

APFS uses the GPT partition scheme. Within the GPT scheme are one or more APFS containers (partition type GUID is ). Within each container there are one or more APFS volumes, all of which share the allocated space of the container, and each volume may have APFS volume roles. macOS Catalina (macOS 10.15) introduced the APFS volume group, which are groups of volumes that Finder displays as one volume. APFS firmlinks lie between hard links and soft links and link between volumes.

In macOS Catalina the volume role (usually named "Macintosh HD") became read-only, and in macOS Big Sur (macOS 11) it became a signed system volume (SSV) and only volume snapshots are mounted. The volume role (usually named "Macintosh HD - Data") is used as an overlay or shadow of the volume, and both the and volumes are part of the same volume group and shown as one in Finder.

Clones

Clones allow the operating system to make efficient file copies on the same volume without occupying additional storage space. Changes to a cloned file are saved as delta extents, reducing storage space required for document revisions and copies. There is, however, no interface to mark two copies of the same file as clones of the other, or for other types of data deduplication.

Snapshots

APFS volumes support snapshots for creating a point-in-time, read-only instance of the file system.

Encryption

Apple File System natively supports full disk encryption, and file encryption with the following options: no encryption single-key encryption multi-key encryption, where each file is encrypted with a separate key, and metadata is encrypted with a different key.

Increased maximum number of files

APFS supports 64-bit inode numbers, supporting over 9 quintillion files (263) on a single volume.

Data integrity

Apple File System uses checksums to ensure data integrity for metadata but not for user data.

Crash protection

Apple File System is designed to avoid metadata corruption caused by system crashes. Instead of overwriting existing metadata records in place, it writes entirely new records, points to the new ones and then releases the old ones, an approach known as redirect-on-write. This avoids corrupted records containing partial old and partial new data caused by a crash that occurs during an update. It also avoids having to write the change twice, as happens with an HFS+ journaled file system, where changes are written first to the journal and then to the catalog file.

Compression

APFS supports transparent compression on individual files using Deflate (Zlib), LZVN (libFastCompression), and LZFSE. All three are Lempel-Ziv-type algorithms. This feature is inherited from HFS+, and is implemented with the same AppleFSCompression / decmpfs system using resource forks or extended attributes. As with HFS+, the transparency is broken for tools that do not use decmpfs-wrapped routines.

Space sharing

APFS adds the ability to have multiple logical drives (referred to as volumes) in the same container where free space is available to all volumes in that container (block device).