ZFS scrub = ?data checker + hardware checker?

Status
Not open for further replies.

fisheater

Explorer
Joined
Jun 29, 2011
Messages
53
Hi all,

I searched for this and wanted to clarify just what ZFS scrub does.

From: http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide
Run zpool scrub on a regular basis to identify data integrity problems.

From: http://en.wikipedia.org/wiki/Data_integrity
the representational faithfulness of information to the true state of the object that the information represents, where representational faithfulness is composed of four essential qualities or core attributes: completeness, currency/timeliness, accuracy/correctness and validity/authorization.

At this point, I am unclear on its exact function.

I like the data integrity verification and other features that ZFS offers, but do I need to run scrub to check my data and my hard drive platters? If not, how is that done?

Thanks!

FE
 

Milhouse

Guru
Joined
Jun 1, 2011
Messages
564
The ZFS system includes checksums of your data on each disk. Over time, it's possible for data to become corrupt on individual disks, known as "bit rot", and scrubbing your array will ensure the integrity of the data on your disks is maintained. ZFS will compare the data on each disk against the same data/checksums from the other disks and correct those disks that have "rotted". It will also do this on-the-fly as you access data, but periodic scrubbing is recommended to ensure that the integrity of all of your data is maintained (I guess it's possible that you might not access a particular file for a number of years, during which time the data on all of your disks could "rot" meaning it would be impossible for ZFS to recover the data).

Scrubbing is recommended once a week on consumer drives, and once a month on enterprise/datacenter-quality drives (the difference accounted for by the latters superior uncorrectable bit error rates).

By default, FreeNAS will automatically schedule a scrub every 30 days following the most recent scrub, unless you schedule your own scrub manually at the command line/cron (zpool scrub <poolname>) or via the GUI (Storage -> View All Volumes -> Scrub Volume).
 

fisheater

Explorer
Joined
Jun 29, 2011
Messages
53

Milhouse

Guru
Joined
Jun 1, 2011
Messages
564
I am still unclear if the scrub also checks the HD platters for bad sectors and then prevents the system fro using them. Thanks for clarification.

Ah no, ZFS doesn't specifically handle bad sectors/bad blocks, however modern hard disks (and certainly all SSDs) are able to detect bad sectors and replace them with good sectors from a pool of "spares" (recorded in the SMART Reallocated Sector Count). With both scrubbing and bad sector reallocation (the latter quite likely being "triggered" by the former) I think you should be covered.
 

fisheater

Explorer
Joined
Jun 29, 2011
Messages
53
Thanks, this is solved!

FE
 

fisheater

Explorer
Joined
Jun 29, 2011
Messages
53
Oops, had a small error. Please let me know if you see an procedural error in setting this up. Last scrub was 14 days ago.

1. Copied your script from: http://forums.freenas.org/showthread.php?2685-FreeNAS-Mini-iXsystems&p=11197&viewfull=1#post11197 and changed my email address.
2. Put that file called scrub.sh on my RAIDz
3. chmod u+x scrub.sh on my FN box
4. set up cron job
00 04 Every 7 days Every month Everyday root /mnt/FreeNAS/ZFS/FreeNAS_Scripts/scrub.sh
5. Received this error msg this AM and scrub had not run.
+++ /var/log/3ware_raid_alarms.today 2011-11-20 03:02:11.000000000 -0700 @@ -0,0 +1 @@ +

I admit this is a bit of a cut and paste job following your previous post, this is only my 2nd script I have worked with. The other was the rsync task for my desktop.

Thanks for your insight.

FE
 

Milhouse

Guru
Joined
Jun 1, 2011
Messages
564
5. Received this error msg this AM and scrub had not run.

The 3ware error message is not related, everyone gets that in the daily email.

Can you run the script from the command line, rather than via cron? Log in, then run the script by entering "/mnt/FreeNAS/ZFS/FreeNAS_Scripts/scrub.sh" - before doing so I'd temporarily comment out the "zpool scrub" command (put a # at the beginning of the line) so that it doesn't take forever to finish. Can't think why it's not working, sounds like you've done everything correctly (just make sure you saved the file in Unix file format, that can screw things up).
 

fisheater

Explorer
Joined
Jun 29, 2011
Messages
53
Milhouse, thanks for your insight. I think I have figured it out, will confirm on next run.

I put the .sh file together on my Win7 computer in notepad. It called it scrub.sh.txt then I renamed it scrub.sh. When I went to my FN machine, and used the command line, it was still called scrub.sh.txt. Despite renaming it via command line to scrub.sh, it didn't work. I redid the file via linux and gedit and ran it manually at the command line, and it worked - confirmed by email update.

Now I have reworked my cron job to reflect the new file. I'll post if it runs in the AM.

Also, the I get the "3ware error" 3-4 out of 7 days. Thanks for letting me know its common.

FE
 

Milhouse

Guru
Joined
Jun 1, 2011
Messages
564
Yeah, Notepad and Unix don't really get along... there are several tools/tricks for converting Windows/DOS files to Unix format, it's a shame dos2unix isn't included with FreeNAS but in its absence "tr -d \r < scrub.sh.txt > scrub.sh" should do the trick.
 

fisheater

Explorer
Joined
Jun 29, 2011
Messages
53
Good news, problem solved. Once it was written (i.e. cut and paste) in gedit on linux, the FN box accepted the script. It is now running.

And as a touch of finesse, I changed to path to /mnt/FreeNAS/ZFS/.scripts/scrub.sh so that there is no accidental deletion of the file by another user cleaning up the RAIDz.

Officially solved. Thanks again.
 
Status
Not open for further replies.

Similar threads

D
Replies
0
Views
17K
dlavigne
D
Top