error: apfs_root: btn: invalid o_oid (0x2163b7) - How to fix this?

I'm running macOS Mojave 10.14.2 (18C54). fsck_apfs gives me:

** Checking the container superblock.
** Checking the EFI jumpstart record.
** Checking the space manager.
** Checking the space manager free queue trees.
** Checking the object map.
** Checking volume.
** Checking the APFS volume superblock.
** The volume MacOS was formatted by diskmanagementd (945.220.38) and last modified by apfs_kext (945.230.6).
** Checking the object map.
** Checking the snapshot metadata tree.
** Checking the snapshot metadata.
** Checking snapshot 1 of 11.
error: apfs_root: btn: invalid o_oid (0x2163b7)
   Snapshot is invalid.
** The volume /dev/rdisk1s1 could not be verified completely.

"sudo fsck_apfs -l -n -S /dev/rdisk1s1" (skip iteration of snapshots) gives me:

* Checking the container superblock.
** Checking the EFI jumpstart record.
** Checking the space manager.
** Checking the space manager free queue trees.
** Checking the object map.
** Checking volume.
** Checking the APFS volume superblock.
** The volume MacOS was formatted by diskmanagementd (945.220.38) and last modified by apfs_kext (945.230.6).
** Checking the object map.
** Checking the snapshot metadata tree.
** Checking the snapshot metadata.
** Checking the extent ref tree.
** Checking the fsroot tree.
error: apfs_root: btn: invalid o_oid (0x2163b7)
   fsroot tree is invalid.
** The volume /dev/rdisk1s1 could not be verified completely.

Any advice besides reinstalling the complete system? Just did that 3 weeks ago... 🤬

MacBook Air (2018 or later)

Posted on Dec 13, 2018 11:22 PM

Reply

Similar questions

8 replies

Dec 16, 2018 3:37 AM in response to BDAqua

Thank you for your pointers BDAqua! Unfortunately a full system restore from Time Machine was already running and I have a filesystem without invalid o_oids by now. (We'll see for how long.) Luckily, I included almost everything in my Time Machine Backup after my last (manual) system restoration. (I have not used any virtualization since then.)


However for the next time my filesystem crashes, I will get back to this thread and try the approaches you proposed - I can still do a full system restore afterwards ;)


Btw. could you please provide the command you mentioned in your post above? I can only see a grey empty box in your post. Thank you!


P.S.: By now I am somewhat worried about the data on my iPhone... :(

Dec 15, 2018 12:52 AM in response to BDAqua

Thank you for your answer, but the procedure did not fix the problem. The Disk Utility/First Aid module in Recovery Mode seems to be the very same fsck_apfs as in all other procedures. I tried booting from a thumb drive running fsck_apfs on the disk in quest before and that didn't help. Anyhow, I ran it again in Recovery Mode, hoping... - same result. It would not fix the file system.


Btw. its a "APFS (Case-sensitive, Encrypted)" volume.

Dec 15, 2018 4:55 AM in response to sdöfjn

I don't know of anything that can really fix APFS yet, I wonder if DiskWarrior can?


https://www.alsoft.com/diskwarrior/?gclid=EAIaIQobChMIlIqfxe-h3wIViuNkCh1SDwkzEAAYASAAEgJ43_D_BwE


Supports MacBook, MacBook Air, MacBook Pro, iMac, Mac mini and Mac Pro. Supported OS includes Mac OS X Leopard (10.5), Mac OS X Snow Leopard (10.6), OS X Lion (10.7), OS X Mountain Lion (10.8), OS X Mavericks (10.9), OS X Yosemite (10.10), OS X El Capitan (10.11), macOS Sierra (10.12)m macOS High Sierra (10.13) and macOS Mojave (10.14).


Have not tried this...

https://iboysoft.com/mac-data-recovery/fsroot-tree-is-invalid-apfs.html


Running any VM like Parallels?

I just ran into similar issue. Likely you would have found that the problem was in one of the files for the Parallels VM - at least that was the culprit in my case. Your fsck_apfs -d /disk/<disk> check returned:


If you had opened terminal you could have gotten the path to the file (or files) using that inode using the following command:


From there you would have known which file(s) needed to be restored instead of doing a full restore.

In my case the VM file was only available in the snapshot as I exclude my VMs from TimeMachine. I restored just that file from an earlier snapshot and I got further through fsck_apfs - it got through the disk to checking snapshots and then bombed on same file in the 2nd snapshot. Luckily snapshots are only kept for at most 24 hours so it should clear up after that point.

Your mileage may vary however as it could be as "simple" as one file or just the tip of the iceberg.

Dec 16, 2018 3:49 AM in response to sdöfjn

This one?


fsck_apfs -d /disk/<disk>


When checking the APFS volume with fsck, I got the following results (Disk Utility.app says the same what fsck does):

bash-3.2# fsck_apfs -d -l /dev/disk5

fletcher64_init:58: Selecting AVX2 implementation of fletcher64

Checking volume.

Checking the container superblock.

Checking the EFI jumpstart record.

Checking the space manager.

Checking the object map.

Checking the APFS volume superblock.

warning: apfs_sb at apfs_fs_index (0): apfs_features has unrecognized features (2)

Checking the object map.

Checking the fsroot tree.

error: btn: key (2) compare error: 22

fsroot tree is invalid.

The volume /dev/disk5 could not be verified completely.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

error: apfs_root: btn: invalid o_oid (0x2163b7) - How to fix this?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.