大网数据广告活动
服务器运维问答

How to test Snapraid data corruption?

· 52CE 我爱测

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…

问题原文

原帖链接 · RazorHail · CC BY-SA 4.0

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?

已采纳解答

原帖链接 · mgutt · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-02-21)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。