APFS woes on external drive - failed disk / drive repair
Backstory
I've been successfully using an external Samsung 1tb - EVO SSD via USB3 with macbook pro for over 6 months. I boot to this device. Last week the usb cord came disconnected - (at the time, I was troubleshooting other macs and wasn't paying close attention) I fatally plugged it back into usb port only on other side of mac causing drive to fail. This began a week long deep dive into apfs drive corruption.
Symptoms
Started file system verification on disk3
Verifying storage system
Performing fsck_apfs -n -x /dev/disk2s2
Checking volume
Checking the container superblock
Checking the EFI jumpstart record
Checking the space manager
error: (oid 0x8790) cib: invalid o_xid (0x63f69)
error: failed to read spaceman cib 0x8790
Space manager is invalid
The volume /dev/disk2s2 could not be verified completely
Storage system check exit code is 0
Finished file system verification on disk3
**+-- Container ERROR -69808
======================
APFS Container Reference: disk4
Size (Capacity Ceiling): ERROR -69620
Capacity In Use By Volumes: ERROR -69524
Capacity Not Allocated: ERROR -69524
|
+-< Physical Store disk3s2 B8843099-2B4F-4D1B-909A-DB5B1B516B9C
| -----------------------------------------------------------
| APFS Physical Store Disk: disk3s2
| Size: 999666946048 B (999.7 GB)
My findings that came out from this is -
APFS seems to be only suitable for internal Apple drives only which provide ECC protection.
Data corruption can't be successfully recovered as Apple hasn't disclosed internals of apfs mechanics to other vendors / eg. diskwarrior. https://www.alsoft.com/DiskWarrior/index.html
APFS AFRO.
I found this tool which can actually read partitions to recovery directory / files
While I haven't had success with above tool - I did have success using disk drill to dig out buckets of files by file type but lost file/folder structure in process. Now I'm at a dead end with attempts to fix partition.
TAKEAWAY
Maybe someone from Apple APFS engineering team will read my plight use case above, try this simple use case of of disconnecting and reconnecting usb to other port and come up with a fix in disk utility. Shouldn't APFS handle this case and be able to recover? Or perhaps consider an improvement to UX where OS would reboot instantly preventing data corruption. Or perhaps discourage the use of APFS on external drives which don't offer ECC protection out of the box, as my understanding is APFS can't do error correction as ZFS offers out of the box.
MacBook Pro with Retina display, iOS 11.4