Removes the detailed log from the screen.

This commit is contained in:
Andrea Mazzoleni 2013-09-28 12:39:55 +02:00
parent d525b4a14a
commit 82f85ed45d
5 changed files with 72 additions and 38 deletions

View file

@ -10,6 +10,8 @@ SnapRAID HISTORY
up to 89 disks with Hexa (6) parity is possible, but not yet implemented. up to 89 disks with Hexa (6) parity is possible, but not yet implemented.
Note that more general approaches without these limitations are also Note that more general approaches without these limitations are also
possible, but they would affect badly the performance. 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. * Reduced memory usage avoiding to allocate unnecessary memory.
4.1 2013/9 4.1 2013/9

View file

@ -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 last \(a"sync\(a" command executed. It works like a snapshot was taken
in \(a"sync\(a". in \(a"sync\(a".
.PP .PP
In this regard SnapRAID is more like a backup program than a RAID To see the list of files meanwhile they are checked and fixed, you can
system. For example, you can use it to restore a file or directory to used the \(hyv, \(hy\(hyverbose option. Like:
its previous state using the \(hyf, \(hy\(hyfilter option : .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 .PP
.RS 4 .RS 4
snapraid fix \(hyf FILE snapraid fix \(hyf FILE
@ -303,7 +313,8 @@ snapraid fix \(hyf DIR/
.RE .RE
.PP .PP
You can also use it to recover only accidentally deleted files inside 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 .PP
.RS 4 .RS 4
snapraid fix \(hym \(hyf DIR/ snapraid fix \(hym \(hyf DIR/
@ -312,7 +323,7 @@ snapraid fix \(hym \(hyf DIR/
.PD .PD
.RE .RE
.PP .PP
Or to recover all the deleted files with: Or to recover all the deleted files in all the drives with:
.PP .PP
.RS 4 .RS 4
snapraid fix \(hym 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. option allows you to continue anyway.
.TP .TP
.B \(hyl, \(hy\(hylog FILE .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 This log contains the exact specification of which block of
any file is not recoverable and why. any file is not recoverable and why.
If this option is not specified, the log is printed in If this option is not specified, no detailed log is printed,
the console using the standard error stream. and you\(cqll get only a summary at the end of the operations.
When checking and fixing this allows to keep separated When checking and fixing this allows to keep separated
the possible huge list of errors from the human readable the possible huge list of errors from the human readable
output. output.

View file

@ -79,9 +79,9 @@ void usage(void)
printf(" " SWITCH_GETOPT_LONG("-V, --version ", "-V") " Version\n"); 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()); fprintf(stdlog, "memory:used:%"PRIu64"\n", (uint64_t)malloc_counter());
} else { } else {
printf("Using %u MiB of memory.\n", (unsigned)(malloc_counter() / 1024 / 1024)); 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 no log file is specified, don't output */
if (log == 0) if (log == 0) {
log = "2"; #ifdef _WIN32
log = "NUL";
#else
log = "/dev/null";
#endif
}
if (strcmp(log, "1") == 0) { if (strcmp(log, "1") == 0) {
stdlog = stdout; stdlog = stdout;
} else if (strcmp(log, "2") == 0) { } else if (strcmp(log, "2") == 0) {
@ -574,13 +579,13 @@ int main(int argc, char* argv[])
state_scan(&state, 1); state_scan(&state, 1);
memory(&state); memory(state.opt.gui);
} else if (operation == OPERATION_SYNC) { } else if (operation == OPERATION_SYNC) {
state_read(&state); state_read(&state);
state_scan(&state, 0); state_scan(&state, 0);
memory(&state); memory(state.opt.gui);
/* intercept Ctrl+C */ /* intercept Ctrl+C */
signal(SIGINT, &signal_handler); signal(SIGINT, &signal_handler);
@ -627,7 +632,7 @@ int main(int argc, char* argv[])
/* apply the command line filter */ /* apply the command line filter */
state_filter(&state, &filterlist_file, &filterlist_disk, filter_missing, filter_error); state_filter(&state, &filterlist_file, &filterlist_disk, filter_missing, filter_error);
memory(&state); memory(state.opt.gui);
/* intercept Ctrl+C */ /* intercept Ctrl+C */
signal(SIGINT, &signal_handler); signal(SIGINT, &signal_handler);
@ -647,7 +652,7 @@ int main(int argc, char* argv[])
} else if (operation == OPERATION_SCRUB) { } else if (operation == OPERATION_SCRUB) {
state_read(&state); state_read(&state);
memory(&state); memory(state.opt.gui);
/* intercept Ctrl+C */ /* intercept Ctrl+C */
signal(SIGINT, &signal_handler); signal(SIGINT, &signal_handler);
@ -666,11 +671,11 @@ int main(int argc, char* argv[])
state_write(&state); state_write(&state);
memory(&state); memory(state.opt.gui);
} else if (operation == OPERATION_STATUS) { } else if (operation == OPERATION_STATUS) {
state_read(&state); state_read(&state);
memory(&state); memory(state.opt.gui);
state_status(&state); state_status(&state);
} else if (operation == OPERATION_DUP) { } else if (operation == OPERATION_DUP) {
@ -690,7 +695,7 @@ int main(int argc, char* argv[])
/* apply the command line filter */ /* apply the command line filter */
state_filter(&state, &filterlist_file, &filterlist_disk, filter_missing, filter_error); state_filter(&state, &filterlist_file, &filterlist_disk, filter_missing, filter_error);
memory(&state); memory(state.opt.gui);
/* intercept Ctrl+C */ /* intercept Ctrl+C */
signal(SIGINT, &signal_handler); signal(SIGINT, &signal_handler);

View file

@ -159,9 +159,15 @@ Getting Started
last "sync" command executed. It works like a snapshot was taken last "sync" command executed. It works like a snapshot was taken
in "sync". in "sync".
In this regard SnapRAID is more like a backup program than a RAID To see the list of files meanwhile they are checked and fixed, you can
system. For example, you can use it to restore a file or directory to used the -v, --verbose option. Like:
its previous state using the -f, --filter option :
: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 :snapraid fix -f FILE
@ -170,11 +176,12 @@ Getting Started
:snapraid fix -f DIR/ :snapraid fix -f DIR/
You can also use it to recover only accidentally deleted files inside 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/ :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 :snapraid fix -m
@ -497,11 +504,11 @@ Options
option allows you to continue anyway. option allows you to continue anyway.
-l, --log FILE -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 This log contains the exact specification of which block of
any file is not recoverable and why. any file is not recoverable and why.
If this option is not specified, the log is printed in If this option is not specified, no detailed log is printed,
the console using the standard error stream. and you'll get only a summary at the end of the operations.
When checking and fixing this allows to keep separated When checking and fixing this allows to keep separated
the possible huge list of errors from the human readable the possible huge list of errors from the human readable
output. output.

View file

@ -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 last "sync" command executed. It works like a snapshot was taken
in "sync". in "sync".
In this regard SnapRAID is more like a backup program than a RAID To see the list of files meanwhile they are checked and fixed, you can
system. For example, you can use it to restore a file or directory to used the -v, --verbose option. Like:
its previous state using the -f, --filter option :
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 snapraid fix -f FILE
@ -185,15 +193,16 @@ or for a directory:
snapraid fix -f DIR/ snapraid fix -f DIR/
You can also use it to recover only accidentally deleted files inside 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/ 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 snapraid fix -m
4.2 Scrubbing 4.3 Scrubbing
------------- -------------
To periodically check the old data for errors, you can run the "scrub" 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 snapraid -p 0 scrub
4.3 Pooling 4.4 Pooling
----------- -----------
To have all the files in your array shown in the same directory tree, 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. option allows you to continue anyway.
-l, --log FILE -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 This log contains the exact specification of which block of
any file is not recoverable and why. any file is not recoverable and why.
If this option is not specified, the log is printed in If this option is not specified, no detailed log is printed,
the console using the standard error stream. and you'll get only a summary at the end of the operations.
When checking and fixing this allows to keep separated When checking and fixing this allows to keep separated
the possible huge list of errors from the human readable the possible huge list of errors from the human readable
output. output.