jivanpal / drat

Utility for performing data recovery and analysis of APFS partitions/containers.
GNU General Public License v3.0
163 stars 21 forks source link

Does apfs Object Maps B-tree has internal copies (or old versions)? #31

Closed poppyer9 closed 2 years ago

poppyer9 commented 2 years ago

bash-3.2# fsck_apfs /dev/disk3s1 Checking the container superblock. Checking the checkpoint with transaction ID 3938710. Checking the EFI jumpstart record. Checking the space manager. Checking the space manager free queue trees. Checking the object map. Checking the encryption key structures. Checking volume /dev/rdisk3s1. Checking the APFS volume superblock. The volume OSX1015 - Data was formatted by newfs_apfs (748.77.11) and last modified by apfs_kext (1933.80.3). Checking the object map. error: (oid 0x375ac2) om: btn: invalid o_type (0x4000000b, expected 0x40000003) error: (oid 0x375ac2) om: btn: invalid o_subtype (0x0, expected 0xb) Object map is invalid. The volume /dev/disk3s1 could not be verified completely.

I examined (oid 0x375ac2), it seems that node get wiped. this node corresponded to /Users, therefore most important data is there.

a4 3e 58 73 98 16 e7 c2 5a 37 00 00 00 00 00 dd 0d 3c 00 00 00 00 00 0b 00 00 40 00 00 00 00 : �>Xs���Z7�
00 00 00 00 00 00 00 00 02 00 00 40 02 00 00 40 c3 5a 37 00 00 00 00 00 00 00 00 00 00 00 00 00 : @@�Z7 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 :

Is there another (or older) copy in APFS that I can recover from? It seems odd that APFS only have 1 copy of ObjectMap?

poppyer9 commented 2 years ago

from explore-omap-tree

jivanpal commented 2 years ago

Yes, old instances of objects should still be present on disk if TRIM hasn't already got to them, but fsck_apfs sadly won't find these for you or repair the filesystem accordingly. The drat search command planned for the next version should be able to find these, but the existing code is not intended for general use. You can have a look at src/commands/search.c if you are interested, though.

Unfortunately I do not have time currently to provide personalised guidance, but the discussion in #12 may be helpful to you.