From a7e9cdd8c6f6e1730f4d8ba0b103664289f76219 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Fri, 16 Jan 2026 00:28:12 +0100 Subject: [PATCH] Log the exit summary of the status command --- cmdline/status.c | 7 ++++ doc/snapraid_log.1 | 89 ++++++++++++++++++++++++++++++++------------ doc/snapraid_log.d | 66 +++++++++++++++++--------------- doc/snapraid_log.txt | 79 ++++++++++++++++++++++++--------------- 4 files changed, 157 insertions(+), 84 deletions(-) diff --git a/cmdline/status.c b/cmdline/status.c index 01af483c..944d4c48 100644 --- a/cmdline/status.c +++ b/cmdline/status.c @@ -575,6 +575,13 @@ int state_status(struct snapraid_state* state) printf("No error detected.\n"); } + if (bad) + log_tag("summary:exit:bad\n"); + else if (unsynced_blocks) + log_tag("summary:exit:unsynced\n"); + else + log_tag("summary:exit:ok\n"); + /* free the temp vector */ free(timemap); diff --git a/doc/snapraid_log.1 b/doc/snapraid_log.1 index 4a2f2afd..133c75c1 100644 --- a/doc/snapraid_log.1 +++ b/doc/snapraid_log.1 @@ -336,13 +336,21 @@ protected file to a new path (uint). Total number of new files matching a parity entry by name/time/size but with a new inode (uint). .TP -.B summary:exit:equal -A zero\-argument tag indicating that no differences were found. +.B summary:exit: +Logs the overall exit status of the command. The \`status\` is +one of the following: +.RS 4 +.PD 0 +.HP 4 +.I equal +Indicates that no differences were found. The array is already synchronized. -.TP -.B summary:exit:diff -A zero\-argument tag indicating that differences were found. +.HP 4 +.I diff +Indicates that differences were found. The array needs a \`sync\` operation. +.PD +.RE .SH GENERAL PROGRESS AND EXECUTION TAGS These tags are used to report the runtime processing of the commands \`sync\`, \`scrub\`, \`check\` and \`fix\`. @@ -726,6 +734,26 @@ Days ago the median block was last scrubbed. .TP .B summary:scrub_newest_days: Days ago the newest block was last scrubbed. +.TP +.B summary:exit: +Logs the overall exit status of the command. The \`status\` is +one of the following: +.RS 4 +.PD 0 +.HP 4 +.I ok +No issues. The array is fully synchronized and healthy. +.HP 4 +.I bad +The array has some blocks marked as bad. +The array needs a \`\-e fix\` and and a \`\-p bad scrub\` +operation. +.HP 4 +.I unsynced +The array has an interrupted sync. +The array needs another \`sync\` operation. +.PD +.RE .SS Per\-Disk Tags These tags provide statistics for individual data disks. is the disk name. @@ -1404,14 +1432,19 @@ The total size of duplicate files in gigabytes (uint64). .PD .RE .TP -.B summary:exit:unique -Logs the final exit status indicating that no duplicate files were -found. This tag is logged if \`\` is zero. -.TP -.B summary:exit:dup -Logs the final exit status indicating that at least one duplicate -file was found. This tag is logged if \`\` is greater than -zero. +.B summary:exit: +Logs the overall exit status of the command. The \`status\` is one of +the following: +.RS 4 +.PD 0 +.HP 4 +.I unique +Indicates that no duplicate files were found. +.HP 4 +.I dup +Indicates that at least one duplicate file was found. +.PD +.RE .SH COMMAND POOL TAGS This section describes the tags output with the \`pool\` command. .TP @@ -1434,21 +1467,29 @@ This section describes the tags output with the \`rehash\` command. .SS Summary Tags These tags provide a final summary of the rehash scheduling process. .TP -.B summary:exit:scheduled -Logs the final exit status indicating that a rehash operation has +.B summary:exit: +Logs the overall exit status of the command. The \`status\` is one of +the following: +.RS 4 +.PD 0 +.HP 4 +.I scheduled +Indicates that a rehash operation has been successfully scheduled. The rehash will be performed incrementally in future \`sync\` or \`scrub\` commands. -.TP -.B summary:exit:already_in_progress -Logs the final exit status indicating that a rehash is already +.HP 4 +.I already_in_progress +Indicates that that a rehash is already in progress and cannot be scheduled again. This causes the program to exit with a fatal error. -.TP -.B summary:exit:not_required -Logs the final exit status indicating that the current hash -algorithm is already the \`best hash\` for the platform, and thus -a rehash is not required. This causes the program to exit with -a fatal error. +.HP 4 +.I not_required +Indicates that the current hash algorithm is +already the \`best hash\` for the platform, and thus +a rehash is not required. This causes the program to +exit with a fatal error. +.PD +.RE .SH COMMAND SMART AND PROBE TAGS This section describes the tags output by the \`smart\` and \`probe\` commands. The main difference between the two is that \`probe\` doesn\'t diff --git a/doc/snapraid_log.d b/doc/snapraid_log.d index af37f6ba..1155607d 100644 --- a/doc/snapraid_log.d +++ b/doc/snapraid_log.d @@ -253,13 +253,14 @@ Scan Tags Total number of new files matching a parity entry by name/time/size but with a new inode (uint). - =summary:exit:equal - A zero-argument tag indicating that no differences were found. - The array is already synchronized. - - =summary:exit:diff - A zero-argument tag indicating that differences were found. - The array needs a `sync` operation. + =summary:exit: + Logs the overall exit status of the command. The `status` is + one of the following: + + equal - Indicates that no differences were found. + The array is already synchronized. + diff - Indicates that differences were found. + The array needs a `sync` operation. General Progress and Execution Tags These tags are used to report the runtime processing of the commands @@ -490,6 +491,16 @@ Command Status Tags Days ago the median block was last scrubbed. =summary:scrub_newest_days: Days ago the newest block was last scrubbed. + =summary:exit: + Logs the overall exit status of the command. The `status` is + one of the following: + + ok - No issues. The array is fully synchronized and healthy. + bad - The array has some blocks marked as bad. + The array needs a `-e fix` and and a `-p bad scrub` + operation. + unsynced - The array has an interrupted sync. + The array needs another `sync` operation. Per-Disk Tags These tags provide statistics for individual data disks. @@ -885,14 +896,12 @@ Command Dup Tags - The total size of duplicate files in gigabytes (uint64). - =summary:exit:unique - Logs the final exit status indicating that no duplicate files were - found. This tag is logged if `` is zero. + =summary:exit: + Logs the overall exit status of the command. The `status` is one of + the following: - =summary:exit:dup - Logs the final exit status indicating that at least one duplicate - file was found. This tag is logged if `` is greater than - zero. + unique - Indicates that no duplicate files were found. + dup - Indicates that at least one duplicate file was found. Command Pool Tags This section describes the tags output with the `pool` command. @@ -913,21 +922,20 @@ Command Rehash Tags Summary Tags These tags provide a final summary of the rehash scheduling process. - =summary:exit:scheduled - Logs the final exit status indicating that a rehash operation has - been successfully scheduled. The rehash will be performed - incrementally in future `sync` or `scrub` commands. - - =summary:exit:already_in_progress - Logs the final exit status indicating that a rehash is already - in progress and cannot be scheduled again. This causes the - program to exit with a fatal error. - - =summary:exit:not_required - Logs the final exit status indicating that the current hash - algorithm is already the `best hash` for the platform, and thus - a rehash is not required. This causes the program to exit with - a fatal error. + =summary:exit: + Logs the overall exit status of the command. The `status` is one of + the following: + + scheduled - Indicates that a rehash operation has + been successfully scheduled. The rehash will be performed + incrementally in future `sync` or `scrub` commands. + already_in_progress - Indicates that that a rehash is already + in progress and cannot be scheduled again. This causes the + program to exit with a fatal error. + not_required - Indicates that the current hash algorithm is + already the `best hash` for the platform, and thus + a rehash is not required. This causes the program to + exit with a fatal error. Command Smart And Probe Tags This section describes the tags output by the `smart` and `probe` diff --git a/doc/snapraid_log.txt b/doc/snapraid_log.txt index 3775041b..cc0c2067 100644 --- a/doc/snapraid_log.txt +++ b/doc/snapraid_log.txt @@ -238,32 +238,40 @@ content file. They are output for every discovered change, and These tags provide a final count of all detected changes. summary:equal: - Total number of equal (unchanged) files/links/firs found (uint). + Total number of files/dirs/links whose metadata and data match + the current parity (uint). summary:added: - Total number of new files/links/dirs found (uint). + Total number of new brand new files/dirs/links that have no + relationship to existing parity (uint). summary:removed: - Total number of removed files/links/dirs found (uint). + Total number of files/dirs/links that existed in the last sync + but are now missing (uint). summary:updated: - Total number of updated files/links found (uint). + Total number of existing files where the timestamp or size has + changed (uint). summary:moved: - Total number of moved files found (uint). + Total number of files relocated to a new path but retaining + the same inode (uint). summary:copied: - Total number of copied files found (uint). + Total number of new files created by copying an existing + protected file to a new path (uint). summary:restored: - Total number of restored files found (uint). + Total number of new files matching a parity entry by + name/time/size but with a new inode (uint). - summary:exit:equal - A zero-argument tag indicating that no differences were found. + summary:exit: + Logs the overall exit status of the command. The `status` is + one of the following: + + equal - Indicates that no differences were found. The array is already synchronized. - - summary:exit:diff - A zero-argument tag indicating that differences were found. + diff - Indicates that differences were found. The array needs a `sync` operation. @@ -504,6 +512,16 @@ and overall state. Days ago the median block was last scrubbed. summary:scrub_newest_days: Days ago the newest block was last scrubbed. + summary:exit: + Logs the overall exit status of the command. The `status` is + one of the following: + + ok - No issues. The array is fully synchronized and healthy. + bad - The array has some blocks marked as bad. + The array needs a `-e fix` and and a `-p bad scrub` + operation. + unsynced - The array has an interrupted sync. + The array needs another `sync` operation. ---- 7.0.2 Per-Disk Tags ---- These tags provide statistics for individual data disks. @@ -911,14 +929,12 @@ These tags provide a final summary of the duplicate finding process. - The total size of duplicate files in gigabytes (uint64). - summary:exit:unique - Logs the final exit status indicating that no duplicate files were - found. This tag is logged if `` is zero. + summary:exit: + Logs the overall exit status of the command. The `status` is one of + the following: - summary:exit:dup - Logs the final exit status indicating that at least one duplicate - file was found. This tag is logged if `` is greater than - zero. + unique - Indicates that no duplicate files were found. + dup - Indicates that at least one duplicate file was found. 12 COMMAND POOL TAGS @@ -945,21 +961,20 @@ This section describes the tags output with the `rehash` command. ---- 13.0.1 Summary Tags ---- These tags provide a final summary of the rehash scheduling process. - summary:exit:scheduled - Logs the final exit status indicating that a rehash operation has + summary:exit: + Logs the overall exit status of the command. The `status` is one of + the following: + + scheduled - Indicates that a rehash operation has been successfully scheduled. The rehash will be performed incrementally in future `sync` or `scrub` commands. - - summary:exit:already_in_progress - Logs the final exit status indicating that a rehash is already + already_in_progress - Indicates that that a rehash is already in progress and cannot be scheduled again. This causes the program to exit with a fatal error. - - summary:exit:not_required - Logs the final exit status indicating that the current hash - algorithm is already the `best hash` for the platform, and thus - a rehash is not required. This causes the program to exit with - a fatal error. + not_required - Indicates that the current hash algorithm is + already the `best hash` for the platform, and thus + a rehash is not required. This causes the program to + exit with a fatal error. 14 COMMAND SMART AND PROBE TAGS @@ -1155,7 +1170,9 @@ commands that access files and parities. parity_error[_io|_data]::: Logs errors during parity disk read or write operations. ----- 16.0.1 _io - Indicates a physical Input/Output error. ---- + _io - Indicates a physical Input/Output error. + The disk was unable to read or write a specific block, + typically signaling a failing sector or cable issue. _data - Indicates the data was read successfully but failed the checksum/hash verification. This signals `silent` corruption or an unsuccessful parity match.