Eric Tamura - Manager, Local File Systems
Dominic Giampaolo - Senior Software Engineer, Storage / File Systems
What is Apple File System (APFS)?
Introduction:
- Next generation file system
- Runs on all four platforms - watchOS, iOS, macOS, tvOS
- Scales from Apple Watch to Mac Pro
- Designed to take advantage of Flash/SSD
- Engineered with encryption as a primary feature
Motivation:
HFS+:
- Apple wants to phase out HFS+
- Data structures in HFS+ are single-threaded
- Data structures are rigid - adding new features means a lot of backwards-compatibility and forwards-compatibility issues
APFS:
Designed for Apple products and ecosystem
Scale footprint from Apple Watch to Mac Pro
Other considerations:
Enhance security capabilities
Add new features!
Current File System Storage SW - watch video for overview.
All technologies currently in use will be replaced by APFS
This includes Core Storage. CS is being replaced by APFS <- Important for FileVault 2 encryption and Fusion drives
New Features:
Improved file system fundamentals
- Flash / SSD-optimized
- Crash-protected
- Modern 64-bit native fields for inodes and metadata
- Extensible design for data structure growth - addresses HFS+ rigid data structure issue by making sure that new features can be added without harming backwards compatibility. New fields can also be added.
- Optimized for Apple software ecosystem
- Low latency design, designed for fast responsiveness
- Native encryption support - First class objects inside the file system
HFS Compatibility:
Support and replace HFS+ functionality
Three things not supported:
- Exchange data
- Directory hard links for Time Machine
- Missed third item (watch video)
Space-sharing:
Watch video for multiple HFS+ partition space issue explanation
APFS containers:
Free space will dynamically resize as needed.
You can add more drive volumes to a container, to add free space to the container.
Cloning files and directories:
Cloning copies references to the data, rather than making a separate copy of the data.
When changes are made to the original, the changes are written elsewhere. This leaves the cloned copy alone with its existing references intact.
File system snapshots:
Makes read-only copy of the filesystem which stores the state of the filesystem at the time when the snapshot was taken.
Snapshots will take up disk space, to store that filesystem state. Snapshot maintenance is recommended, else you'll eventually run out of disk space.
Revert to snapshot - Filesystem will "rewind" to the state it was in when the snapshot was taken. Snapshot continues to exist and you can revert back as often as desired.
Fast directory sizing
How much space does a directory and its take up in the filesystem?
Users would like to know quickly.
Safely updating parent directory and included contents:
APFS stores the size of the directory / directories elsewhere in the filesystem - rather than in the directory itself.
Atomic Safe-Save (rename)
renamex_np (np = Non-POSIX)
Atomic-level saves to files and directories, rather than writing to temp files
Encryption:
HFS+ relies on CoreStorage to provide Full Disk Encryption
iOS relies on an HFS+ variant for encryption
APFS supports multiple levels of encryption
- No encryption - no data is encryted
- One key per volume (metadata and data) - This is equivalent to CoreStorage encryption today
- Multi-Key encryption
- Metadata encryption
- Per-File encryption
- Per-Extant encryption
Watch the video once available for more details on the encryption.
- Command line tool - snapshotutil (available in Sierra Public Beta, not yet in Developer Previews)
- Command line tool - mount_apfs - mounts APFS volumes
New APIs:
Foundation / File Manager (Swift)
- Automatically adopts new cloning and snapshot behavior when dealing with APFS volumes
libcopyfile
CoreOS library for copying hierarchies - supports cloning
Slightly above the POSIX layer
More details available - watch video
New file/directory cloning calls - watch video
New functionality
hdiutil - see new APFS functionality
diskutil apfs createContainer
diskutil apfs AddVolume
APFS Limitations:
Data volumes only
What doesn't work:
Time Machine backups with APFS
FileVault / Fusion drive support
Case-sensitivity
APFS cannot be shared over AFP; SMB preferred
OS X Yosemite or earlier can't recognize APFS volumes
Upgrading to APFS:
Apple will provide an in-place upgrade path from HFS+ to APFS
- User data remains in place
- Write the new APFS metadata into HFS+'s free space.
- Will not be instantaneous; should be a reasonably quick conversion
- Crash protection will be in place during the conversion process.
Ships by default on all devices in 2017.
More details in video.
More information: https developer .apple. com/ wwdc /701
Related sessions and labs:
How iOS Security Really Works
File Systems Lab
See complete list of session and lab notes here: