Home > Questions

What Directory Structure is Used in Apple File System (APFS) in macOS?

Can anyone tell me what directory structure the Apple File System (APFS) in macOS employs?

Best Answered by

iBoysoft author Vain Rowe

Vain Rowe

Answered on Wednesday, April 24, 2024

Hello, Apple File System employs the B-tree directory structure in macOS.

Btrfs uses a single set of b-tree manipulation codes for all metadata in the file system. For performance or organizational purposes, the trees are broken up into a few different types, and each type of tree will hold a few different types of keys. The superblock holds pointers to the tree roots the tree of tree roots and the chunk tree.

This tree is used for indexing and finding the root of most of the other trees in the filesystem. It attaches names to subvolumes and snapshots, and stores the location of the extent allocation tree root. It also stores pointers to all of the subvolumes or snapshots that are being deleted by the transaction code. This allows the deletion to pick up where it left off after a crash.

B-tree contains 7 kinds of trees, you can have a quick look here:

1. Chunk Tree: The chunk tree does all of the logical to physical block address mapping for the filesystem, and it stores information about all of the devices in the FS. In order to bootstrap lookup in the chunk tree, the superblock also duplicates the chunk items needed to resolve blocks in the chunk tree. Over time, the chunk tree will be split into multiple roots to allow access to larger storage pools.

2. Device Allocation Tree: The device allocation tree records which parts of each physical device have been allocated into chunks. This is a relatively small tree that is only updated as new chunks are allocated. It stores back-references to the chunk tree that allocated each physical extent on the device.

3. Extent Allocation Tree: The extent allocation tree records byte ranges that are in use, maintains reference counts on each extent, and records back-references to the tree or file that is using each extent. Logical block groups are created inside the extent allocation tree, and these reference large logical extents from the chunk tree.

4. FS Trees: These store files and directories, and all of the normal metadata you would expect to find in a filesystem. There is one root for each subvolume or snapshot, but snapshots will share blocks between roots.

5. Checksum Tree: The checksum tree stores block checksums. Every 4k block of data stored on disk has a checksum associated with it. The "offset" part of the keys in the checksum tree indicates the start of the checksummed data on disk. The value stored with the key is a sequence of (currently 4-byte) checksums, for the 4k blocks starting at the offset.

6. Data Relocation Tree

7. Log Root Tree

APFS takes advantage of the B-tree to keep track of where data and files are stored on the Intel-based Mac and Apple Silicon Mac.

People Also Ask

Read More Questions

Read More Advice From iBoysoft's Computer Experts


Mac/MacBook でユーザーを切り替える方法(ステップバイステップガイド)

この投稿では、Mac や MacBook で異なる方法でユーザーを切り替える方法を説明します。ログイン時、起動時、またはロック画面でユーザーを切り替える方法を学んでください。


Mac でリムーバブルボリュームへのアクセスを許可する方法を修正しました

メッセージ(app名)がMacでリムーバブルボリュームのファイルにアクセスしたいというメッセージを受信していますか?この投稿では、macOS Sonoma/Ventura/Montereyのアプリにリムーバブルボリュームへのアクセスを許可する方法を説明しています。

HD externo não sendo montado no Mac

Disco Rígido Externo Não Montando no macOS Sonoma/Ventura

8 soluções eficazes para corrigir o problema de disco rígido externo não montando no macOS Sonoma/Ventura/Monterey/Big Sur e recuperar dados perdidos de disco rígido externo desmontado no Mac.

recuperacion de datos mac