Apple File System Explained

APFS
Full Name:Apple File System
Developer:Apple Inc.
Introduction Os:iOS 10.3, macOS 10.13
Introduction Date:March 27, 2017 (iOS), September 25, 2017 (macOS),
Preceded By:HFS Plus
Partition Id:7C3457EF-0000-11AA-AA11-00306543ECAC (GPT)
Directory Struct:B-tree[1]
Max Files No:9,223,372,036,854,775,808
Max File Size:8 EB (9,223,372,036,854,775,808 bytes)[2]
Date Range:
Date Resolution:1 ns
Filename Character Set:Unicode 9.0 encoded in UTF-8
Dates Recorded:access, attributes modified, contents modified, created
File System Permissions:Unix permissions, NFSv4 ACLs
Compression:Partial (decmpfs)[3]
Encryption:Yes
Copy On Write:Yes
Os:macOS, 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)[4] and later, iOS 10.3, tvOS 10.2,[5] watchOS 3.2, and all versions of iPadOS.[6] [7] 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.[8] [9] 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.[10] [11]

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

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 by using a technology called Data Protection. 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,[11] as well as space on iOS devices, due to the way APFS calculates available data.[13]

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

Encryption

Apple File System natively supports full disk encryption,[2] and file encryption with the following options:

Increased maximum number of files

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

Data integrity

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

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

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

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.[18] It also does not take advantage of byte-addressable non-volatile random-access memory.[19] [20]

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

Compatibility with Time Machine prior to macOS 11

Unlike HFS+, APFS does not support hard links to directories.[22] [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

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. 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.

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.[10] [11] [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

External links

Notes and References

  1. Hansen. K.H.. Toolan. F.. September 21, 2017. Decoding the APFS file system. Digital Investigation. 22. 107–132. 10.1016/j.diin.2017.07.003. 1742-2876. mdy-all.
  2. Web site: Volume Format Comparison. Apple Developer. en. May 25, 2018. mdy-all.
  3. Web site: Bertin . René . Compression and APFS . Github . 2 February 2019.
  4. News: Vigo . Jesus . How to set up and use Apple's APFS file system on macOS Sierra . TechRepublic . 13 Apr 2017.
  5. Web site: tvOS 10.2. What's New in tvOS. Apple Inc..
  6. Web site: 'Apple File System' will scale from Apple Watch to Macs, replace HFS+. Roger Fingas. June 13, 2016. Apple Insider. live. https://web.archive.org/web/20160723030751/http://appleinsider.com/articles/16/06/13/apple-file-system-will-scale-from-apple-watch-to-macs-replace-hfs. July 23, 2016. mdy-all.
  7. Web site: Digging into APFS, Apple's new file system . Hutchinson . Lee . June 13, 2016. Ars Technica UK. June 15, 2016. mdy-all.
  8. Web site: Seth . Weintraub . Apple File System (APFS) announced for 2017, scales 'from Apple Watch to Mac Pro' and focuses on encryption . 9to5Mac . June 13, 2016 . March 27, 2017 . live . https://web.archive.org/web/20170328195315/https://9to5mac.com/2016/06/13/apple-file-system-apfs/ . March 28, 2017 . mdy-all .
  9. Web site: Lee . Hutchinson . New file system spotted in macOS Sierra [Updated] ]. . . June 13, 2016 . March 27, 2017 . live . https://web.archive.org/web/20170328195529/https://arstechnica.com/apple/2016/06/new-apfs-file-system-spotted-in-new-version-of-macos/ . March 28, 2017 . mdy-all .
  10. Web site: Juli . Clover . Apple Releases iOS 10.3 With Find My AirPods, APFS, App Store Review Tweaks and More . . March 27, 2017 . March 27, 2017 . live . https://web.archive.org/web/20170327194444/https://www.macrumors.com/2017/03/27/apple-releases-ios-10-3/ . March 27, 2017 . mdy-all .
  11. Web site: Tom . Warren . Apple is upgrading millions of iOS devices to a new modern file system today . . . March 27, 2017 . March 27, 2017 . live . https://web.archive.org/web/20170327184802/http://www.theverge.com/2017/3/27/15076244/apple-file-system-apfs-ios-10-3-features . March 27, 2017 . mdy-all .
  12. Web site: Apple File System Reference . Apple Developer.
  13. Web site: Updating your iPhone will give you one major benefit. Alan Loughnane. joe.co.uk. April 2017 . live. https://web.archive.org/web/20170520045551/https://www.joe.co.uk/tech/updating-iphone-will-give-one-major-benefit-119704. May 20, 2017. mdy-all.
  14. Web site: Apple File System Guide (Features). Apple Inc. December 16, 2023. mdy-all.
  15. Web site: APFS in Detail: Data Integrity. Adam Leventhal. June 19, 2016. live. https://web.archive.org/web/20160621060302/http://dtrace.org/blogs/ahl/2016/06/19/apfs-part5/. June 21, 2016. mdy-all.
  16. Web site: Søgaard . Jens K. . How do I enable transparent compression on APFS? . Ask Different . 13 November 2019.
  17. Web site: Introducing Apple File System . Eric . Tamura . Dominic . Giampaolo . Dominic Giampaolo . 2016 . May 28, 2022.
  18. Web site: A ZFS developer's analysis of the good and bad in Apple's new APFS file system. June 26, 2016. Ars Technica.
  19. Web site: Why Apple's APFS won't last 30 years. Robin Harris. June 24, 2016. ZDNet.
  20. Web site: APFS in Detail: Overview . Adam Leventhal . June 19, 2016 . October 1, 2017 . mdy-all.
  21. Web site: An analysis of APFS enumeration performance on rotational hard drives . Carbon Copy Cloner . 8 January 2020.
  22. Web site: Apple File System Guide / Frequently Asked Questions. May 25, 2018. mdy-all.
  23. Web site: Leventhal. Adam H.. A ZFS developer's analysis of the good and bad in Apple's 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.. Ars Technica. June 26, 2016.
  24. Web site: Disks you can use with Time Machine. December 17, 2019. mdy-all.
  25. Web site: APFS changes in Big Sur . June 29, 2020 . 26 November 2020.
  26. Web site: macOS Big Sur 11.0.1 Release Notes . Apple . December 13, 2020.
  27. News: Cunningham . Andrew . macOS 11.0 Big Sur: The Ars Technica review . 6 March 2021 . Ars Technica . 12 Nov 2020.
  28. Web site: Uh Oh! Unified Logs in High Sierra (10.13) Show Plaintext Password for APFS Encrypted External Volumes via Disk Utility.app . mac4n6 . March 21, 2018 . 11 November 2019.
  29. News: About the security content of iOS 14.4 and iPadOS 14.4 - Apple Support . Apple Support . 7 February 2021.
  30. Web site: About the security content of macOS Big Sur 11.2, Security Update 2021-001 Catalina, Security Update 2021-001 Mojave - Apple Support . Apple Support . 7 February 2021.
  31. Web site: About the security content of watchOS 7.3 - Apple Support . Apple Support . 7 February 2021.
  32. Web site: About the security content of tvOS 14.4 - Apple Support . Apple Support . 7 February 2021.
  33. Web site: Michael Tsai - Blog - APFS's "Bag of Bytes" Filenames. Michael J.. Tsai.
  34. Web site: APFS is currently unusable with most non-English languages. April 6, 2017. https://web.archive.org/web/20170608180050/https://eclecticlight.co/2017/04/06/apfs-is-currently-unusable-with-most-non-english-languages/. June 8, 2017. live.
  35. News: How to Format a Drive With the APFS File System on macOS Sierra. October 26, 2016. live. https://web.archive.org/web/20161026171416/http://www.howtogeek.com/272741/how-to-format-a-drive-with-the-apfs-file-system-on-macos-sierra/. October 26, 2016. mdy-all.
  36. Web site: Prepare for APFS in macOS High Sierra . Apple.com . September 7, 2017 . September 19, 2017 . mdy-all.
  37. Web site: macOS 10.14 Mojave: The Ars Technica review . arstechnica.com . September 25, 2018 . December 20, 2018 . mdy-all.
  38. Web site: Trouton. Rich. Using the macOS High Sierra OS installer's startosinstall tool to avoid APFS conversion. Der Flounder. January 16, 2018. September 26, 2017. mdy-all.
  39. Web site: jakepetroules/Filesystem. GitHub. en. March 29, 2017.
  40. Web site: DiskWarrior 5.2 & Apple File System (APFS) . 2020-06-28.
  41. Web site: Paragon Software Group Releases Free Paragon APFS SDK Community Edition for Software Developers, OEMs, Forensic Experts . Paragon Software Group. GitHub
  42. Web site: libyal/libfsapfs . GitHub . 7 November 2019 . Library and tools to access the Apple File System (APFS).
  43. Web site: apfs-fuse - Fedora Packages . 2022-10-20 . packages.fedoraproject.org.
  44. Web site: apfs-fuse-20200928-1.el9.x86_64.rpm. rhel.pkgs.org.
  45. Web site: Ross . Alistair . How to mount macOS APFS disk volumes in Linux . The Ultimate Linux Newbie Guide . 23 February 2019. (Github)
  46. Web site: linux-apfs/linux-apfs-rw: APFS module for linux, with experimental write support . GitHub . APFS for Linux . 4 Feb 2022.
  47. Web site: APFS for Windows Paragon Software . Paragon Software Group . 29 January 2024.