Sometimes, macOS partition went wrong which Disk Utility couldn't recover it. Most of time, it is not a hardware failure but software failure. My iMac had 2 Fusion Drive failures which let me delete all the things and recovered from Time Machine backup. It was a painful experience because it is Terminal related method which requires a lot of commands. During beta period, no one could help you. I think I will lose all yearlong asset. Luckily, I've found an easy method to recovery all the things.
Recently, when I upgraded my iMac to macOS High Sierra Developer Beta 3, I hit with another disk failure, "APFS fsroot index invalid". My machine was in between no turning back and successful upgrade. (You couldn't rollback because Time Machine was disable in Beta 2 Update 1.) The upgrade fails because the disk verification isn't successful. So the installer cannot move the files back into their places. Disk Utility cannot fix the problem (as expected). I can use the recovery drive and Terminal to investigate that the file system isn't broken. You cannot use Time Machine to backup things at this point and it is difficult to manually copy all files to external drive. So, I think differently.
Let's install macOS to external drive and use Migration Assistant to migrate files from internal drive!
You need to have
- One external drive which can hold all data. I've 3 TB Fusion Drive but is consumed around 1.5 TB. I use the old 2 TB Time Machine backup drive for this case.
- A working recovery drive. Luckily, macOS High Sierra Beta 3 have upgraded my recovery drive to the latest version. So, I can boot into it and start working from that.
- Connect the external drive to the machine. Boot into the recovery drive.
- Use Disk Utility inside the recovery drive to cleanup the external drive.
- Use "Reinstall macOS" to install the latest version available of macOS to the external drive. In this case, I get macOS High Sierra Developer Beta 3.
- After the macOS installation, use Migration Assistant wizard to migrate all data from internal hard drive. Because this is the software issue, the data should be safe and untouched.
- After the migration, verify that the data is in place as expected.
- Boot into the recovery drive on the external drive.
- Use Disk Utility to cleanup the internal drive. Verify that the disk failure has been gone.
- Reinstall macOS to the internal drive.
- As you may guess, use Migration Assistant wizard to migrate all data back from external drive!
This method should be risk free and easy for general user unless you cannot cleanup the internal drive (Fusion Drive related issue). If that has happened, you may need to fire up terminal and enter commands to destroy and recreate the Fusion Drive before proceed steps.