Error in Apfs cause data loss

My external SSD 480GB drive has been formatted as APFS after installing 10.13. Then I copy whole system disk to backup in it. After some test for boot from the external SSD and works well, a failure restart causes the disk falls to mount and display as an error in 'APFS Container Scheme' section below. Anyone know if it can be recovered?

Following is listing the disks for my external SSD part:




/dev/disk4 (external, physical):

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *480.1 GB disk4

1: EFI EFI 209.7 MB disk4s1

2: Apple_APFS Container disk5 479.9 GB disk4s2

/dev/disk5 (synthesized):

#: TYPE NAME SIZE IDENTIFIER

0: APFS Container Scheme - +ERROR disk5

Physical Store disk4s2





Repairing storage system

Performing fsck_apfs -y -x /dev/disk4s2

Checking volume.

Checking the container superblock.

Checking the EFI jumpstart record.

Checking the space manager.

Checking the object map.

Checking the APFS volume superblock.

Checking the object map.

error: om: btn: invalid o_oid (0x0)

Object map is invalid.

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

Storage system check exit code is 8.

Storage system verify or repair failed.

Operation failed…

Replies

I had a same issue with one of my disks. Unfortunately I wasn't able to find a way to fix this but so far there are 2 ways to recover your data:


1. Try to mount the volume in Linux using FUSE. I installed a latest Ubuntu (to get latest cmake and other packages), compiled apfs-fuse (https://github.com/sgan81/apfs-fuse) and mounted the volume. If there are any headers missing during compilation - just google them and first links in Google will tell you which packages to install.

If you're lucky enough the volume will be mounted and you'll see your files. Don't forget that the filesystem IS corrupted and ANY action can cause a segfault. I had 20Gb of AWR images, tries to copy them using "cp -rv" but eventually attempting to copy one of the files FUSE segfaulted and I had to mount the volume again, and conftinue copying other files (the one which caused segfault is lost - skip it).

This method is time consuming and I can't guarantee that it's gonna work but at least it's free.


2. Use third-party software. Just google "recover APFS" or something like this and you'll get some results. Use trial version to see if files can be recovered and if so - get a full version and it will recover your files. Usually those apps cost $60-$80, my pictures didn't cost that much that's why option 1 was enough.


When the data is in safe place destroy APFS on your device and re-format it in something else. I didn't know that APFS had some limitations (which do not make ANY sense to me, it's completely wrong) and I payed for my stupidity with my time, at least data is safe.