Linux – Recover or Mark Bad Sectors on External Hard Drive

bad-sectorsexternal hard drivelinuxUbuntuubuntu-9.10

I've just installed the new version of Ubuntu, Karmic Koala, in my laptop. Everything is fine, except for the fact the system identified about 300 bad sectors in my 1TB external hard drive. I'd like to recover or just mark then. Is there any free utility, that I can run on Linux, to accomplish this?

Update:

The partition is formatted in NTFS.

Thanks in advance

Best Answer

If the OS itself is showing bad sectors, then your drive is going downhill. The hardware should be removing bad sectors from service transparently, and it may have run out of spare sectors to remap to. If this is the case, your data is very much at risk.

I'd take David's suggestion to heart and migrate your data ASAP. You may want to install "smartmontools" and run smartctl to see what the device itself reports.

You can try using the "badblocks" utility on the raw device which houses your NTFS drive, since it works on the device and is not filesystem dependent. Make sure you read the man pages CAREFULLY and use the non-destructive mode. It should be able to read each sector, then re-write each sector. Doing this should force the drive itself to remap any problematic sectors. Test this procedure on a USB stick or some other media first.

I recommend you tell badblocks to process a large number of sectors at a time, since a 1TB drive will take a very long time to scan.

Again... make sure you know what you are doing. One slip and your data is toast.

If the data is valuable to you and you're not confident in your abilities, you may wish to use a commercial solution such as SpinRite (though, it's pricey and will require a Windows machinie). Note, I've never used SpinRite, but I've heard good things about it online.

Related Question