1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887
|
.TH "SnapRAID Backup for Disk Arrays" 1
.SH NAME
snapraid \- SnapRAID Backup for Disk Arrays
.SH SYNOPSIS
snapraid [\-c, \-\-conf CONFIG]
.PD 0
.PP
.PD
[\-f, \-\-filter PATTERN] [\-d, \-\-filter\-disk NAME]
.PD 0
.PP
.PD
[\-m, \-\-filter\-missing] [\-e, \-\-filter\-error]
.PD 0
.PP
.PD
[\-a, \-\-audit\-only] [\-h, \-\-pre\-hash] [\-i, \-\-import DIR]
.PD 0
.PP
.PD
[\-p, \-\-plan PERC|bad|new|full]
.PD 0
.PP
.PD
[\-o, \-\-older\-than DAYS] [\-l, \-\-log FILE]
.PD 0
.PP
.PD
[\-s, \-\-spin\-down\-on\-error] [\-w, \-\-bw\-limit RATE]
.PD 0
.PP
.PD
[\-Z, \-\-force\-zero] [\-E, \-\-force\-empty]
.PD 0
.PP
.PD
[\-U, \-\-force\-uuid] [\-D, \-\-force\-device]
.PD 0
.PP
.PD
[\-N, \-\-force\-nocopy] [\-F, \-\-force\-full]
.PD 0
.PP
.PD
[\-R, \-\-force\-realloc]
.PD 0
.PP
.PD
[\-S, \-\-start BLKSTART] [\-B, \-\-count BLKCOUNT]
.PD 0
.PP
.PD
[\-L, \-\-error\-limit NUMBER]
.PD 0
.PP
.PD
[\-A, \-\-stats]
.PD 0
.PP
.PD
[\-v, \-\-verbose] [\-q, \-\-quiet]
.PD 0
.PP
.PD
status|smart|probe|up|down|diff|sync|scrub|fix|check
.PD 0
.PP
.PD
|list|dup|pool|devices|touch|rehash
.PD 0
.PD
.PP
snapraid [\-V, \-\-version] [\-H, \-\-help] [\-C, \-\-gen\-conf CONTENT]
.PD 0
.PD
.SH DESCRIPTION
SnapRAID is a backup program designed for disk arrays, storing
parity information for data recovery in the event of up to six
disk failures.
.PP
Primarily intended for home media centers with large,
infrequently changing files, SnapRAID offers several features:
.PD 0
.IP \(bu
You can utilize disks already filled with files without the
need to reformat them, accessing them as usual.
.IP \(bu
All your data is hashed to ensure data integrity and prevent
silent corruption.
.IP \(bu
When the number of failed disks exceeds the parity count,
data loss is confined to the affected disks; data on
other disks remains accessible.
.IP \(bu
If you accidentally delete files on a disk, recovery is
possible.
.IP \(bu
Disks can have different sizes.
.IP \(bu
You can add disks at any time.
.IP \(bu
SnapRAID doesn\'t lock in your data; you can stop using it
anytime without reformatting or moving data.
.IP \(bu
To access a file, only a single disk needs to spin, saving
power and reducing noise.
.PD
.PP
For more information, please visit the official SnapRAID site:
.PP
.RS 4
https://www.snapraid.it/
.PD 0
.PD
.RE
.SH LIMITATIONS
SnapRAID is a hybrid between a RAID and a backup program, aiming to combine
the best benefits of both. However, it has some limitations that you should
consider before using it.
.PP
The main limitation is that if a disk fails and you haven\'t recently synced,
you may not be able to fully recover.
More specifically, you may be unable to recover up to the size of
the changed or deleted files since the last sync operation.
This occurs even if the changed or deleted files are not on the
failed disk. This is why SnapRAID is better suited for
data that rarely changes.
.PP
On the other hand, newly added files don\'t prevent recovery of already
existing files. You will only lose the recently added files if they
are on the failed disk.
.PP
Other SnapRAID limitations are:
.PD 0
.IP \(bu
With SnapRAID, you still have separate file systems for each disk.
With RAID, you get a single large file system.
.IP \(bu
SnapRAID doesn\'t stripe data.
With RAID, you get a speed boost with striping.
.IP \(bu
SnapRAID doesn\'t support real\-time recovery.
With RAID, you do not have to stop working when a disk fails.
.IP \(bu
SnapRAID can recover data only from a limited number of disk failures.
With a backup, you can recover from a complete
failure of the entire disk array.
.IP \(bu
Only file names, timestamps, symlinks, and hardlinks are saved.
Permissions, ownership, and extended attributes are not saved.
.PD
.SH GETTING STARTED
To use SnapRAID, you need to first select one disk in your disk array
to dedicate to \[dq]parity\[dq] information. With one disk for parity, you
will be able to recover from a single disk failure, similar to RAID5.
.PP
If you want to recover from more disk failures, similar to RAID6,
you must reserve additional disks for parity. Each additional parity
disk allows recovery from one more disk failure.
.PP
As parity disks, you must pick the largest disks in the array,
as the parity information may grow to the size of the largest data
disk in the array.
.PP
These disks will be dedicated to storing the \[dq]parity\[dq] files.
You should not store your data on them.
.PP
Then, you must define the \[dq]data\[dq] disks that you want to protect
with SnapRAID. The protection is more effective if these disks
contain data that rarely changes. For this reason, it\'s better to
NOT include the Windows C:\\ disk or the Unix /home, /var, and /tmp
directories.
.PP
The list of files is saved in the \[dq]content\[dq] files, usually
stored on the data, parity, or boot disks.
This file contains the details of your backup, including all the
checksums to verify its integrity.
The \[dq]content\[dq] file is stored in multiple copies, and each copy must
be on a different disk to ensure that, even in case of multiple
disk failures, at least one copy is available.
.PP
For example, suppose you are interested in only one parity level
of protection, and your disks are located at:
.PP
.RS 4
/mnt/diskp <\- selected disk for parity
.PD 0
.PP
.PD
/mnt/disk1 <\- first disk to protect
.PD 0
.PP
.PD
/mnt/disk2 <\- second disk to protect
.PD 0
.PP
.PD
/mnt/disk3 <\- third disk to protect
.PD 0
.PD
.RE
.PP
You must create the configuration file /etc/snapraid.conf with
the following options:
.PP
.RS 4
parity /mnt/diskp/snapraid.parity
.PD 0
.PP
.PD
content /var/lib/snapraid/snapraid.content
.PD 0
.PP
.PD
content /mnt/disk1/snapraid.content
.PD 0
.PP
.PD
content /mnt/disk2/snapraid.content
.PD 0
.PP
.PD
data d1 /mnt/disk1/
.PD 0
.PP
.PD
data d2 /mnt/disk2/
.PD 0
.PP
.PD
data d3 /mnt/disk3/
.PD 0
.PD
.RE
.PP
If you are on Windows, you should use the Windows path format, with drive
letters and backslashes instead of slashes.
.PP
.RS 4
parity E:\\snapraid.parity
.PD 0
.PP
.PD
content C:\\snapraid\\snapraid.content
.PD 0
.PP
.PD
content F:\\array\\snapraid.content
.PD 0
.PP
.PD
content G:\\array\\snapraid.content
.PD 0
.PP
.PD
data d1 F:\\array\\
.PD 0
.PP
.PD
data d2 G:\\array\\
.PD 0
.PP
.PD
data d3 H:\\array\\
.PD 0
.PD
.RE
.PP
If you have many disks and run out of drive letters, you can mount
disks directly in subfolders. See:
.PP
.RS 4
https://www.google.com/search?q=Windows+mount+point
.PD 0
.PD
.RE
.PP
At this point, you are ready to run the \[dq]sync\[dq] command to build the
parity information.
.PP
.RS 4
snapraid sync
.PD 0
.PD
.RE
.PP
This process may take several hours the first time, depending on the size
of the data already present on the disks. If the disks are empty,
the process is immediate.
.PP
You can stop it at any time by pressing Ctrl+C, and at the next run, it
will resume where it was interrupted.
.PP
When this command completes, your data is SAFE.
.PP
Now you can start using your array as you like and periodically
update the parity information by running the \[dq]sync\[dq] command.
.SS Scrubbing
To periodically check the data and parity for errors, you can
run the \[dq]scrub\[dq] command.
.PP
.RS 4
snapraid scrub
.PD 0
.PD
.RE
.PP
This command compares the data in your array with the hash computed
during the \[dq]sync\[dq] command to verify integrity.
.PP
Each run of the command checks approximately 8% of the array, excluding data
already scrubbed in the previous 10 days.
You can use the \-p, \-\-plan option 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 for blocks older than 20 days, use:
.PP
.RS 4
snapraid \-p 5 \-o 20 scrub
.PD 0
.PD
.RE
.PP
If silent or input/output errors are found during the process,
the corresponding blocks are marked as bad in the \[dq]content\[dq] file
and listed in the \[dq]status\[dq] command.
.PP
.RS 4
snapraid status
.PD 0
.PD
.RE
.PP
To fix them, you can use the \[dq]fix\[dq] command, filtering for bad blocks with
the \-e, \-\-filter\-error option:
.PP
.RS 4
snapraid \-e fix
.PD 0
.PD
.RE
.PP
At the next \[dq]scrub,\[dq] the errors will disappear from the \[dq]status\[dq] report
if they are truly fixed. To make it faster, you can use \-p bad to scrub
only blocks marked as bad.
.PP
.RS 4
snapraid \-p bad scrub
.PD 0
.PD
.RE
.PP
Running \[dq]scrub\[dq] on an unsynced array may report errors caused by
removed or modified files. These errors are reported in the \[dq]scrub\[dq]
output, but the related blocks are not marked as bad.
.SS Pooling
Note: The pooling feature described below has been superseded by the
mergefs tool, which is now the recommended option for Linux users in
the SnapRAID community. Mergefs provides a more flexible and efficient
way to pool multiple drives into a single unified mount point,
allowing seamless access to files across your array without relying
on symbolic links. It integrates well with SnapRAID for parity
protection and is commonly used in setups like OpenMediaVault (OMV)
or custom NAS configurations.
.PP
To have all the files in your array shown in the same directory tree,
you can enable the \[dq]pooling\[dq] feature. It creates a read\-only virtual
view of all the files in your array using symbolic links.
.PP
You can configure the \[dq]pooling\[dq] directory in the configuration file with:
.PP
.RS 4
pool /pool
.PD 0
.PD
.RE
.PP
or, if you are on Windows, with:
.PP
.RS 4
pool C:\\pool
.PD 0
.PD
.RE
.PP
and then run the \[dq]pool\[dq] command to create or update the virtual view.
.PP
.RS 4
snapraid pool
.PD 0
.PD
.RE
.PP
If you are using a Unix platform and want to share this directory
over the network to either Windows or Unix machines, you should add
the following options to your /etc/samba/smb.conf:
.PP
.RS 4
# In the global section of smb.conf
.PD 0
.PP
.PD
unix extensions = no
.PD 0
.PD
.RE
.PP
.RS 4
# In the share section of smb.conf
.PD 0
.PP
.PD
[pool]
.PD 0
.PP
.PD
comment = Pool
.PD 0
.PP
.PD
path = /pool
.PD 0
.PP
.PD
read only = yes
.PD 0
.PP
.PD
guest ok = yes
.PD 0
.PP
.PD
wide links = yes
.PD 0
.PP
.PD
follow symlinks = yes
.PD 0
.PD
.RE
.PP
In Windows, sharing symbolic links over a network requires clients to
resolve them remotely. To enable this, besides sharing the pool directory,
you must also share all the disks independently, using the disk names
defined in the configuration file as share points. You must also specify
in the \[dq]share\[dq] option of the configuration file the Windows UNC path that
remote clients need to use to access these shared disks.
.PP
For example, operating from a server named \[dq]darkstar\[dq], you can use
the options:
.PP
.RS 4
data d1 F:\\array\\
.PD 0
.PP
.PD
data d2 G:\\array\\
.PD 0
.PP
.PD
data d3 H:\\array\\
.PD 0
.PP
.PD
pool C:\\pool
.PD 0
.PP
.PD
share \\\\darkstar
.PD 0
.PD
.RE
.PP
and share the following directories over the network:
.PP
.RS 4
\\\\darkstar\\pool \-> C:\\pool
.PD 0
.PP
.PD
\\\\darkstar\\d1 \-> F:\\array
.PD 0
.PP
.PD
\\\\darkstar\\d2 \-> G:\\array
.PD 0
.PP
.PD
\\\\darkstar\\d3 \-> H:\\array
.PD 0
.PD
.RE
.PP
to allow remote clients to access all the files at \\\\darkstar\\pool.
.PP
You may also need to configure remote clients to enable access to remote
symlinks with the command:
.PP
.RS 4
fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1
.PD 0
.PD
.RE
.SS Undeleting
SnapRAID functions more like a backup program than a RAID system, and it
can be used to restore or undelete files to their previous state using
the \-f, \-\-filter option:
.PP
.RS 4
snapraid fix \-f FILE
.PD 0
.PD
.RE
.PP
or for a directory:
.PP
.RS 4
snapraid fix \-f DIR/
.PD 0
.PD
.RE
.PP
You can also use it to recover only accidentally deleted files inside
a directory using the \-m, \-\-filter\-missing option, which restores
only missing files, leaving all others untouched.
.PP
.RS 4
snapraid fix \-m \-f DIR/
.PD 0
.PD
.RE
.PP
Or to recover all the deleted files on all drives with:
.PP
.RS 4
snapraid fix \-m
.PD 0
.PD
.RE
.SS Recovering
The worst has happened, and you have lost one or more disks!
.PP
DO NOT PANIC! You will be able to recover them!
.PP
The first thing you must do is avoid further changes to your disk array.
Disable any remote connections to it and any scheduled processes, including
any scheduled SnapRAID nightly sync or scrub.
.PP
Then proceed with the following steps.
.SS STEP 1 \-> Reconfigure
You need some space to recover, ideally on additional
spare disks, but an external USB disk or remote disk will suffice.
.PP
Modify the SnapRAID configuration file to make the \[dq]data\[dq] or \[dq]parity\[dq]
option of the failed disk point to a location with enough empty
space to recover the files.
.PP
For example, if disk \[dq]d1\[dq] has failed, change from:
.PP
.RS 4
data d1 /mnt/disk1/
.PD 0
.PD
.RE
.PP
to:
.PP
.RS 4
data d1 /mnt/new_spare_disk/
.PD 0
.PD
.RE
.PP
If the disk to recover is a parity disk, update the appropriate \[dq]parity\[dq]
option.
If you have multiple failed disks, update all their configuration options.
.SS STEP 2 \-> Fix
Run the fix command, storing the log in an external file with:
.PP
.RS 4
snapraid \-d NAME \-l fix.log fix
.PD 0
.PD
.RE
.PP
Where NAME is the name of the disk, such as \[dq]d1\[dq] in our previous example.
If the disk to recover is a parity disk, use the names \[dq]parity\[dq], \[dq]2\-parity\[dq],
etc.
If you have multiple failed disks, use multiple \-d options to specify all
of them.
.PP
This command will take a long time.
.PP
Ensure you have a few gigabytes free to store the fix.log file.
Run it from a disk with sufficient free space.
.PP
Now you have recovered all that is recoverable. If some files are partially
or totally unrecoverable, they will be renamed by adding the \[dq].unrecoverable\[dq]
extension.
.PP
You can find a detailed list of all unrecoverable blocks in the fix.log file
by checking all lines starting with \[dq]unrecoverable:\[dq].
.PP
If you are not satisfied with the recovery, you can retry it as many
times as you wish.
.PP
For example, if you have removed files from the array after the last
\[dq]sync\[dq], this may result in some files not being recovered.
In this case, you can retry the \[dq]fix\[dq] using the \-i, \-\-import option,
specifying where these files are now to include them again in the
recovery process.
.PP
If you are satisfied with the recovery, you can proceed further,
but note that after syncing, you cannot retry the \[dq]fix\[dq] command
anymore!
.SS STEP 3 \-> Check
As a cautious check, you can now run a \[dq]check\[dq] command to ensure that
everything is correct on the recovered disk.
.PP
.RS 4
snapraid \-d NAME \-a check
.PD 0
.PD
.RE
.PP
Where NAME is the name of the disk, such as \[dq]d1\[dq] in our previous example.
.PP
The \-d and \-a options tell SnapRAID to check only the specified disk
and ignore all parity data.
.PP
This command will take a long time, but if you are not overly cautious,
you can skip it.
.SS STEP 4 \-> Sync
Run the \[dq]sync\[dq] command to resynchronize the array with the new disk.
.PP
.RS 4
snapraid sync
.PD 0
.PD
.RE
.PP
If everything is recovered, this command is immediate.
.SH COMMANDS
SnapRAID provides a few simple commands that allow you to:
.PD 0
.IP \(bu
Print the status of the array \-> \[dq]status\[dq]
.IP \(bu
Control the disks \-> \[dq]smart\[dq], \[dq]probe\[dq], \[dq]up\[dq], \[dq]down\[dq]
.IP \(bu
Make a backup/snapshot \-> \[dq]sync\[dq]
.IP \(bu
Periodically check data \-> \[dq]scrub\[dq]
.IP \(bu
Restore the last backup/snapshot \-> \[dq]fix\[dq].
.PD
.PP
Commands must be written in lowercase.
.SS status
Prints a summary of the state of the disk array.
.PP
It includes information about parity fragmentation, how old
the blocks are without checking, and all recorded silent
errors encountered while scrubbing.
.PP
The information presented refers to the latest time you
ran \[dq]sync\[dq]. Later modifications are not taken into account.
.PP
If bad blocks were detected, their block numbers are listed.
To fix them, you can use the \[dq]fix \-e\[dq] command.
.PP
It also shows a graph representing the last time each block
was scrubbed or synced. Scrubbed blocks are shown with \'*\',
blocks synced but not yet scrubbed with \'o\'.
.PP
Nothing is modified.
.SS smart
Prints a SMART report of all the disks in the system.
.PP
It includes an estimation of the probability of failure in the next
year, allowing you to plan maintenance replacements of disks that show
suspicious attributes.
.PP
This probability estimation is obtained by correlating the SMART attributes
of the disks with the Backblaze data available at:
.PP
.RS 4
https://www.backblaze.com/hard\-drive\-test\-data.html
.PD 0
.PD
.RE
.PP
If SMART reports that a disk is failing, \[dq]FAIL\[dq] or \[dq]PREFAIL\[dq] is printed
for that disk, and SnapRAID returns with an error.
In this case, immediate replacement of the disk is highly recommended.
.PP
Other possible status strings are:
.RS 4
.PD 0
.HP 4
.I logfail
In the past, some attributes were lower than
the threshold.
.HP 4
.I logerr
The device error log contains errors.
.HP 4
.I selferr
The device self\-test log contains errors.
.PD
.RE
.PP
If the \-v, \-\-verbose option is specified, a deeper statistical analysis
is provided. This analysis can help you decide if you need more
or less parity.
.PP
This command uses the \[dq]smartctl\[dq] tool and is equivalent to running
\[dq]smartctl \-a\[dq] on all devices.
.PP
If your devices are not auto\-detected correctly, you can specify
a custom command using the \[dq]smartctl\[dq] option in the configuration
file.
.PP
Nothing is modified.
.SS probe
Prints the POWER state of all disks in the system.
.PP
\[dq]Standby\[dq] means the disk is not spinning. \[dq]Active\[dq] means
the disk is spinning.
.PP
This command uses the \[dq]smartctl\[dq] tool and is equivalent to running
\[dq]smartctl \-n standby \-i\[dq] on all devices.
.PP
If your devices are not auto\-detected correctly, you can specify
a custom command using the \[dq]smartctl\[dq] option in the configuration
file.
.PP
Nothing is modified.
.SS up
Spins up all the disks of the array.
.PP
You can spin up only specific disks using the \-d, \-\-filter\-disk option.
.PP
Spinning up all the disks at the same time requires a lot of power.
Ensure that your power supply can sustain it.
.PP
Nothing is modified.
.SS down
Spins down all the disks of the array.
.PP
This command uses the \[dq]smartctl\[dq] tool and is equivalent to running
\[dq]smartctl \-s standby,now\[dq] on all devices.
.PP
You can spin down only specific disks using the \-d, \-\-filter\-disk
option.
.PP
To automatically spin down on error, you can use the \-s, \-\-spin\-down\-on\-error
option with any other command, which is equivalent to running \[dq]down\[dq] manually
when an error occurs.
.PP
Nothing is modified.
.SS diff
Lists all the files modified since the last \[dq]sync\[dq] that need to have
their parity data recomputed.
.PP
This command doesn\'t check the file data, but only the file timestamp,
size, and inode.
.PP
After listing all changed files, a summary of the changes is
presented, grouped by:
.RS 4
.PD 0
.HP 4
.I equal
Files unchanged from before.
.HP 4
.I added
Files added that were not present before.
.HP 4
.I removed
Files removed.
.HP 4
.I updated
Files with a different size or timestamp, meaning they
were modified.
.HP 4
.I moved
Files moved to a different directory on the same disk.
They are identified by having the same name, size, timestamp,
and inode, but a different directory.
.HP 4
.I copied
Files copied on the same or a different disk. Note that if
they are truly moved to a different disk, they will also be
counted in \[dq]removed\[dq].
They are identified by having the same name, size, and
timestamp. If the sub\-second timestamp is zero,
the full path must match, not just the name.
.HP 4
.I restored
Files with a different inode but matching name, size, and timestamp.
These are usually files restored after being deleted.
.PD
.RE
.PP
If a \[dq]sync\[dq] is required, the process return code is 2, instead of the
default 0. The return code 1 is used for a generic error condition.
.PP
Nothing is modified.
.SS sync
Updates the parity information. All modified files
in the disk array are read, and the corresponding parity
data is updated.
.PP
You can stop this process at any time by pressing Ctrl+C,
without losing the work already done.
At the next run, the \[dq]sync\[dq] process will resume where
it was interrupted.
.PP
If silent or input/output errors are found during the process,
the corresponding blocks are marked as bad.
.PP
Files are identified by path and/or inode and checked by
size and timestamp.
If the file size or timestamp differs, the parity data
is recomputed for the entire file.
If the file is moved or renamed on the same disk, keeping the
same inode, the parity is not recomputed.
If the file is moved to another disk, the parity is recomputed,
but the previously computed hash information is retained.
.PP
The \[dq]content\[dq] and \[dq]parity\[dq] files are modified if necessary.
The files in the array are NOT modified.
.SS scrub
Scrubs the array, checking for silent or input/output errors in data
and parity disks.
.PP
Each invocation checks approximately 8% of the array, excluding
data already scrubbed in the last 10 days.
This means that scrubbing once a week ensures every bit of data is checked
at least once every three months.
.PP
You can define a different scrub plan or amount using the \-p, \-\-plan
option, which accepts:
bad \- Scrub blocks marked bad.
new \- Scrub just\-synced blocks not yet scrubbed.
full \- Scrub everything.
0\-100 \- Scrub the specified percentage of blocks.
.PP
If you specify a percentage amount, you can also use the \-o, \-\-older\-than
option to define how old the block should be.
The oldest blocks are scrubbed first, ensuring an optimal check.
If you want to scrub only the just\-synced blocks not yet scrubbed,
use the \[dq]\-p new\[dq] option.
.PP
To get details of the scrub status, use the \[dq]status\[dq] command.
.PP
For any silent or input/output error found, the corresponding blocks
are marked as bad in the \[dq]content\[dq] file.
These bad blocks are listed in \[dq]status\[dq] and can be fixed with \[dq]fix \-e\[dq].
After the fix, at the next scrub, they will be rechecked, and if found
corrected, the bad mark will be removed.
To scrub only the bad blocks, you can use the \[dq]scrub \-p bad\[dq] command.
.PP
It\'s recommended to run \[dq]scrub\[dq] only on a synced array to avoid
reported errors caused by unsynced data. These errors are recognized
as not being silent errors, and the blocks are not marked as bad,
but such errors are reported in the output of the command.
.PP
The \[dq]content\[dq] file is modified to update the time of the last check
for each block and to mark bad blocks.
The \[dq]parity\[dq] files are NOT modified.
The files in the array are NOT modified.
.SS fix
Fixes all the files and the parity data.
.PP
All files and parity data are compared with the snapshot
state saved in the last \[dq]sync\[dq].
If a difference is found, it is reverted to the stored snapshot.
.PP
WARNING! The \[dq]fix\[dq] command does not differentiate between errors and
intentional modifications. It unconditionally reverts the file state
to the last \[dq]sync\[dq].
.PP
If no other option is specified, the entire array is processed.
Use the filter options to select a subset of files or disks to operate on.
.PP
To fix only the blocks marked bad during \[dq]sync\[dq] and \[dq]scrub\[dq],
use the \-e, \-\-filter\-error option.
Unlike other filter options, this one applies fixes only to files that are
unchanged since the latest \[dq]sync\[dq].
.PP
SnapRAID renames all files that cannot be fixed by adding the
\[dq].unrecoverable\[dq] extension.
.PP
Before fixing, the entire array is scanned to find any files moved
since the last \[dq]sync\[dq] operation.
These files are identified by their timestamp, ignoring their name
and directory, and are used in the recovery process if necessary.
If you moved some of them outside the array, you can use the \-i, \-\-import
option to specify additional directories to scan.
.PP
Files are identified only by path, not by inode.
.PP
The \[dq]content\[dq] file is NOT modified.
The \[dq]parity\[dq] files are modified if necessary.
The files in the array are modified if necessary.
.SS check
Verifies all the files and the parity data.
.PP
It works like \[dq]fix\[dq], but it only simulates a recovery and no changes
are written to the array.
.PP
This command is primarily intended for manual verification,
such as after a recovery process or in other special conditions.
For periodic and scheduled checks, use \[dq]scrub\[dq].
.PP
If you use the \-a, \-\-audit\-only option, only the file
data is checked, and the parity data is ignored for a
faster run.
.PP
Files are identified only by path, not by inode.
.PP
Nothing is modified.
.SS list
Lists all the files contained in the array at the time of the
last \[dq]sync\[dq].
.PP
With \-v or \-\-verbose, the subsecond time is also shown.
.PP
Nothing is modified.
.SS dup
Lists all duplicate files. Two files are assumed equal if their
hashes match. The file data is not read; only the
precomputed hashes are used.
.PP
Nothing is modified.
.SS pool
Creates or updates a virtual view of all
the files in your disk array in the \[dq]pooling\[dq] directory.
.PP
The files are not copied but linked using
symbolic links.
.PP
When updating, all existing symbolic links and empty
subdirectories are deleted and replaced with the new
view of the array. Any other regular files are left in place.
.PP
Nothing is modified outside the pool directory.
.SS devices
Prints the low\-level devices used by the array.
.PP
This command displays the device associations in the array
and is mainly intended as a script interface.
.PP
The first two columns are the low\-level device ID and path.
The next two columns are the high\-level device ID and path.
The last column is the disk name in the array.
.PP
In most cases, you have one low\-level device for each disk in the
array, but in some more complex configurations, you may have multiple
low\-level devices used by a single disk in the array.
.PP
Nothing is modified.
.SS touch
Sets an arbitrary sub\-second timestamp for all files
that have it set to zero.
.PP
This improves SnapRAID\'s ability to recognize moved
and copied files, as it makes the timestamp almost unique,
reducing possible duplicates.
.PP
More specifically, if the sub\-second timestamp is not zero,
a moved or copied file is identified as such if it matches
the name, size, and timestamp. If the sub\-second timestamp
is zero, it is considered a copy only if the full path,
size, and timestamp all match.
.PP
The second\-precision timestamp is not modified,
so all the dates and times of your files will be preserved.
.SS rehash
Schedules a rehash of the entire array.
.PP
This command changes the hash kind used, typically when upgrading
from a 32\-bit system to a 64\-bit one, to switch from
MurmurHash3 to the faster SpookyHash.
.PP
If you are already using the optimal hash, this command
does nothing and informs you that no action is needed.
.PP
The rehash is not performed immediately but takes place
progressively during \[dq]sync\[dq] and \[dq]scrub\[dq].
.PP
You can check the rehash state using \[dq]status\[dq].
.PP
During the rehash, SnapRAID maintains full functionality,
with the only exception that \[dq]dup\[dq] cannot detect duplicated
files using a different hash.
.SH OPTIONS
SnapRAID provides the following options:
.TP
.B \-c, \-\-conf CONFIG
Selects the configuration file to use. If not specified, in Unix
it uses the file \[dq]/usr/local/etc/snapraid.conf\[dq] if it exists,
otherwise \[dq]/etc/snapraid.conf\[dq].
In Windows, it uses the file \[dq]snapraid.conf\[dq] in the same
directory as \[dq]snapraid.exe\[dq].
.TP
.B \-f, \-\-filter PATTERN
Filters the files to process in \[dq]check\[dq] and \[dq]fix\[dq].
Only the files matching the specified pattern are processed.
This option can be used multiple times.
See the PATTERN section for more details on
pattern specifications.
In Unix, ensure globbing characters are quoted if used.
This option can be used only with \[dq]check\[dq] and \[dq]fix\[dq].
It cannot be used with \[dq]sync\[dq] and \[dq]scrub\[dq], as they always
process the entire array.
.TP
.B \-d, \-\-filter\-disk NAME
Filters the disks to process in \[dq]check\[dq], \[dq]fix\[dq], \[dq]up\[dq], and \[dq]down\[dq].
You must specify a disk name as defined in the configuration
file.
You can also specify parity disks with the names: \[dq]parity\[dq], \[dq]2\-parity\[dq],
\[dq]3\-parity\[dq], etc., to limit operations to a specific parity disk.
If you combine multiple \-\-filter, \-\-filter\-disk, and \-\-filter\-missing options,
only files matching all the filters are selected.
This option can be used multiple times.
This option can be used only with \[dq]check\[dq], \[dq]fix\[dq], \[dq]up\[dq], and \[dq]down\[dq].
It cannot be used with \[dq]sync\[dq] and \[dq]scrub\[dq], as they always
process the entire array.
.TP
.B \-m, \-\-filter\-missing
Filters the files to process in \[dq]check\[dq] and \[dq]fix\[dq].
Only the files missing or deleted from the array are processed.
When used with \[dq]fix\[dq], this acts as an \[dq]undelete\[dq] command.
If you combine multiple \-\-filter, \-\-filter\-disk, and \-\-filter\-missing options,
only files matching all the filters are selected.
This option can be used only with \[dq]check\[dq] and \[dq]fix\[dq].
It cannot be used with \[dq]sync\[dq] and \[dq]scrub\[dq], as they always
process the entire array.
.TP
.B \-e, \-\-filter\-error
Processes the files with errors in \[dq]check\[dq] and \[dq]fix\[dq].
It processes only files that have blocks marked with silent
or input/output errors during \[dq]sync\[dq] and \[dq]scrub\[dq], as listed in \[dq]status\[dq].
This option can be used only with \[dq]check\[dq] and \[dq]fix\[dq].
.TP
.B \-p, \-\-plan PERC|bad|new|full
Selects the scrub plan. If PERC is a numeric value from 0 to 100,
it is interpreted as the percentage of blocks to scrub.
Instead of a percentage, you can specify a plan:
\[dq]bad\[dq] scrubs bad blocks, \[dq]new\[dq] scrubs blocks not yet scrubbed,
and \[dq]full\[dq] scrubs everything.
This option can be used only with \[dq]scrub\[dq].
.TP
.B \-o, \-\-older\-than DAYS
Selects the oldest part of the array to process in \[dq]scrub\[dq].
DAYS is the minimum age in days for a block to be scrubbed;
the default is 10.
Blocks marked as bad are always scrubbed regardless of this option.
This option can be used only with \[dq]scrub\[dq].
.TP
.B \-a, \-\-audit\-only
In \[dq]check\[dq], verifies the hash of the files without
checking the parity data.
If you are interested only in checking the file data, this
option can significantly speed up the checking process.
This option can be used only with \[dq]check\[dq].
.TP
.B \-h, \-\-pre\-hash
In \[dq]sync\[dq], runs a preliminary hashing phase of all new data
for additional verification before the parity computation.
Usually, in \[dq]sync\[dq], no preliminary hashing is done, and the new
data is hashed just before the parity computation when it is read
for the first time.
This process occurs when the system is under
heavy load, with all disks spinning and a busy CPU.
This is an extreme condition for the machine, and if it has a
latent hardware problem, silent errors may go undetected
because the data is not yet hashed.
To avoid this risk, you can enable the \[dq]pre\-hash\[dq] mode to have
all the data read twice to ensure its integrity.
This option also verifies files moved within the array
to ensure the move operation was successful and, if necessary,
allows you to run a fix operation before proceeding.
This option can be used only with \[dq]sync\[dq].
.TP
.B \-i, \-\-import DIR
Imports from the specified directory any files deleted
from the array after the last \[dq]sync\[dq].
If you still have such files, they can be used by \[dq]check\[dq]
and \[dq]fix\[dq] to improve the recovery process.
The files are read, including in subdirectories, and are
identified regardless of their name.
This option can be used only with \[dq]check\[dq] and \[dq]fix\[dq].
.TP
.B \-s, \-\-spin\-down\-on\-error
On any error, spins down all managed disks before exiting with
a non\-zero status code. This prevents the drives from
remaining active and spinning after an aborted operation,
helping to avoid unnecessary heat buildup and power
consumption. Use this option to ensure disks are safely
stopped even when a command fails.
.TP
.B \-w, \-\-bw\-limit RATE
Applies a global bandwidth limit for all disks. The RATE is
the number of bytes per second. You can specify a multiplier
such as K, M, or G (e.g., \-\-bw\-limit 1G).
.TP
.B \-A, \-\-stats
Enables an extended status view that shows additional information.
The screen displays two graphs:
The first graph shows the number of buffered stripes for each
disk, along with the file path of the file currently being
accessed on that disk. Typically, the slowest disk will have
no buffer available, which determines the maximum achievable
bandwidth.
The second graph shows the percentage of time spent waiting
over the past 100 seconds. The slowest disk is expected to
cause most of the wait time, while other disks should have
little or no wait time because they can use their buffered stripes.
This graph also shows the time spent waiting for hash
calculations and RAID computations.
All computations run in parallel with disk operations.
Therefore, as long as there is measurable wait time for at
least one disk, it indicates that the CPU is fast enough to
keep up with the workload.
.TP
.B \-Z, \-\-force\-zero
Forces the insecure operation of syncing a file with zero
size that was previously non\-zero.
If SnapRAID detects such a condition, it stops proceeding
unless you specify this option.
This allows you to easily detect when, after a system crash,
some accessed files were truncated.
This is a possible condition in Linux with the ext3/ext4
file systems.
This option can be used only with \[dq]sync\[dq].
.TP
.B \-E, \-\-force\-empty
Forces the insecure operation of syncing a disk with all
the original files missing.
If SnapRAID detects that all the files originally present
on the disk are missing or rewritten, it stops proceeding
unless you specify this option.
This allows you to easily detect when a data file system is not
mounted.
This option can be used only with \[dq]sync\[dq].
.TP
.B \-U, \-\-force\-uuid
Forces the insecure operation of syncing, checking, and fixing
with disks that have changed their UUID.
If SnapRAID detects that some disks have changed UUID,
it stops proceeding unless you specify this option.
This allows you to detect when your disks are mounted at the
wrong mount points.
It is, however, allowed to have a single UUID change with
single parity, and more with multiple parity, because this is
the normal case when replacing disks after a recovery.
This option can be used only with \[dq]sync\[dq], \[dq]check\[dq], or
\[dq]fix\[dq].
.TP
.B \-D, \-\-force\-device
Forces the insecure operation of fixing with inaccessible disks
or with disks on the same physical device.
For example, if you lost two data disks and have a spare disk to recover
only the first one, you can ignore the second inaccessible disk.
Or, if you want to recover a disk in the free space left on an
already used disk, sharing the same physical device.
This option can be used only with \[dq]fix\[dq].
.TP
.B \-N, \-\-force\-nocopy
In \[dq]sync\[dq], \[dq]check\[dq], and \[dq]fix\[dq], disables the copy detection heuristic.
Without this option, SnapRAID assumes that files with the same
attributes, such as name, size, and timestamp, are copies with the
same data.
This allows identification of copied or moved files from one disk
to another and reuses the already computed hash information
to detect silent errors or to recover missing files.
In some rare cases, this behavior may result in false positives
or a slow process due to many hash verifications, and this
option allows you to resolve such issues.
This option can be used only with \[dq]sync\[dq], \[dq]check\[dq], and \[dq]fix\[dq].
.TP
.B \-F, \-\-force\-full
In \[dq]sync\[dq], forces a full recomputation of the parity.
This option can be used when you add a new parity level or if
you reverted to an old content file using more recent parity data.
Instead of recreating the parity from scratch, this allows
you to reuse the hashes present in the content file to validate data
and maintain data protection during the \[dq]sync\[dq] process using
the existing parity data.
This option can be used only with \[dq]sync\[dq].
.TP
.B \-R, \-\-force\-realloc
In \[dq]sync\[dq], forces a full reallocation of files and rebuild of the parity.
This option can be used to completely reallocate all files,
removing fragmentation, while reusing the hashes present in the content
file to validate data.
This option can be used only with \[dq]sync\[dq].
WARNING! This option is for experts only, and it is highly
recommended not to use it.
You DO NOT have data protection during the \[dq]sync\[dq] operation.
.TP
.B \-l, \-\-log FILE
Writes a detailed log to the specified file.
If this option is not specified, unexpected errors are printed
to the screen, potentially resulting in excessive output in case of
many errors. When \-l, \-\-log is specified, only
fatal errors that cause SnapRAID to stop are printed
to the screen.
If the path starts with \'>>\', the file is opened
in append mode. Occurrences of \'%D\' and \'%T\' in the name are
replaced with the date and time in the format YYYYMMDD and
HHMMSS. In Windows batch files, you must double
the \'%\' character, e.g., result\-%%D.log. To use \'>>\', you must
enclose the name in quotes, e.g., \[dq]>>result.log\[dq].
To output the log to standard output or standard error,
you can use \[dq]>&1\[dq] and \[dq]>&2\[dq], respectively.
.TP
.B \-L, \-\-error\-limit NUMBER
Sets a new error limit before stopping execution.
By default, SnapRAID stops if it encounters more than 100
input/output errors, indicating that a disk is likely failing.
This option affects \[dq]sync\[dq] and \[dq]scrub\[dq], which are allowed
to continue after the first set of disk errors to try
to complete their operations.
However, \[dq]check\[dq] and \[dq]fix\[dq] always stop at the first error.
.TP
.B \-S, \-\-start BLKSTART
Starts processing from the specified
block number. This can be useful for retrying to check
or fix specific blocks in case of a damaged disk.
This option is mainly for advanced manual recovery.
.TP
.B \-B, \-\-count BLKCOUNT
Processes only the specified number of blocks.
This option is mainly for advanced manual recovery.
.TP
.B \-C, \-\-gen\-conf CONTENT
Generates a dummy configuration file from an existing
content file.
The configuration file is written to standard output
and does not overwrite an existing one.
This configuration file also contains the information
needed to reconstruct the disk mount points in case you
lose the entire system.
.TP
.B \-v, \-\-verbose
Prints more information to the screen.
If specified once, it prints excluded files
and additional statistics.
This option has no effect on the log files.
.TP
.B \-q, \-\-quiet
Prints less information to the screen.
If specified once, it removes the progress bar; twice,
the running operations; three times, the info
messages; four times, the status messages.
Fatal errors are always printed to the screen.
This option has no effect on the log files.
.TP
.B \-H, \-\-help
Prints a short help screen.
.TP
.B \-V, \-\-version
Prints the program version.
.SH CONFIGURATION
SnapRAID requires a configuration file to know where your disk array
is located and where to store the parity information.
.PP
In Unix, it uses the file \[dq]/usr/local/etc/snapraid.conf\[dq] if it exists,
otherwise \[dq]/etc/snapraid.conf\[dq].
In Windows, it uses the file \[dq]snapraid.conf\[dq] in the same
directory as \[dq]snapraid.exe\[dq].
.PP
It must contain the following options (case\-sensitive):
.SS parity FILE [,FILE] ...
Defines the files to use to store the parity information.
The parity enables protection from a single disk
failure, similar to RAID5.
.PP
You can specify multiple files, which must be on different disks.
When a file cannot grow anymore, the next one is used.
The total space available must be at least as large as the largest data disk in
the array.
.PP
You can add additional parity files later, but you
cannot reorder or remove them.
.PP
Keeping the parity disks reserved for parity ensures that
they do not become fragmented, improving performance.
.PP
In Windows, 256 MB is left unused on each disk to avoid the
warning about full disks.
.PP
This option is mandatory and can be used only once.
.SS (2,3,4,5,6)\-parity FILE [,FILE] ...
Defines the files to use to store extra parity information.
.PP
For each parity level specified, one additional level of protection
is enabled:
.PD 0
.IP \(bu
2\-parity enables RAID6 dual parity.
.IP \(bu
3\-parity enables triple parity.
.IP \(bu
4\-parity enables quad (four) parity.
.IP \(bu
5\-parity enables penta (five) parity.
.IP \(bu
6\-parity enables hexa (six) parity.
.PD
.PP
Each parity level requires the presence of all previous parity
levels.
.PP
The same considerations as for the \'parity\' option apply.
.PP
These options are optional and can be used only once.
.SS z\-parity FILE [,FILE] ...
Defines an alternate file and format to store triple parity.
.PP
This option is an alternative to \'3\-parity\', primarily intended for
low\-end CPUs like ARM or AMD Phenom, Athlon, and Opteron that do not
support the SSSE3 instruction set. In such cases, it provides
better performance.
.PP
This format is similar to but faster than the one used by ZFS RAIDZ3.
Like ZFS, it does not work beyond triple parity.
.PP
When using \'3\-parity\', you will be warned if it is recommended to use
the \'z\-parity\' format for performance improvement.
.PP
It is possible to convert from one format to another by adjusting
the configuration file with the desired z\-parity or 3\-parity file
and using \'fix\' to recreate it.
.SS content FILE
Defines the file to use to store the list and checksums of all the
files present in your disk array.
.PP
It can be placed on a disk used for data, parity, or
any other disk available.
If you use a data disk, this file is automatically excluded
from the \[dq]sync\[dq] process.
.PP
This option is mandatory and can be used multiple times to save
multiple copies of the same file.
.PP
You must store at least one copy for each parity disk used
plus one. Using additional copies does not hurt.
.SS data NAME DIR
Defines the name and mount point of the data disks in
the array. NAME is used to identify the disk and must
be unique. DIR is the mount point of the disk in the
file system.
.PP
You can change the mount point as needed, as long as
you keep the NAME fixed.
.PP
You should use one option for each data disk in the array.
.PP
You can rename a disk later by changing the NAME directly
in the configuration file and then running a \'sync\' command.
In the case of renaming, the association is done using the stored
UUID of the disks.
.SS nohidden
Excludes all hidden files and directories.
In Unix, hidden files are those starting with \[dq].\[dq].
In Windows, they are those with the hidden attribute.
.SS exclude/include PATTERN
Defines the file or directory patterns to exclude or include
in the sync process.
All patterns are processed in the specified order.
.PP
If the first pattern that matches is an \[dq]exclude\[dq] one, the file
is excluded. If it is an \[dq]include\[dq] one, the file is included.
If no pattern matches, the file is excluded if the last pattern
specified is an \[dq]include\[dq], or included if the last pattern
specified is an \[dq]exclude\[dq].
.PP
See the PATTERN section for more details on pattern
specifications.
.PP
This option can be used multiple times.
.SS blocksize SIZE_IN_KIBIBYTES
Defines the basic block size in kibibytes for the parity.
One kibibyte is 1024 bytes.
.PP
The default blocksize is 256, which should work for most cases.
.PP
WARNING! This option is for experts only, and it is highly
recommended not to change this value. To change this value in the
future, you will need to recreate the entire parity!
.PP
A reason to use a different blocksize is if you have many small
files, on the order of millions.
.PP
For each file, even if only a few bytes, an entire block of parity is allocated,
and with many files, this may result in significant unused parity space.
When you completely fill the parity disk, you are not
allowed to add more files to the data disks.
However, the wasted parity does not accumulate across data disks. Wasted space
resulting from a high number of files on a data disk limits only
the amount of data on that data disk, not others.
.PP
As an approximation, you can assume that half of the block size is
wasted for each file. For example, with 100,000 files and a 256 KiB
block size, you will waste 12.8 GB of parity, which may result
in 12.8 GB less space available on the data disk.
.PP
You can check the amount of wasted space on each disk using \[dq]status\[dq].
This is the amount of space you must leave free on the data
disks or use for files not included in the array.
If this value is negative, it means you are close to filling
the parity, and it represents the space you can still waste.
.PP
To avoid this issue, you can use a larger partition for parity.
For example, if the parity partition is 12.8 GB larger than the data disks,
you have enough extra space to handle up to 100,000
files on each data disk without any wasted space.
.PP
A trick to get a larger parity partition in Linux is to format it
with the command:
.PP
.RS 4
mkfs.ext4 \-m 0 \-T largefile4 DEVICE
.PD 0
.PD
.RE
.PP
This results in about 1.5% extra space, approximately 60 GB for
a 4 TB disk, which allows about 460,000 files on each data disk without
any wasted space.
.SS hashsize SIZE_IN_BYTES
Defines the hash size in bytes for the saved blocks.
.PP
The default hashsize is 16 bytes (128 bits), which should work
for most cases.
.PP
WARNING! This option is for experts only, and it is highly
recommended not to change this value. To change this value in the
future, you will need to recreate the entire parity!
.PP
A reason to use a different hashsize is if your system has
limited memory. As a rule of thumb, SnapRAID typically requires
1 GiB of RAM for each 16 TB of data in the array.
.PP
Specifically, to store the hashes of the data, SnapRAID requires
approximately TS*(1+HS)/BS bytes of RAM,
where TS is the total size in bytes of your disk array, BS is the
block size in bytes, and HS is the hash size in bytes.
.PP
For example, with 8 disks of 4 TB, a block size of 256 KiB
(1 KiB = 1024 bytes), and a hash size of 16, you get:
.PP
RAM = (8 * 4 * 10^12) * (1+16) / (256 * 2^10) = 1.93 GiB
.PD 0
.PD
.PP
Switching to a hash size of 8, you get:
.PP
RAM = (8 * 4 * 10^12) * (1+8) / (256 * 2^10) = 1.02 GiB
.PD 0
.PD
.PP
Switching to a block size of 512, you get:
.PP
RAM = (8 * 4 * 10^12) * (1+16) / (512 * 2^10) = 0.96 GiB
.PD 0
.PD
.PP
Switching to both a hash size of 8 and a block size of 512, you get:
.PP
RAM = (8 * 4 * 10^12) * (1+8) / (512 * 2^10) = 0.51 GiB
.PD 0
.PD
.SS autosave SIZE_IN_GIGABYTES
Automatically saves the state when syncing or scrubbing after the
specified amount of GB processed.
This option is useful to avoid restarting long \[dq]sync\[dq]
commands from scratch if interrupted by a machine crash or any other event.
.SS temp_limit TEMPERATURE_CELSIUS
Sets the maximum allowed disk temperature in Celsius. When specified,
SnapRAID periodically checks the temperature of all disks using the
smartctl tool. The current disk temperatures are displayed while
SnapRAID is operating. If any disk exceeds this limit, all operations
stop, and the disks are spun down (put into standby) for the duration
defined by the \[dq]temp_sleep\[dq] option. After the sleep period, operations
resume, potentially pausing again if the temperature limit is reached
once more.
.PP
During operation, SnapRAID also analyzes the heating curve of each
disk and estimates the long\-term steady temperature they are expected
to reach if activity continues. The estimation is performed only after
the disk temperature has increased four times, ensuring that enough
data points are available to establish a reliable trend.
This predicted steady temperature is shown in parentheses next to the
current value and helps assess whether the system\'s cooling is
adequate. This estimated temperature is for informational purposes
only and has no effect on the behavior of SnapRAID. The program\'s
actions are based solely on the actual measured disk temperatures.
.PP
To perform this analysis, SnapRAID needs a reference for the system
temperature. It first attempts to read it from available hardware
sensors. If no system sensor can be accessed, it uses the lowest disk
temperature measured at the start of the run as a fallback reference.
.PP
Normally, SnapRAID shows only the temperature of the hottest disk.
To display the temperature of all disks, use the \-A or \-\-stats option.
.SS temp_sleep TIME_IN_MINUTES
Sets the standby time, in minutes, when the temperature limit is
reached. During this period, the disks remain spun down. The default
is 5 minutes.
.SS pool DIR
Defines the pooling directory where the virtual view of the disk
array is created using the \[dq]pool\[dq] command.
.PP
The directory must already exist.
.SS share UNC_DIR
Defines the Windows UNC path required to access the disks remotely.
.PP
If this option is specified, the symbolic links created in the pool
directory use this UNC path to access the disks.
Without this option, the symbolic links generated use only local paths,
which does not allow sharing the pool directory over the network.
.PP
The symbolic links are formed using the specified UNC path, adding the
disk name as specified in the \[dq]data\[dq] option, and finally adding the
file directory and name.
.PP
This option is required only for Windows.
.SS smartctl DISK/PARITY OPTIONS...
Defines custom smartctl options to obtain the SMART attributes for
each disk. This may be required for RAID controllers and some USB
disks that cannot be auto\-detected. The %s placeholder is replaced by
the device name, but it is optional for fixed devices like RAID controllers.
.PP
DISK is the same disk name specified in the \[dq]data\[dq] option.
PARITY is one of the parity names: \[dq]parity\[dq], \[dq]2\-parity\[dq], \[dq]3\-parity\[dq],
\[dq]4\-parity\[dq], \[dq]5\-parity\[dq], \[dq]6\-parity\[dq], or \[dq]z\-parity\[dq].
.PP
In the specified OPTIONS, the \[dq]%s\[dq] string is replaced by the
device name. For RAID controllers, the device is
likely fixed, and you may not need to use \[dq]%s\[dq].
.PP
Refer to the smartmontools documentation for possible options:
.PP
.RS 4
https://www.smartmontools.org/wiki/Supported_RAID\-Controllers
.PD 0
.PP
.PD
https://www.smartmontools.org/wiki/Supported_USB\-Devices
.PD 0
.PD
.RE
.PP
For example:
.PP
.RS 4
smartctl parity \-d sat %s
.PD 0
.PD
.RE
.SS smartignore DISK/PARITY ATTR [ATTR...]
Ignores the specified SMART attribute when computing the probability
of disk failure. This option is useful if a disk reports unusual or
misleading values for a particular attribute.
.PP
DISK is the same disk name specified in the \[dq]data\[dq] option.
PARITY is one of the parity names: \[dq]parity\[dq], \[dq]2\-parity\[dq], \[dq]3\-parity\[dq],
\[dq]4\-parity\[dq], \[dq]5\-parity\[dq], \[dq]6\-parity\[dq], or \[dq]z\-parity\[dq].
The special value * can be used to ignore the attribute on all disks.
.PP
For example, to ignore the \[dq]Current Pending Sector Count\[dq] attribute on
all disks:
.PP
.RS 4
smartignore * 197
.PD 0
.PD
.RE
.PP
To ignore it only on the first parity disk:
.PP
.RS 4
smartignore parity 197
.PD 0
.PD
.RE
.SS Examples
An example of a typical configuration for Unix is:
.PP
.RS 4
parity /mnt/diskp/snapraid.parity
.PD 0
.PP
.PD
content /mnt/diskp/snapraid.content
.PD 0
.PP
.PD
content /var/lib/snapraid/snapraid.content
.PD 0
.PP
.PD
data d1 /mnt/disk1/
.PD 0
.PP
.PD
data d2 /mnt/disk2/
.PD 0
.PP
.PD
data d3 /mnt/disk3/
.PD 0
.PP
.PD
exclude /lost+found/
.PD 0
.PP
.PD
exclude /tmp/
.PD 0
.PP
.PD
smartctl d1 \-d sat %s
.PD 0
.PP
.PD
smartctl d2 \-d usbjmicron %s
.PD 0
.PP
.PD
smartctl parity \-d areca,1/1 /dev/sg0
.PD 0
.PP
.PD
smartctl 2\-parity \-d areca,2/1 /dev/sg0
.PD 0
.PD
.RE
.PP
An example of a typical configuration for Windows is:
.PP
.RS 4
parity E:\\snapraid.parity
.PD 0
.PP
.PD
content E:\\snapraid.content
.PD 0
.PP
.PD
content C:\\snapraid\\snapraid.content
.PD 0
.PP
.PD
data d1 G:\\array\\
.PD 0
.PP
.PD
data d2 H:\\array\\
.PD 0
.PP
.PD
data d3 I:\\array\\
.PD 0
.PP
.PD
exclude Thumbs.db
.PD 0
.PP
.PD
exclude \\$RECYCLE.BIN
.PD 0
.PP
.PD
exclude \\System Volume Information
.PD 0
.PP
.PD
smartctl d1 \-d sat %s
.PD 0
.PP
.PD
smartctl d2 \-d usbjmicron %s
.PD 0
.PP
.PD
smartctl parity \-d areca,1/1 /dev/arcmsr0
.PD 0
.PP
.PD
smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
.PD 0
.PD
.RE
.SH PATTERN
Patterns are used to select a subset of files to exclude or include in
the process.
.PP
There are four different types of patterns:
.TP
.B FILE
Selects any file named FILE. You can use any globbing
characters like * and ?, and character classes like [a\-z].
This pattern applies only to files, not directories.
.TP
.B DIR/
Selects any directory named DIR and everything inside.
You can use any globbing characters like * and ?.
This pattern applies only to directories, not files.
.TP
.B /PATH/FILE
Selects the exact specified file path. You can use any
globbing characters like * and ?, but they never match a
directory slash.
This pattern applies only to files, not directories.
.TP
.B /PATH/DIR/
Selects the exact specified directory path and everything
inside. You can use any globbing characters like * and ?, but
they never match a directory slash.
This pattern applies only to directories, not files.
.PP
When you specify an absolute path starting with /, it is applied at
the array root directory, not the local file system root directory.
.PP
In Windows, you can use the backslash \\ instead of the forward slash /.
Windows system directories, junctions, mount points, and other Windows
special directories are treated as files, meaning that to exclude
them, you must use a file rule, not a directory one.
.PP
If the file name contains a \'*\', \'?\', \'[\',
or \']\' character, you must escape it to avoid having it interpreted as a
globbing character. In Unix, the escape character is \'\\\'; in Windows, it is \'^\'.
When the pattern is on the command line, you must double the escape
character to avoid having it interpreted by the command shell.
.PP
In the configuration file, you can use different strategies to filter
the files to process.
The simplest approach is to use only \[dq]exclude\[dq] rules to remove all the
files and directories you do not want to process. For example:
.PP
.RS 4
# Excludes any file named \[dq]*.unrecoverable\[dq]
.PD 0
.PP
.PD
exclude *.unrecoverable
.PD 0
.PP
.PD
# Excludes the root directory \[dq]/lost+found\[dq]
.PD 0
.PP
.PD
exclude /lost+found/
.PD 0
.PP
.PD
# Excludes any subdirectory named \[dq]tmp\[dq]
.PD 0
.PP
.PD
exclude tmp/
.PD 0
.PD
.RE
.PP
The opposite approach is to define only the files you want to process, using
only \[dq]include\[dq] rules. For example:
.PP
.RS 4
# Includes only some directories
.PD 0
.PP
.PD
include /movies/
.PD 0
.PP
.PD
include /musics/
.PD 0
.PP
.PD
include /pictures/
.PD 0
.PD
.RE
.PP
The final approach is to mix \[dq]exclude\[dq] and \[dq]include\[dq] rules. In this case,
the order of rules is important. Earlier rules take
precedence over later ones.
To simplify, you can list all the \[dq]exclude\[dq] rules first and then
all the \[dq]include\[dq] rules. For example:
.PP
.RS 4
# Excludes any file named \[dq]*.unrecoverable\[dq]
.PD 0
.PP
.PD
exclude *.unrecoverable
.PD 0
.PP
.PD
# Excludes any subdirectory named \[dq]tmp\[dq]
.PD 0
.PP
.PD
exclude tmp/
.PD 0
.PP
.PD
# Includes only some directories
.PD 0
.PP
.PD
include /movies/
.PD 0
.PP
.PD
include /musics/
.PD 0
.PP
.PD
include /pictures/
.PD 0
.PD
.RE
.PP
On the command line, using the \-f option, you can only use \[dq]include\[dq]
patterns. For example:
.PP
.RS 4
# Checks only the .mp3 files.
.PD 0
.PP
.PD
# In Unix, use quotes to avoid globbing expansion by the shell.
.PD 0
.PP
.PD
snapraid \-f \[dq]*.mp3\[dq] check
.PD 0
.PD
.RE
.PP
In Unix, when using globbing characters on the command line, you must
quote them to prevent the shell from expanding them.
.SH CONTENT
SnapRAID stores the list and checksums of your files in the content file.
.PP
It is a binary file that lists all the files present in your disk array,
along with all the checksums to verify their integrity.
.PP
This file is read and written by the \[dq]sync\[dq] and \[dq]scrub\[dq] commands and
read by the \[dq]fix\[dq], \[dq]check\[dq], and \[dq]status\[dq] commands.
.SH PARITY
SnapRAID stores the parity information of your array in the parity
files.
.PP
These are binary files containing the computed parity of all the
blocks defined in the \[dq]content\[dq] file.
.PP
These files are read and written by the \[dq]sync\[dq] and \[dq]fix\[dq] commands and
only read by the \[dq]scrub\[dq] and \[dq]check\[dq] commands.
.SH ENCODING
SnapRAID in Unix ignores any encoding. It reads and stores the
file names with the same encoding used by the file system.
.PP
In Windows, all names read from the file system are converted and
processed in UTF\-8 format.
.PP
To have file names printed correctly, you must set the Windows
console to UTF\-8 mode with the command \[dq]chcp 65001\[dq] and use
a TrueType font like \[dq]Lucida Console\[dq] as the console font.
This affects only the printed file names; if you
redirect the console output to a file, the resulting file is always
in UTF\-8 format.
.SH COPYRIGHT
This file is Copyright (C) 2025 Andrea Mazzoleni
.SH SEE ALSO
rsync(1)
|