mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-03 21:30:14 -05:00
Adds a check to prevent to zeroing a file as typical ext4 behaviour after a crash.
Changes the default block size from 128 to 256 kB. Write the block size in the state file to prevent a mismatch value from the configuration.
This commit is contained in:
parent
b9b8fd0bb8
commit
1720854353
6 changed files with 99 additions and 71 deletions
10
scan.c
10
scan.c
|
|
@ -108,6 +108,14 @@ static void scan_file(struct snapraid_scan* scan, struct snapraid_state* state,
|
|||
file->is_present = 1;
|
||||
return;
|
||||
} else {
|
||||
/* do a safety check to ensure that the common ext4 case of zeroing */
|
||||
/* the size of a file after a crash doesn't propagate to the backup */
|
||||
if (file->size != 0 && st->st_size == 0) {
|
||||
fprintf(stderr, "The file '%s' in disk '%s' at dir '%s' has zero size!\n", sub, disk->name, disk->dir);
|
||||
fprintf(stderr, "If it's really what you want to do, use 'snapraid --force sync\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* remove and reinsert it */
|
||||
++scan->count_change;
|
||||
--scan->count_insert;
|
||||
|
|
@ -241,7 +249,7 @@ void state_scan(struct snapraid_state* state)
|
|||
if (scan[i].count_equal == 0 && scan[i].count_remove != 0) {
|
||||
if (!state->force) {
|
||||
fprintf(stderr, "All the file in disk '%s' at dir '%s' are missing!\n", disk->name, disk->dir);
|
||||
fprintf(stderr, "If it's really what you want to do, use 'snapraid -f sync\n");
|
||||
fprintf(stderr, "If it's really what you want to do, use 'snapraid --force sync\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue