This article will show you how to recover bad sectors of your hard drive. This can be done on a Windows computer and Mac OS X. Please note that hard drives that are physically damaged cannot be repaired using software - such drives must be repaired by a specialized workshop.
Steps
Method 1 of 2: On Windows

Step 1. Connect the drive to your computer (if needed)
If you want to recover from a faulty external hard drive or flash drive, plug it into one of the USB ports on your computer.
Skip this step if you need to repair the internal hard drive

Step 2. Open the Start Menu

Click on the Windows logo in the lower left corner of the screen. You can also press the ⊞ Win key to open this menu.

Step 3. Open an Explorer window

Click on the folder icon on the left side of the Start menu.

Step 4. Click on This PC
It's a folder in the left pane of the Explorer window. The This PC window opens.

Step 5. Select a hard drive
In the "Devices and Drives" section, click on the hard drive that needs to be repaired.
Typically, your computer's internal hard drive is labeled "C:"

Step 6. Click the Computer tab
It's in the upper left corner of the window. The toolbar will appear.

Step 7. Click Properties
It's a red checkmark icon in the left corner of the toolbar. The Properties window will open.

Step 8. Click the Service tab
It's at the top of the window.

Step 9. Click Check Now
It's on the right side of the Check Disk for Errors section at the top of the Properties window.

Step 10. Click Run when prompted
The disk will be checked for bad sectors.

Step 11. Wait for the verification to complete
A window with the scan results will open.

Step 12. Click Check and Repair Disk when prompted
It's near the bottom of the pop-up window. Windows will begin fixing disk errors; this means that the system will format bad sectors, move files from bad sectors to intact ones, or perform other actions.
To resolve all errors, click "Check and Repair Disk" several times
Method 2 of 2: On Mac OS X

Step 1. Connect the drive to your computer (if needed)
If you want to recover from a faulty external hard drive or flash drive, plug it into one of the USB ports on your computer.
- Skip this step if you need to repair the internal hard drive.
- You may need a USB3 to USB-C adapter if your Mac does not have standard USB ports.

Step 2. Open the Go menu
It's at the top of the screen.
If you don't see this menu at the top of your screen, click on the Finder icon in your dock or click on your desktop

Step 3. Click on Utilities
You will find this option at the bottom of the menu.

Step 4. Launch Disk Utility
Double-click the gray hard drive icon with a stethoscope.

Step 5. Select a hard drive
In the upper left corner of the window, click on the hard drive you want to fix.

Step 6. Click the First Aid tab
It's a stethoscope-shaped icon at the top of the Disk Utility window.

Step 7. Click Run when prompted
Disk Utility will check and repair bad sectors of the selected hard drive.

Step 8. Wait until the check is over
A pop-up window will open with information about the fixed errors.
If there is no data in the window, there are no bad sectors on the hard disk

Step 9. Run Disk Utility again
Do this if the pop-up has information about fixed bugs to find other bugs. As soon as Disk Utility stops informing you about the corrected errors, consider that the hard disk is recovered.