Question: Disk damaged or not?
So I was running my A* algorithm implementation for a specific problem on my iMac (late 2013 with macOS High Sierra). At the end the iMac freezes and I had to force a reboot by pressing the power button. When I restart my mac it got stuck on the progress bar (at 100%) and after quite an hour I give up and I pressed the power button shutting it down. So I tried a start up in Safe Mode with Verbose Mode. The result was:
disk0s2: I/O error.
disk0s2: IO failed, error = 5.
So I tried to:
- reset the NVRAM by pressing CMD + OPTION + P + R at startup
- check the file system in Recovery Mode, in Disk Utility, with fsck -fy (and then also /sbin/fsck -fy), repeating the command 2 times since the first time the result was that the system was modified, while the second time the result was that it was OK. But after rebooting in verbose mode (with CMD + V) same I/O error.
- check the file system in Recovery Mode, in Disk Utility, with /sbin/fsck_hfs -S /dev/disk0s2, for scanning the entire disk for bad blocks and /sbin/fsck_hfs -drfy /dev/disk0s2 to force a repair. But again, after rebooting same I/O error.
- do a Apple Hardware Test (rebooting while pressing D). No problems, but again, after rebooting same I/O error.
- do a SMC reset. Same result.
So at the end i bought a Thunderbolt cable and i connect the iMac to my MacBook Air in Target Disk Mode.
There I could read the iMac disk as an external drive and I could backup all my data on the MacBook.
(So my guess is that the problem wasn't the disk???).
Then I tried a Target Boot Mode of the iMac on the MacBook but the result was the same I/O error. (So the problem was a software problem???).
At the end I tried to reinstall the OS in recovery mode and after the installation the iMac was working fine.
So my question is: should I be fine with this or should I be thinking of replace the HDD whit a new one (maybe a SSD) for preventing new failures (since the hard disk has now more then 5 years)?? And in that case is it enough to replace the HDD or should I replace also other components?? Thank you for the support and all the answers.
iMac (21.5-inch, Late 2013), macOS High Sierra (10.13.1)