# [REMINDER] This is why you should always backup!



## youngunix (Oct 8, 2013)

I do a disk check once in a while, and today I found a nice surprise:

http://i618.photobucket.com/albums/tt267/knewbee21/bad-disk_zps8491a739.png


----------



## wblock@ (Oct 8, 2013)

sysutils/smartmontools can be configured to mail you if a disk starts to have problems.


----------



## Crivens (Oct 8, 2013)

What can you warn even before S.M.A.R.T. gets wise to something is ZFS. All disks which developed problems in my home were pointed out to me by ZFS scrub, and only after that the disk itself found it had a problem.


----------



## zspider (Oct 8, 2013)

I switched to ZFS on my server after finding that there were a couple of bad sectors that took out a couple of replaceable files. It does ZFS scrub every night. I was gonna chuck the drive but so far ZFS has shown no further issues, saving me from buying a new drive.


----------



## SirDice (Oct 8, 2013)

If you have bad sectors, replace the drive. Bad sectors start showing up when the drive can't map them anymore to a spare bit of space on the drive. The firmware takes care of this and you never notice it (you can't even access that spare bit of space).


----------



## Crivens (Oct 8, 2013)

Well, it can happen that the sectors get bad between writing them and then reading them back. The "realloated sector count" of the SMART output should tell you more.


----------



## wblock@ (Oct 8, 2013)

The reallocated sector count starts increasing when the drive finds a bad block on write.  A drive that starts growing new bad blocks might work for another five years, or might fail in hours.  Don't trust such a drive.


----------



## youngunix (Oct 8, 2013)

Fortunately, that's not FreeBSD. It's Linux that I've been using since 2009.
Like @wblock@ mentioned, do not trust a drive with bad sectors. So, I used `dd` to copy the entire partition to another drive (smaller & slower) but just in case the current one decides to die.


----------



## zspider (Oct 9, 2013)

I'm gonna acquire a new bigger drive, the drive is a deathstar (had a bad experience with one years ago) and it's about 4 years old, so it's probably time for it to get moved to the retirement home.


----------



## Crivens (Oct 9, 2013)

wblock@ said:
			
		

> The reallocated sector count starts increasing when the drive finds a bad block on write.  A drive that starts growing new bad blocks might work for another five years, or might fail in hours.  Don't trust such a drive.



As soon as these numbers start growing, it's time to mistrust the drive. But sadly all new drives come with bad blocks already, so these numbers are most likely never zero. When you get a new drive, be sure to write it completely using `dd` and check the values before and after. Drives with no bad blocks at all, those I have not seen for ages.

Somewhere I read that you can refresh the informations using `dd if=/dev/ada0 of=/dev/ada0` on an unmounted drive, reading each sector and rewriting it to the same place. This should get the drive to find bad blocks without the help of ZFS, maybe it even can prevent some bad blocks by reading and rewriting them before they detoriate too much for the error correction in the firmware to fail them. If anyone knows more about this, or has used that method, I would like to hear some experience.


----------



## wblock@ (Oct 9, 2013)

Crivens said:
			
		

> But sadly all new drives come with bad blocks already, so these numbers are most likely never zero. When you get a new drive, be sure to write it completely using `dd` and check the values before and after.



There are manufacturer defects, and there are "grown" defects.  New drives will have a reallocated sector count of zero.  They probably had errors, but those were mapped out at the factory and are not a problem.  "Grown" errors are when new parts of the disk that previously passed a test start failing, and those are the ones that will show up in the reallocated sector count.

The SMART long test (`smartctl -t long /dev/ada0`) seems to test every block.  It takes about the same amount of time as a `dd` to every block, anyway.


----------

