3

I have a drive with bad blocks. The filesystem is aware of them, and I read that you can feed e2fsck with a badblocks repport to inform the file system that there are some bad blocks. (I think the option -c in fsck is doing the same thing.)

If I format the partition and get rid of the file system, so is all information about bad blocks lost? Need I inform the new file system about bad blocks? Or will the SMART system do so for me?

Thanks!

cat
  • 1,632
  • 1
  • 24
  • 47
Jitsumi
  • 71
  • 1
  • 4
  • This might be more suited to [Unix.SE] considering it's not specifically about Ubuntu, but more about, well, [Unix.SE]. – cat Jan 09 '16 at 16:13
  • I'm surprised there's no answer for this on the first 5 pages of google. – cat Jan 09 '16 at 16:14
  • Yes, I was looking around but did not find anything (or did not find the good key words to look for it...) – Jitsumi Jan 09 '16 at 16:15
  • It looks like [this](https://community.spiceworks.com/topic/305475-where-is-the-information-stored-that-says-where-bad-sectors-are-located) is in the right *direction*. – cat Jan 09 '16 at 16:17

1 Answers1

2

From the vastcough amount of research I've come across in the last five minutes, for instance this and this (from SU.SE), it would appear that device-wide metadata about bad blocks is stored in the Master Boot Record or GUID Partition Table (the disk's partition table that starts at address 00000000: 0x00).

It seems unlikely it would be stored in the partition's filesystem's table of contents. Anyways, the information will only go away if you write the disk a new partition table, which will irreversably destroy all data on the entire disk.


If you're using a disk that has bad blocks for anything remotely mission-ciritical (or even your own data), that disk is bound to fail irreparably in the near future, and it's cheaper and easier and safer to buy a new disk.

cat
  • 1,632
  • 1
  • 24
  • 47
  • 1
    Thanks The size of the MBR is only 512 bytes, and I checked the structure, i don't think there is space reserved for this purpose. – Jitsumi Jan 09 '16 at 16:58
  • Well, there's nowhere else on the disk for them to be stored. It's possible Linux (perhaps `mount`, `fsck` or `udev` and the kernel) has a list of them somewhere for its own use, but that list is incidental. – cat Jan 09 '16 at 16:59
  • 1
    From what I read (for example this: http://superuser.com/questions/600075/are-hard-disks-bad-sectors-filesystem-dependent), I think bad blocks are both stored in the file system and in the microcode (managed by SMART?) of the hard drive. So I guess if I format the hard drive, the new file system will not be aware of the bad blocks, but it's ok because SMART will not let the OS access them. However I did not find formal information about this, only people discutting about it on forums. – Jitsumi Jan 09 '16 at 17:03
  • Also, I think the microcode of a hard drive can handle only a limited number of bad sectors, what happen after? Is the file system wil lbe able to manage them? I guess if you reach this point, better to change of hard drive as soon as possible. And yes, I agree, when you start to have bad blocks, better to change of hard drive as soon as possible. – Jitsumi Jan 09 '16 at 17:04