Apple File System

From HandWiki
Short description: File system developed by Apple
APFS
Developer(s)Apple Inc.
Full nameApple File System
IntroducedMarch 27, 2017 (iOS), September 25, 2017 (macOS), with iOS 10.3, macOS 10.13
Partition identifier7C3457EF-0000-11AA-AA11-00306543ECAC (GPT)
Structures
Directory contentsB-tree[1]
Limits
Max. file size8 EB (9,223,372,036,854,775,808 bytes)[2]
Max. number of files9,223,372,036,854,775,808[2]
Allowed characters in filenamesUnicode 9.0 encoded in UTF-8[3]
Features
Dates recordedaccess, attributes modified, contents modified, created
Date rangeJanuary 1, 1970 – July 21, 2554[1]
Date resolution1 ns[2]
File system permissionsUnix permissions, NFSv4 ACLs
Transparent compressionPartial (decmpfs)[4]
Transparent encryptionYes[5]
Copy-on-writeYes[3][5]
Other
Supported operating systemsmacOS, iPadOS, iOS, tvOS, watchOS

Apple File System (APFS) is a proprietary file system developed and deployed by Apple Inc. for macOS Sierra (10.12.4)[6] and later, iOS 10.3, tvOS 10.2,[7] watchOS 3.2,[8] and all versions of iPadOS.[9][10] 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.[11][12]

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.[11][12] 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.[13][8]

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.[14]

Design

The file system can be used on devices with relatively small or large amounts of storage. It uses 64-bit inode numbers,[2] 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,[8] as well as space on iOS devices, due to the way APFS calculates available data.[15]

Partition scheme

APFS uses the GPT partition scheme. Within the GPT scheme are one or more APFS containers (partition type GUID is 7C3457EF-0000-11AA-AA11-00306543ECAC). 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 System 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 Data volume role (usually named "Macintosh HD - Data") is used as an overlay or shadow of the System volume, and both the System and Data 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.[10] 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.[10]

Encryption

Apple File System natively supports full disk encryption,[2] 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.[10]

Increased maximum number of files

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

Data integrity

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

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.[16]

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.[17]

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).[18]

Limitations

While APFS includes numerous improvements relative to its predecessor, HFS+, a number of limitations have been noted.

Limited integrity checks for user data

APFS does not provide checksums for user data.[19] It also does not take advantage of byte-addressable non-volatile random-access memory.[20][21]

Performance on hard disk drives

Enumerating files, and any inode metadata in general, is much slower on APFS when it is located on a hard disk drive. This is because instead of storing metadata at a fixed location like HFS+ does, APFS stores them alongside the actual file data. This fragmentation of metadata means more seeks are performed when listing files, acceptable for SSDs but not HDDs.[22]

Compatibility with Time Machine prior to macOS 11

Unlike HFS+, APFS does not support hard links to directories.[3][23] Since the version of the Time Machine backup software included in Mac OS X 10.5 (Leopard) through macOS 10.15 (Catalina) relied on hard links to directories, APFS was initially not a supported option for its backup volumes.[24][23] This limitation was overcome starting in macOS 11 Big Sur, wherein APFS is now the default file system for new Time Machine backups (existing HFS+-formatted backup drives are also still supported).[25] macOS Big Sur's implementation of Time Machine in conjunction with APFS-formatted drives enables "faster, more compact, and more reliable backups" than were possible with HFS+-formatted backup drives.[26][27]

Security issues

  • In March 2018, the APFS driver in High Sierra was found to have a bug that causes the disk encryption password to be logged in plaintext.[28]
  • In January 2021, the APFS driver in iOS < 14.4, macOS < 11.2, watchOS < 7.3, and tvOS < 14.4 was found to have a bug that allowed a local user to read arbitrary files, regardless of their permissions.[29][30][31][32]

Support

macOS

An experimental version of APFS, with some limitations, is provided in macOS Sierra 10.12.4. It is available through the command line diskutil utility. Among these limitations, it does not perform Unicode normalization while HFS+ does,[33] leading to problems with languages other than English.[34] Drives formatted with Sierra’s version of APFS may also not be compatible with later versions of macOS or APFS, and the Sierra version of APFS cannot be used with Time Machine, FileVault volumes, or Fusion Drives.[35]

Since macOS 10.13 High Sierra, all devices with flash storage are automatically converted to APFS.[36] As of macOS 10.14 Mojave, Fusion Drives and hard disk drives are also upgraded on installation.[37] The primary user interface to upgrade does not present an option to opt out of this conversion, and devices formatted with the High Sierra version of APFS will not be readable in previous versions of macOS.[36] Users can disable APFS conversion by using the installer's startosinstall utility on the command line and passing --converttoapfs NO.[38]

FileVault volumes are not converted to APFS as of macOS Big Sur 11.2.1. Instead macOS formats external FileVault drives as CoreStorage Logical Volumes formatted with Mac OS Extended (Journaled). FileVault drives can be optionally encrypted.[citation needed]

iOS, tvOS, and watchOS

iOS 10.3, tvOS 10.2, and watchOS 3.2 convert the existing HFSX file system to APFS on compatible devices.[13][8][39]

Third-party utilities

Despite the ubiquity of APFS volumes in today's Macs and the format's 2016 introduction, third-party repair utilities continue to have notable limitations in supporting APFS volumes, due to Apple's delayed release of complete documentation. According to Alsoft, the maker of DiskWarrior, Apple's 2018 release of partial APFS format documentation has delayed the creation of a version of DiskWarrior that can safely rebuild APFS disks.[40] Competing products, including MicroMat's TechTool and Prosoft's Drive Genius, are expected to increase APFS support as well.

Paragon Software Group has published a software development kit under the 4-Clause BSD License that supports read-only access of APFS drives.[41] An independent read-only open source implementation by Joachim Metz, libfsapfs, is released under GNU Lesser General Public License v3. It has been packaged into Debian, Fedora Linux, Rocky Linux, Red Hat Enterprise Linux and Ubuntu software repositories.[42][43][44] Both are command-line tools that do not expose a normal filesystem driver interface. There is a Filesystem in Userspace (FUSE) driver for Linux called apfs-fuse with read-only access.[45] An "APFS for Linux" project is working to integrate APFS support into the Linux kernel.[46]

A commercial product, Paragon's APFS for Windows allows for read and write support to APFS volumes in all versions of Windows from Windows 7 through Windows 11 and Windows Server 2008 R2 through Windows Server 2022, but it is unable to format or verify APFS volumes, and it cannot read APFS volumes which are hardware-encrypted against the Apple T2 security chip.[47]

See also

References

  1. 1.0 1.1 Hansen, K.H.; Toolan, F. (September 21, 2017). "Decoding the APFS file system". Digital Investigation 22: 107–132. doi:10.1016/j.diin.2017.07.003. ISSN 1742-2876. 
  2. 2.0 2.1 2.2 2.3 2.4 2.5 "Volume Format Comparison" (in en). https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/APFS_Guide/VolumeFormatComparison/VolumeFormatComparison.html. 
  3. 3.0 3.1 3.2 "Apple File System Guide / Frequently Asked Questions". https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/APFS_Guide/FAQ/FAQ.html. 
  4. Bertin, René. "Compression and APFS". https://github.com/RJVB/afsctool/issues/3. 
  5. 5.0 5.1 5.2 Apple Inc. "Apple File System Guide (Features)". https://developer.apple.com/documentation/foundation/file_system/about_apple_file_system. 
  6. Vigo, Jesus (13 Apr 2017). "How to set up and use Apple's APFS file system on macOS Sierra". TechRepublic. https://www.techrepublic.com/article/how-to-set-up-and-use-apples-apfs-file-system-on-macos-sierra/. 
  7. "tvOS 10.2". What's New in tvOS. Apple Inc.. https://developer.apple.com/library/content/releasenotes/General/WhatsNewinTVOS/Articles/tvOS10_2.html. 
  8. 8.0 8.1 8.2 8.3 Warren, Tom (March 27, 2017). "Apple is upgrading millions of iOS devices to a new modern file system today". Vox Media. https://www.theverge.com/2017/3/27/15076244/apple-file-system-apfs-ios-10-3-features. 
  9. Roger Fingas (June 13, 2016). "'Apple File System' will scale from Apple Watch to Macs, replace HFS+". Apple Insider. http://appleinsider.com/articles/16/06/13/apple-file-system-will-scale-from-apple-watch-to-macs-replace-hfs. 
  10. 10.0 10.1 10.2 10.3 Hutchinson, Lee (June 13, 2016). "Digging into APFS, Apple's new file system". http://arstechnica.co.uk/apple/2016/06/apfs-apple-new-file-system-dev-details/. 
  11. 11.0 11.1 Weintraub, Seth (June 13, 2016). "Apple File System (APFS) announced for 2017, scales 'from Apple Watch to Mac Pro' and focuses on encryption". https://9to5mac.com/2016/06/13/apple-file-system-apfs/. 
  12. 12.0 12.1 Hutchinson, Lee (June 13, 2016). "New file system spotted in macOS Sierra [Updated"]. Condé Nast. https://arstechnica.com/apple/2016/06/new-apfs-file-system-spotted-in-new-version-of-macos/. 
  13. 13.0 13.1 Clover, Juli (March 27, 2017). "Apple Releases iOS 10.3 With Find My AirPods, APFS, App Store Review Tweaks and More". https://www.macrumors.com/2017/03/27/apple-releases-ios-10-3/. 
  14. "Apple File System Reference". Apple Developer. https://developer.apple.com/support/downloads/Apple-File-System-Reference.pdf. 
  15. Alan Loughnane (April 2017). "Updating your iPhone will give you one major benefit". https://www.joe.co.uk/tech/updating-iphone-will-give-one-major-benefit-119704. 
  16. 16.0 16.1 Adam Leventhal (June 19, 2016). "APFS in Detail: Data Integrity". http://dtrace.org/blogs/ahl/2016/06/19/apfs-part5/. 
  17. Søgaard, Jens K.. "How do I enable transparent compression on APFS?". https://apple.stackexchange.com/a/360124. 
  18. Tamura, Eric; Giampaolo, Dominic (2016). "Introducing Apple File System". https://devstreaming-cdn.apple.com/videos/wwdc/2016/701q0pnn0ietcautcrv/701/701_introducing_apple_file_system.pdf. 
  19. "A ZFS developer's analysis of the good and bad in Apple's new APFS file system". June 26, 2016. https://arstechnica.com/gadgets/2016/06/a-zfs-developers-analysis-of-the-good-and-bad-in-apples-new-apfs-file-system/. 
  20. Robin Harris (June 24, 2016). "Why Apple's APFS won't last 30 years". https://www.zdnet.com/article/why-apples-apfs-wont-last-30-years/. 
  21. Adam Leventhal (June 19, 2016). "APFS in Detail: Overview". http://dtrace.org/blogs/ahl/2016/06/19/apfs-part1/. 
  22. "An analysis of APFS enumeration performance on rotational hard drives". https://bombich.com/blog/2019/09/12/analysis-apfs-enumeration-performance-on-rotational-hard-drives. 
  23. 23.0 23.1 Leventhal, Adam H. (June 26, 2016). "A ZFS developer's analysis of the good and bad in Apple's new APFS file system". https://arstechnica.com/gadgets/2016/06/a-zfs-developers-analysis-of-the-good-and-bad-in-apples-new-apfs-file-system/. "APFS right now is incompatible with Time Machine due to the lack of directory hard links, a fairly disgusting implementation that likely contributes to Time Machine's questionable reliability." 
  24. "Disks you can use with Time Machine". https://support.apple.com/guide/mac-help/disks-you-can-use-with-time-machine-mh15139/mac. 
  25. "APFS changes in Big Sur". June 29, 2020. https://eclecticlight.co/2020/06/29/apfs-changes-in-big-sur-how-time-machine-backs-up-to-apfs-and-more/. 
  26. "macOS Big Sur 11.0.1 Release Notes". https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-release-notes. 
  27. Cunningham, Andrew (12 Nov 2020). "macOS 11.0 Big Sur: The Ars Technica review". Ars Technica. https://arstechnica.com/gadgets/2020/11/macos-11-0-big-sur-the-ars-technica-review/. 
  28. "Uh Oh! Unified Logs in High Sierra (10.13) Show Plaintext Password for APFS Encrypted External Volumes via Disk Utility.app". March 21, 2018. https://www.mac4n6.com/blog/2018/3/21/uh-oh-unified-logs-in-high-sierra-1013-show-plaintext-password-for-apfs-encrypted-external-volumes-via-disk-utilityapp. 
  29. "About the security content of iOS 14.4 and iPadOS 14.4 - Apple Support". https://support.apple.com/en-us/HT212146. 
  30. "About the security content of macOS Big Sur 11.2, Security Update 2021-001 Catalina, Security Update 2021-001 Mojave - Apple Support". https://support.apple.com/en-us/HT212147. 
  31. "About the security content of watchOS 7.3 - Apple Support". https://support.apple.com/en-us/HT212148. 
  32. "About the security content of tvOS 14.4 - Apple Support". https://support.apple.com/en-us/HT212149. 
  33. Tsai, Michael J.. "Michael Tsai - Blog - APFS's "Bag of Bytes" Filenames". https://mjtsai.com/blog/2017/03/24/apfss-bag-of-bytes-filenames/. 
  34. "APFS is currently unusable with most non-English languages". April 6, 2017. https://eclecticlight.co/2017/04/06/apfs-is-currently-unusable-with-most-non-english-languages/. 
  35. "How to Format a Drive With the APFS File System on macOS Sierra". http://www.howtogeek.com/272741/how-to-format-a-drive-with-the-apfs-file-system-on-macos-sierra/. 
  36. 36.0 36.1 "Prepare for APFS in macOS High Sierra". Apple.com. September 7, 2017. https://support.apple.com/en-gb/HT208018. 
  37. "macOS 10.14 Mojave: The Ars Technica review". arstechnica.com. September 25, 2018. https://arstechnica.com/features/2018/09/macos-10-14-mojave-the-ars-technica-review/3/. 
  38. Trouton, Rich (September 26, 2017). "Using the macOS High Sierra OS installer's startosinstall tool to avoid APFS conversion". https://derflounder.wordpress.com/2017/09/26/using-the-macos-high-sierra-os-installers-startosinstall-tool-to-avoid-apfs-conversion/. 
  39. "jakepetroules/Filesystem" (in en). https://github.com/jakepetroules/Filesystem. 
  40. "DiskWarrior 5.2 & Apple File System (APFS)". https://www.alsoft.com/diskwarrior5apfs. 
  41. "Paragon Software Group Releases Free Paragon APFS SDK Community Edition for Software Developers, OEMs, Forensic Experts". https://www.paragon-software.com/paragon-software-group-releases-free-paragon-apfs-sdk-community-edition-for-software-developers-oems-forensic-experts/.  GitHub
  42. "libyal/libfsapfs". 7 November 2019. https://github.com/libyal/libfsapfs. "Library and tools to access the Apple File System (APFS)" 
  43. "apfs-fuse - Fedora Packages". https://packages.fedoraproject.org/pkgs/apfs-fuse/apfs-fuse/. 
  44. "apfs-fuse-20200928-1.el9.x86_64.rpm". https://rhel.pkgs.org/9/forensics-x86_64/apfs-fuse-20200928-1.el9.x86_64.rpm.html. 
  45. Ross, Alistair (23 February 2019). "How to mount macOS APFS disk volumes in Linux". https://linuxnewbieguide.org/how-to-mount-macos-apfs-disk-volumes-in-linux/.  (Github)
  46. "linux-apfs/linux-apfs-rw: APFS module for linux, with experimental write support". APFS for Linux. 4 Feb 2022. https://github.com/linux-apfs/linux-apfs-rw. 
  47. "APFS for Windows | Paragon Software". https://www.paragon-software.com/home/apfs-windows/. 

External links