1

I'm running Snapraid on my hard drives. However, I want to test it's data integrity features, to see how/if they actually work.

But I don't really understand how to 'corrupt' my data. I can just manually change the contents of my files. However, Snapraid will just sync this change normally. And Snapraid fix will automatically revert the files to before the change.

But how do I test an actual data corruption, and how do I know if Snapraid has actually fixed it?

RazorHail
  • 165
  • 1
  • 8

2 Answers2

2

Maybe this works. At first sync your data:

snapraid sync

Now check the size and timestamps of your file

stat foo.txt

Now create a backup of the timestamps:

touch -r foo.txt foo.timestamps

Next step is to change foo.txt through an file editor like vi / nano without changing the filesize (replace one character).

After that restore the timestamps:

touch -r foo.timestamps foo.txt

Delete the timestamp backup file:

rm foo.timestamps

Check and compare the results

stat foo.txt

Check for new files

snapraid diff

It shouldn't return anything as we did not change the filesize and timestamp of foo.txt.

Finally start a full scrub:

snapraid scrub full

Now snapraid creates checksums of all files and compares them with the metadata and foo.txt should be listed as fixable file.

mgutt
  • 459
  • 6
  • 22
0

Looks like snapraid backups the parity info of your raid array. If you using a hardware raid controller that supports hot plug and you using anything but a raid 0, unplug a drive then plug it back in. A rebuild will start on the virtual disk. Once the rebuild starts run a chkdsk or fsck on the virtual disk. That will cause the parity bits and file system to become out of order this corrupting your array. Snap drive documentation says it cannot handle large parity corruption so, might not be the best way.