4

My SATA drive is from 2009 and has been under some circumstances where it's not "Pleasant" for the drive, such as blackouts (lots of them). On Ubuntu 12.04 SMART reported 4029 bad sectors. I often do a zero-fill on the drive and I read that it reallocates those bad sectors. So, if it do a reallocate, why "a failure is imminent"? Why should I worry?

Also, any tips on how to prevent this will also help!

Júnior
  • 41

2 Answers2

3

First of all you should take a backup.

Now should you worry! Mmmm. Ok let's first define a bad sectors.

There are two types of bad sectors — often divided into “physical” and “logical” bad sectors or “hard” and “soft” bad sectors.

  • A physical — or hard — bad sector is a cluster of storage on the hard drive that’s physically damaged. The hard drive’s head may have touched that part of the hard drive and damaged it, some dust may have settled on that sector and ruined it, a solid-state drive’s flash memory cell may have worn out, or the hard drive may have had other defects or wear issues that caused the sector to become physically damaged. This type of sector cannot be repaired.

  • A logical — or soft — bad sector is a cluster of storage on the hard drive that appears to not be working properly. The operating system may have tried to read data on the hard drive from this sector and found that the error-correcting code (ECC) didn’t match the contents of the sector, which suggests that something is wrong. These may be marked as bad sectors, but can be repaired by overwriting the drive with zeros — or, in the old days, performing a low-level format.

Ok now how to repair these bad sectors in Linux:

Open a terminal window.

Type the following command:

 sudo e2fsck -cfpv /dev/sdXX

Replace "sdbX" with your actual device name, this can be an entire drive, such as "sda" or a partition, such as "sda1. "

The parameters have the following meanings:

  • "c" searches for bad blocks and adds them to the list
  • "f" forces a check on the file system
  • "p" repairs anything that can be safely repaired
  • "v" is verbose mode so you can see the command progress.

The "e2fsck" command can take a long time to run, even several hours on a particularly large drive.

Exit the terminal after the "e2fsck" command is finished.

Now it's better to run e2fsck on unmounted disks, so I advise you to do it using a live CD.

Learn more about e2fsck man e2fsck

source

Braiam
  • 67,791
  • 32
  • 179
  • 269
Maythux
  • 84,289
0

Define "worried"?

How valuable is your data ? If you value your data you should have a working backup period. It is not a matter of if a hard drive will fail, but when.

4029 bad sectors and having to zero fill your hard drive are indications that the drive is failing.

Panther
  • 102,067
  • Actually I don't have the need to do the zerofill, but I do it periodically. The number doesn't increase, it stays the same, how does that define a failing drive? It's been "failing" for years now =P – Júnior Mar 12 '13 at 21:14
  • My point is that you should have a backup. I have seen drives last a long time with bad sectors and I have seen them fail with little or no warning. Bad sectors as you know are one measure of wear and tear on your drive. I would probably zero write the drive less. – Panther Mar 12 '13 at 21:18