mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Adds a new --force-device option to allow to fix with disk with same device ID.
This commit is contained in:
parent
4c8b79b13c
commit
d8870cdd42
6 changed files with 49 additions and 10 deletions
11
snapraid.1
11
snapraid.1
|
|
@ -18,7 +18,7 @@ snapraid [\(hyc, \(hy\(hyconf CONFIG]
|
|||
.PD 0
|
||||
.PP
|
||||
.PD
|
||||
[\(hyZ, \(hy\(hyforce\(hyzero] [\(hyE, \(hy\(hyforce\(hyempty] [\(hyU, \(hy\(hyforce\(hyuuid]
|
||||
[\(hyZ, \(hy\(hyforce\(hyzero] [\(hyE, \(hy\(hyforce\(hyempty] [\(hyU, \(hy\(hyforce\(hyuuid] [\(hyD, \(hy\(hyforce\(hydevice]
|
||||
.PD 0
|
||||
.PP
|
||||
.PD
|
||||
|
|
@ -559,6 +559,15 @@ the normal case of replacing disks.
|
|||
This option can be used only with the \(a"sync\(a", \(a"check\(a" or
|
||||
\(a"fix\(a" command.
|
||||
.TP
|
||||
.B \(hyD, \(hy\(hyforce\(hydevice
|
||||
Forces the insecure operation of fixing with disks on the same
|
||||
physical device.
|
||||
If SnapRAID detects that two disks have the same device ID,
|
||||
it stops proceeding, because it\(cqs not a supported configuration.
|
||||
But it could happen what you want to temporarely restore a lost
|
||||
disk in the free space left in an already used disk. and this
|
||||
option will allow you to continue anyway.
|
||||
.TP
|
||||
.B \(hys, \(hy\(hystart BLKSTART
|
||||
Starts the processing from the specified
|
||||
block number. It could be useful to easy retry to check
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ void usage(void)
|
|||
printf(" " SWITCH_GETOPT_LONG("-Z, --force-zero ", "-Z") " Force synching of files that get zero size\n");
|
||||
printf(" " SWITCH_GETOPT_LONG("-E, --force-empty ", "-E") " Force synching of disks that get empty\n");
|
||||
printf(" " SWITCH_GETOPT_LONG("-U, --force-uuid ", "-U") " Force commands on disks with uuid changed\n");
|
||||
printf(" " SWITCH_GETOPT_LONG("-D, --force-device ", "-D") " Force commands on disks with same device id\n");
|
||||
printf(" " SWITCH_GETOPT_LONG("-s, --start BLKSTART ", "-s") " Start from the specified block number\n");
|
||||
printf(" " SWITCH_GETOPT_LONG("-t, --count BLKCOUNT ", "-t") " Count of block to process\n");
|
||||
printf(" " SWITCH_GETOPT_LONG("-v, --verbose ", "-v") " Verbose\n");
|
||||
|
|
@ -107,6 +108,7 @@ struct option long_options[] = {
|
|||
{ "force-zero", 0, 0, 'Z' },
|
||||
{ "force-empty", 0, 0, 'E' },
|
||||
{ "force-uuid", 0, 0, 'U' },
|
||||
{ "force-device", 0, 0, 'D' },
|
||||
{ "find-by-name", 0, 0, 'N' },
|
||||
{ "audit-only", 0, 0, 'a' },
|
||||
{ "speed-test", 0, 0, 'T' },
|
||||
|
|
@ -166,7 +168,7 @@ struct option long_options[] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
#define OPTIONS "c:f:d:ms:t:i:l:ZEUNaTvhVG"
|
||||
#define OPTIONS "c:f:d:ms:t:i:l:ZEUDNaTvhVG"
|
||||
|
||||
volatile int global_interrupt = 0;
|
||||
|
||||
|
|
@ -293,6 +295,9 @@ int main(int argc, char* argv[])
|
|||
case 'U' :
|
||||
opt.force_uuid = 1;
|
||||
break;
|
||||
case 'D' :
|
||||
opt.force_device = 1;
|
||||
break;
|
||||
case 'N' :
|
||||
opt.force_by_name = 1;
|
||||
break;
|
||||
|
|
|
|||
11
snapraid.d
11
snapraid.d
|
|
@ -6,7 +6,7 @@ Synopsis
|
|||
: [-f, --filter PATTERN] [-d, --filter-disk NAME] [-m, --filter-missing]
|
||||
: [-a, --audit-only] [-i, --import DIR]
|
||||
: [-N, --find-by-name]
|
||||
: [-Z, --force-zero] [-E, --force-empty] [-U, --force-uuid]
|
||||
: [-Z, --force-zero] [-E, --force-empty] [-U, --force-uuid] [-D, --force-device]
|
||||
: [-s, --start BLKSTART] [-t, --count BLKCOUNT]
|
||||
: [-v, --verbose] [-l, --log FILE]
|
||||
: sync|status|scrub|diff|dup|pool|check|fix|rehash
|
||||
|
|
@ -419,6 +419,15 @@ Options
|
|||
This option can be used only with the "sync", "check" or
|
||||
"fix" command.
|
||||
|
||||
-D, --force-device
|
||||
Forces the insecure operation of fixing with disks on the same
|
||||
physical device.
|
||||
If SnapRAID detects that two disks have the same device ID,
|
||||
it stops proceeding, because it's not a supported configuration.
|
||||
But it could happen what you want to temporarely restore a lost
|
||||
disk in the free space left in an already used disk. and this
|
||||
option will allow you to continue anyway.
|
||||
|
||||
-s, --start BLKSTART
|
||||
Starts the processing from the specified
|
||||
block number. It could be useful to easy retry to check
|
||||
|
|
|
|||
11
snapraid.txt
11
snapraid.txt
|
|
@ -10,7 +10,7 @@ snapraid [-c, --conf CONFIG]
|
|||
[-f, --filter PATTERN] [-d, --filter-disk NAME] [-m, --filter-missing]
|
||||
[-a, --audit-only] [-i, --import DIR]
|
||||
[-N, --find-by-name]
|
||||
[-Z, --force-zero] [-E, --force-empty] [-U, --force-uuid]
|
||||
[-Z, --force-zero] [-E, --force-empty] [-U, --force-uuid] [-D, --force-device]
|
||||
[-s, --start BLKSTART] [-t, --count BLKCOUNT]
|
||||
[-v, --verbose] [-l, --log FILE]
|
||||
sync|status|scrub|diff|dup|pool|check|fix|rehash
|
||||
|
|
@ -460,6 +460,15 @@ SnapRAID provides the following options:
|
|||
This option can be used only with the "sync", "check" or
|
||||
"fix" command.
|
||||
|
||||
-D, --force-device
|
||||
Forces the insecure operation of fixing with disks on the same
|
||||
physical device.
|
||||
If SnapRAID detects that two disks have the same device ID,
|
||||
it stops proceeding, because it's not a supported configuration.
|
||||
But it could happen what you want to temporarely restore a lost
|
||||
disk in the free space left in an already used disk. and this
|
||||
option will allow you to continue anyway.
|
||||
|
||||
-s, --start BLKSTART
|
||||
Starts the processing from the specified
|
||||
block number. It could be useful to easy retry to check
|
||||
|
|
|
|||
18
state.c
18
state.c
|
|
@ -112,14 +112,20 @@ static void state_config_check(struct snapraid_state* state, const char* path)
|
|||
}
|
||||
#endif
|
||||
|
||||
for(j=i->next;j!=0;j=j->next) {
|
||||
struct snapraid_disk* other = j->data;
|
||||
if (disk->device == other->device) {
|
||||
fprintf(stderr, "Disks '%s' and '%s' are on the same device.\n", disk->dir, other->dir);
|
||||
if (!state->opt.force_device) {
|
||||
for(j=i->next;j!=0;j=j->next) {
|
||||
struct snapraid_disk* other = j->data;
|
||||
if (disk->device == other->device) {
|
||||
fprintf(stderr, "Disks '%s' and '%s' are on the same device.\n", disk->dir, other->dir);
|
||||
#ifdef _WIN32
|
||||
fprintf(stderr, "Both have the serial number '%"PRIx64"'.\n", disk->device);
|
||||
fprintf(stderr, "Both have the serial number '%"PRIx64"'.\n", disk->device);
|
||||
#endif
|
||||
exit(EXIT_FAILURE);
|
||||
/* in "fix" we allow to continue anyway */
|
||||
if (strcmp(state->command, "fix") == 0) {
|
||||
fprintf(stderr, "You can '%s' anyway, using 'snapraid --force-device %s'.\n", state->command, state->command);
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
1
state.h
1
state.h
|
|
@ -41,6 +41,7 @@ struct snapraid_option {
|
|||
int force_zero; /**< Forced dangerous operations of synching files now with zero size. */
|
||||
int force_empty; /**< Forced dangerous operations of synching disks now empty. */
|
||||
int force_uuid; /**< Forced dangerous operations of synching disks with uuid changed. */
|
||||
int force_device; /**< Forced dangerous operations of using disks with save device id. */
|
||||
int force_by_name; /**< Forced dangerous operations of synching a rewritten disk. */
|
||||
int expect_unrecoverable; /**< Expect presence of unrecoverable error in checking or fixing. */
|
||||
int expect_recoverable; /**< Expect presence of recoverable error in checking. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue