Repair more than 3500 bad blocks in 160 Gb samsung HDD using Ubuntu 12.04
Solution 1:
Make a backup of your data NOW and source a replacement disk. 3500 bad blocks is excessive and no block mapping is going to result in a stable working disk for very long. That many bad blocks is a sign of impending hardware failure.
Solution 2:
You can use recovery tools like ddrescue to dump out an image file of the entire drive, there are options to keep a log of bad blocks and the tool will first recover all readable data, you can also prioritize different parts of the drive. Other tools like basic file copy, or classic dd will error out on the 1st bad block encountered, or they will repeatedly re-attempt to access those bad blocks that are encountered. You can then go back using the logfile as input and re-attempt each unreadable sector, often times you will be able to recover more than half of the bad sectors.
This at least gives you the ability to partially reconstruct files on otherwise unreadable file systems or un-bootable operating systems. You can then use other forensic tools against your disk image file. For example, to search through raw filesystem data for JPEG images.
Beware of the syntax of input and output devices, I know there used to be one variant of ddrescue out there that had BACKWARDS input and output syntax when compared to classic dd. This caused some users to inadvertently copy their target drive over the source data they were trying to recover! There are no warnings about overwriting existing data.