Question renamed from: « Diagnosing what's going wrong with the fusion drive of an iMac 27'' 2019 A2115 EMC 3194 » after the origin of the problem could be located.
Having a non-booting iMac using fusion drive, with a 32GB SSD and 1TB HDD, I would like attempt restoring it without loosing the data. I can still start the iMac in recovery mode and issue commands through the terminal.
I did two external clones of both the SSD and HDD. There were no errors during the cloning. Furthermore the sha1 /dev/...
command confirmed identical SHA1 hashes for the original disks and their clones. So, I can restore the situation by cloning in the other direction if necessary.
-bash-3.2# diskutil list
/dev/disk0 (internal):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme 28.0 GB disk0
1: EFI EFI 314.6 MB disk0s1
2: Apple_APFS Container disk3 27.7 GB disk0s2
/dev/disk1 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk1
1: EFI EFI 209.7 MB disk1s1
2: Apple_APFS Container disk3 1000.0 GB disk1s2
/dev/disk2 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme +2.1 GB disk2
1: Apple_HFS macOS Base System 2.0 GB disk2s1
/dev/disk3 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +1.0 TB disk3
Physical Stores disk0s2, disk1s2
1: APFS Volume Preboot 185.9 MB disk3s2
2: APFS Volume Recovery 510.6 MB disk3s3
3: APFS Volume VM 2.1 GB disk3s4
(...)
diskutil verifyDisk /dev/disk1
reveals that the problem comes from the EFI partition on the mechanical hard drive:
This first problem could be corrected. See "Edit" section below.
-bash-3.2# diskutil verifyDisk /dev/disk1
Started partition map verification on disk1
Checking prerequisites
Checking the partition list
Checking the partition map size
Checking for an EFI system partition
Checking the EFI system partition's size
Checking the EFI system partition's file system
Problems were found with the partition map which might prevent booting
Error: -69766: The partition map needs to be repaired because there's a problem with the EFI system partition's file system
Underlying error: 8
I assume that I should destroy the GPT of the HDD and create it again, or at least modify it.
In David Anderson's answer here, one can see how to remove GPT entries and create ones. But I am not sure if I should create again the GPT of the HDD with the same values or if some have to be corrected.
Here's the output of gpt -r show disk1
for the HDD:
gpt -r show disk1
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
409640 1953115488 2 GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
1953525128 7
1953525135 32 Sec GPT table
1953525167 1 Sec GPT header
Edit
I deleted the EFI partition and created it again. diskutil info disk1s1 (and made screenshot of partition info) diskutil umountDisk disk1 (unecessary, but just to be sure)
gpt remove -i 1 /dev/disk1
gpt add -i 1 -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B /dev/disk1
gpt -r show disk1 (verify gpt table)
diskutil info disk1s1 (verify that the partition is still FAT32 and EFI
diskutil verifyDisk /dev/disk1 (verify partition map on disk1)
The partition map is now OK for disk1.
The verification fails on the verification of the volume, on disk0s2:
error: fusion_mid_tree: btn: invalid o_oid (0x0)
Fusion data structures are invalid
The volume /dev/disk0s2 could not be verified completely
Storage system check exit code is 8
Error: -69716: Storage system verify or repair failed
Underlying error: 8
When calling diskutil resetFusion
(the iMac seems using Mojave), only the rotational disk (HDD) is detected:
diskutil resetFusion
Internally-located hardware disk device known to the currently-running macOS:
Rotational (disk1)
Volumes exported by partitions or storage systems hosted on the above device:
Your computer must have exactly 1 solid-state and 1 rotational disk drive.
In summary, the problem seems coming from the fact that although the SSD is listed by diskutil, it is is ignored for the fusion drive. So, the question is how to repair the fusion data structures?
diskutil verifydisk /dev/disk3
is the wrong one to use. You should usediskutil verifyvolume /dev/disk3
instead. You will probably get the same results as when you ran First Aid on Container disk3 in the Disk Utility. Note: The Disk Utility will show more information if you select "Show All Devices" from the "View" menu. – David Anderson May 17 '23 at 20:59diskutil resetFusion
was listing the SSD but not the HDD. – OuzoPower Jun 03 '23 at 11:36