====== SnapRAID - Scrub for Bit Rot ======
Over time, files can become corrupted due to bit rot.
* SnapRAID can scrub files to detect and correct errors.
----
===== Scrub =====
sudo snapraid scrub
**NOTE:** This command verifies the data in your array comparing it with the hash computed in the "sync" command.
* Every run of the command checks about the 8% of the array, but not data already scrubbed in the previous 10 days.
----
===== Scrub using different options =====
The **-p**, **--plan** option can be used to specify a different amount, and the **-o**, **--older-than** option to specify a different age in days.
For example, to check 5% of the array older than 20 days use:
sudo snapraid scrub -p 10
**NOTE:** Scrubbing should be run periodically to catch issues before they become serious.
* **-p 10**: limits scrubbing to 10% of files, reducing disk wear.
----
===== Errors found during a scrub =====
If during the scrub process, silent or input/output errors are found, the corresponding blocks are marked as bad in the "content" file, and listed in the "status" command.
snapraid status
To fix them, you can use the **"fix"** command filtering for bad blocks with the **-e**, **--filter-error** options:
snapraid -e fix
**NOTE:** At the next "scrub" the errors will disappear from the "status" report if really fixed.
* To make it fast, you can use **-p bad** to scrub only blocks marked as bad:
snapraid -p bad scrub
**WARNING:** Take care that running "scrub" on a not synced array may result in errors caused by removed or modified files.
* These errors are reported in the "scrub" result, but related blocks are not marked as bad.
----