How to fix a bad boot sector on a hard drive?
How to repair a boot sector?
You don't. You just replace the faulty hard drive component, reinstall the OS and move on.
It's not rocket science
https://vladsitworld.blogspot.com/2018/02/how-to-repair-boot-sector-problem.html