diff --git a/HISTORY b/HISTORY index 5bfc44c7..273528e6 100644 --- a/HISTORY +++ b/HISTORY @@ -10,6 +10,8 @@ SnapRAID HISTORY up to 89 disks with Hexa (6) parity is possible, but not yet implemented. Note that more general approaches without these limitations are also possible, but they would affect badly the performance. + * Removed the detailed list of errors from the screen output. + To get it you must explicitely uses the -l, --log option. * Reduced memory usage avoiding to allocate unnecessary memory. 4.1 2013/9 diff --git a/snapraid.1 b/snapraid.1 index 1cf6c8cf..21fc1008 100644 --- a/snapraid.1 +++ b/snapraid.1 @@ -282,9 +282,19 @@ Note that the fix command will revert your data at the state of the last \(a"sync\(a" command executed. It works like a snapshot was taken in \(a"sync\(a". .PP -In this regard SnapRAID is more like a backup program than a RAID -system. For example, you can use it to restore a file or directory to -its previous state using the \(hyf, \(hy\(hyfilter option : +To see the list of files meanwhile they are checked and fixed, you can +used the \(hyv, \(hy\(hyverbose option. Like: +.PP +.RS 4 +snapraid fix \(hyv +.PD 0 +.PP +.PD +.RE +.SS Recovering and Undeleting +In recovering SnapRAID is more like a backup program than a RAID system, +and it can be used to restore or undelete only a single file or directory +to its previous state using the \(hyf, \(hy\(hyfilter option : .PP .RS 4 snapraid fix \(hyf FILE @@ -303,7 +313,8 @@ snapraid fix \(hyf DIR/ .RE .PP You can also use it to recover only accidentally deleted files inside -a directory using the \(hym, \(hy\(hyfilter\(hymissing option, like: +a directory using the \(hym, \(hy\(hyfilter\(hymissing option, that restores +only missing files, leaving untouched all the others. .PP .RS 4 snapraid fix \(hym \(hyf DIR/ @@ -312,7 +323,7 @@ snapraid fix \(hym \(hyf DIR/ .PD .RE .PP -Or to recover all the deleted files with: +Or to recover all the deleted files in all the drives with: .PP .RS 4 snapraid fix \(hym @@ -673,11 +684,11 @@ disk in the free space left in an already used disk. and this option allows you to continue anyway. .TP .B \(hyl, \(hy\(hylog FILE -Redirect the detailed log of errors to the specified file. +Write a detailed log of errors found in check and fix. This log contains the exact specification of which block of any file is not recoverable and why. -If this option is not specified, the log is printed in -the console using the standard error stream. +If this option is not specified, no detailed log is printed, +and you\(cqll get only a summary at the end of the operations. When checking and fixing this allows to keep separated the possible huge list of errors from the human readable output. diff --git a/snapraid.c b/snapraid.c index 2e0fccf1..e7a51564 100644 --- a/snapraid.c +++ b/snapraid.c @@ -79,9 +79,9 @@ void usage(void) printf(" " SWITCH_GETOPT_LONG("-V, --version ", "-V") " Version\n"); } -void memory(struct snapraid_state* state) +void memory(int gui) { - if (state->opt.gui) { + if (gui) { fprintf(stdlog, "memory:used:%"PRIu64"\n", (uint64_t)malloc_counter()); } else { printf("Using %u MiB of memory.\n", (unsigned)(malloc_counter() / 1024 / 1024)); @@ -528,9 +528,14 @@ int main(int argc, char* argv[]) } } - /* open the log file */ - if (log == 0) - log = "2"; + /* if no log file is specified, don't output */ + if (log == 0) { +#ifdef _WIN32 + log = "NUL"; +#else + log = "/dev/null"; +#endif + } if (strcmp(log, "1") == 0) { stdlog = stdout; } else if (strcmp(log, "2") == 0) { @@ -574,13 +579,13 @@ int main(int argc, char* argv[]) state_scan(&state, 1); - memory(&state); + memory(state.opt.gui); } else if (operation == OPERATION_SYNC) { state_read(&state); state_scan(&state, 0); - memory(&state); + memory(state.opt.gui); /* intercept Ctrl+C */ signal(SIGINT, &signal_handler); @@ -627,7 +632,7 @@ int main(int argc, char* argv[]) /* apply the command line filter */ state_filter(&state, &filterlist_file, &filterlist_disk, filter_missing, filter_error); - memory(&state); + memory(state.opt.gui); /* intercept Ctrl+C */ signal(SIGINT, &signal_handler); @@ -647,7 +652,7 @@ int main(int argc, char* argv[]) } else if (operation == OPERATION_SCRUB) { state_read(&state); - memory(&state); + memory(state.opt.gui); /* intercept Ctrl+C */ signal(SIGINT, &signal_handler); @@ -666,11 +671,11 @@ int main(int argc, char* argv[]) state_write(&state); - memory(&state); + memory(state.opt.gui); } else if (operation == OPERATION_STATUS) { state_read(&state); - memory(&state); + memory(state.opt.gui); state_status(&state); } else if (operation == OPERATION_DUP) { @@ -690,7 +695,7 @@ int main(int argc, char* argv[]) /* apply the command line filter */ state_filter(&state, &filterlist_file, &filterlist_disk, filter_missing, filter_error); - memory(&state); + memory(state.opt.gui); /* intercept Ctrl+C */ signal(SIGINT, &signal_handler); diff --git a/snapraid.d b/snapraid.d index 1e37c502..adb6aa41 100644 --- a/snapraid.d +++ b/snapraid.d @@ -159,9 +159,15 @@ Getting Started last "sync" command executed. It works like a snapshot was taken in "sync". - In this regard SnapRAID is more like a backup program than a RAID - system. For example, you can use it to restore a file or directory to - its previous state using the -f, --filter option : + To see the list of files meanwhile they are checked and fixed, you can + used the -v, --verbose option. Like: + + :snapraid fix -v + + Recovering and Undeleting + In recovering SnapRAID is more like a backup program than a RAID system, + and it can be used to restore or undelete only a single file or directory + to its previous state using the -f, --filter option : :snapraid fix -f FILE @@ -170,11 +176,12 @@ Getting Started :snapraid fix -f DIR/ You can also use it to recover only accidentally deleted files inside - a directory using the -m, --filter-missing option, like: + a directory using the -m, --filter-missing option, that restores + only missing files, leaving untouched all the others. :snapraid fix -m -f DIR/ - Or to recover all the deleted files with: + Or to recover all the deleted files in all the drives with: :snapraid fix -m @@ -497,11 +504,11 @@ Options option allows you to continue anyway. -l, --log FILE - Redirect the detailed log of errors to the specified file. + Write a detailed log of errors found in check and fix. This log contains the exact specification of which block of any file is not recoverable and why. - If this option is not specified, the log is printed in - the console using the standard error stream. + If this option is not specified, no detailed log is printed, + and you'll get only a summary at the end of the operations. When checking and fixing this allows to keep separated the possible huge list of errors from the human readable output. diff --git a/snapraid.txt b/snapraid.txt index 5d5e6263..c960e4cc 100644 --- a/snapraid.txt +++ b/snapraid.txt @@ -174,9 +174,17 @@ Note that the fix command will revert your data at the state of the last "sync" command executed. It works like a snapshot was taken in "sync". -In this regard SnapRAID is more like a backup program than a RAID -system. For example, you can use it to restore a file or directory to -its previous state using the -f, --filter option : +To see the list of files meanwhile they are checked and fixed, you can +used the -v, --verbose option. Like: + + snapraid fix -v + +4.2 Recovering and Undeleting +----------------------------- + +In recovering SnapRAID is more like a backup program than a RAID system, +and it can be used to restore or undelete only a single file or directory +to its previous state using the -f, --filter option : snapraid fix -f FILE @@ -185,15 +193,16 @@ or for a directory: snapraid fix -f DIR/ You can also use it to recover only accidentally deleted files inside -a directory using the -m, --filter-missing option, like: +a directory using the -m, --filter-missing option, that restores +only missing files, leaving untouched all the others. snapraid fix -m -f DIR/ -Or to recover all the deleted files with: +Or to recover all the deleted files in all the drives with: snapraid fix -m -4.2 Scrubbing +4.3 Scrubbing ------------- To periodically check the old data for errors, you can run the "scrub" @@ -225,7 +234,7 @@ if really fixed. You can use -p 0 to scrub only blocks marked as bad. snapraid -p 0 scrub -4.3 Pooling +4.4 Pooling ----------- To have all the files in your array shown in the same directory tree, @@ -540,11 +549,11 @@ SnapRAID provides the following options: option allows you to continue anyway. -l, --log FILE - Redirect the detailed log of errors to the specified file. + Write a detailed log of errors found in check and fix. This log contains the exact specification of which block of any file is not recoverable and why. - If this option is not specified, the log is printed in - the console using the standard error stream. + If this option is not specified, no detailed log is printed, + and you'll get only a summary at the end of the operations. When checking and fixing this allows to keep separated the possible huge list of errors from the human readable output.