Use the command chkdsk *: /f /r /x (replace * with your drive letter) in the Command Prompt to fix file system errors and locate bad sectors.