sgan81 / apfs-fuse

FUSE driver for APFS (Apple File System)
GNU General Public License v2.0
1.74k stars 164 forks source link

apfs-dump-quick: ERROR: GetNode: omap entry oid 216bd3 xid 4b86b7 not found. #117

Open hubearth opened 4 years ago

hubearth commented 4 years ago

I've tried mounting a disk. I have no permission issue, but I get error message with 'ls'.

# ls -l
ls: cannot access 'home': Input/output error
ls: cannot access 'net': Input/output error
ls: cannot access 'Applications': Input/output error
total 0
d????????? ? ?    ?      ?            ? Applications
drwxr-xr-x 1 root root  60 Aug  7  2019 Library
drwxr-xr-x 1 root root   0 Apr  9  2018 Network
...

This is not a duplicate of issue #76 where the problem is mounting a 64-bits filesystem on a 32-bits linux system.

I'm running apfs on a debian buster 64-bits system. On macOS, the disk also have some problem. I'm trying to backup some important files before reformating and I don't have access to a mac.

I have investigated a bit.

running with '-d 15' option gets me this: stdout.txt stderr.txt

Using apfs-dump-quick, I get this error coming up multiple times:

# apfs-dump-quick /dev/sdd ../dump.txt
Device /dev/sdd opened. Size is 240057409536
Info: Found valid GPT partition table on main device. Dumping first APFS partition.
starting LoadKeybag
 all blocks verified
starting LoadKeybag
 all blocks verified
starting LoadKeybag
 all blocks verified
Volume 0: Mac SSD
oid 1ebe41 xid 4b86b7 NOT FOUND!!!
ERROR: GetNode: omap entry oid 1ebe41 xid 4b86b7 not found.
oid 1d7b4c xid 4b86b7 NOT FOUND!!!
...
ERROR: GetNode: omap entry oid 216bca xid 4b86b7 not found.
oid 216bd3 xid 4b86b7 NOT FOUND!!!
ERROR: GetNode: omap entry oid 216bd3 xid 4b86b7 not found.
Volume 1: Preboot
Volume 2: Recovery
Volume 3: VM
Volume 4: Untitled
Volume 5: Untitled 2
Volume 6: Sin título
Volume 7: Sin título 2

The dump file weights 242M, so I'm not joining it.

Thanks for your time and this great project. Hubert

sgan81 commented 4 years ago

Hmmm ... looks like some filesystem corruption to me.

You could also try mounting some older xid. This is not currently implemented though. In ApfsContainer.cpp, method ApfsContainer::Init(), line 105, change the following:

if (sb->nx_o.o_xid > max_xid)

to

if (sb->nx_o.o_xid == 0x4b86b6)

The value is the transaction id (xid) you're trying to mount. So if 0x4b86b6 does not work, decrement until it does. It is not guaranteed that it does, though ...

If you want me to analyze your dump file, feel free to gz it (should reduce it's size by about 90%) and mail it to me.

romdim commented 3 years ago

I just have to say that you saved me a lot of time @sgan81! In my case, changing the line as you mention made every file and folder that wasn't even visible before to magically be visible, copied, etc. Thanks a lot!

(It is a bit weird though that a random hex makes it work like that but I haven't checked any of the rest of the code to get to know what happens like so)

sgan81 commented 3 years ago

Actually, in the current version, there is a command line parameter for that ... no need to change source code anymore. But glad it worked :)

romdim commented 3 years ago

Out of curiosity, which command is that? Thanks again!

sgan81 commented 3 years ago

It's the xid= mount option.