Faulty hard drive

This computer had a faulty hard drive that worked for long periods then stopped….. but would then work again the next day.
Tested with another hard drive to be sure it was that and ordered a SSD to replace.