Apple File System is a 64-bit file system supporting over 9 quintillion files on a single volume. This state-of-the-art file system features cloning for files and directories, snapshots, space sharing, fast directory sizing, atomic safe-save primitives, and improved filesystem fundamentals, as well as a unique copy-on-write design that uses I/O coalescing to deliver maximum performance while ensuring data reliability.
A clone is a nearly instantaneous copy of a file or directory that occupies no additional space for file data. Clones allow the operating system to make fast, power-efficient file copies on the same volume without occupying additional storage space.
Modifications to the data write the new data elsewhere and continue to share the unmodified blocks. Changes to a file are saved as deltas of the cloned file, reducing storage space required for document revisions and copies.
A volume snapshot is a point-in-time, read-only instance of the file system.
The operating system uses snapshots to make backups work more efficiently and offer a way to revert changes to a given point in time.
Space Sharing allows multiple file systems to share the same underlying free space on a physical volume. Unlike rigid partitioning schemes that pre-allocate a fixed amount of space for each file system, APFS-formatted volumes can grow and shrink without volume repartitioning.
With Apple File System, the disk space of a container is shared among all of its volumes. By default, each volume in an APFS container reports the same available disk space, which is equal to the total available disk space of the container. For example, for an APFS container with a capacity of 100GB that contains volume A (which uses 10GB) and volume B (which uses 20GB), the free space reported for both volumes A and B is 70GB (100GB - 10GB - 20GB).
Containers can optionally configure a quota, or a maximum allotment of disk space for a volume, as well as a reservation, or a guaranteed minimum allotment of disk space for a volume.
Security and privacy are fundamental in the design of Apple File System. That's why Apple File System implements strong full-disk encryption, encrypting files and all sensitive metadata.
Which encryption methods are available depends on hardware and operating system support, and can vary for Mac, iPhone, iPad, Apple TV, and Apple Watch.
Apple File System supports the following encryption models for each volume in a container:
Multi-key encryption with per-file keys for file data and a separate key for sensitive metadata
Multi-key encryption ensures the integrity of user data. Even if someone were to compromise the physical security of the device and gain access to the device key, they still couldn't decrypt the user's files.
Apple File System uses AES-XTS or AES-CBC encryption modes, depending on hardware.
Apple File System uses a novel copy-on-write metadata scheme to ensure that updates to the file system are crash protected, without the write-twice overhead of journaling.
Apple File System supports sparse files, a more efficient way of representing empty blocks on disk.
With sparse files, storage is allocated only when actually needed. This allows the logical size of files to be greater than the physical space occupied on disk. APIs can query both the logical and physical size of sparse files, with functionality to seek through and rewind back to the beginnings of holes and data sections.
Fast Directory Sizing
Fast directory sizing allows Apple File System to quickly compute the total space used by a directory hierarchy, and update it as the hierarchy evolves.
Fast directory sizing works by precomputing the size of directory as content is added and removed. Therefore, it is most appropriate for directories that contain many files and have relatively little churn. For example, a user’s Documents folder is a good candidate for fast directory sizing, whereas the
/tmp directory would not.
The file system can enable fast directory sizing on empty directories. You cannot enable Fast Directory Sizing on directories containing files or other directories directly; you must instead first create a new directory, enable fast directory sizing on it, and then move the contents of the existing directory to the new directory.
Apple File System introduces a new Atomic Safe-Save primitive for bundles and directories. Atomic Safe-Save performs renames in a single transaction such that, from the user’s perspective, the operation either is completed or does not happen at all.