It’s recommended to replace the HDD if it has a lot of bad sectors as it may lead to drive failure. You can run CHKDSK command from the command prompt which reallocates bad sectors so that the data that you store the next time isn’t stored on those bad sectors. Running CHKDSK might result in permanent data loss in some situations.