Use 'data' in the configuration file instead of 'disk'

This commit is contained in:
Andrea Mazzoleni 2016-01-10 21:19:20 +01:00
parent 7cb33cc046
commit 84c089aae4
8 changed files with 102 additions and 84 deletions

View file

@ -11,6 +11,7 @@ SnapRAID HISTORY
You can control the number of blocks to cache with the option
--test-io-cache=NUMBER, where the number is between 3 and 128.
The default is 32.
* In the configuration file 'data' is now a synonymous of 'disk'.
9.2 2016/01
===========
@ -288,7 +289,7 @@ SnapRAID HISTORY
* For files with changes only in some blocks, updates the parity
only for blocks that really are changed.
This improves the performance in sync for modified files.
* Added a new "list" command to see the stored list of files.
* Added a new "list" command to see the stored list of files.
* Removed the detailed list of errors from the screen output.
To get it you must explicitly use the -l, --log option.
It's now too detailed for the screen, because it contains a lot
@ -465,7 +466,7 @@ SnapRAID HISTORY
* Fixed very long paths in Windows. We now always use the special '\\?' prefix
to remove the 260 chars limitation.
* If a file is excluded, it prints explicitly which attribute caused the
exclusion.
exclusion.
* Automatically excludes also the temporary copy of content file,
the one with the ".tmp" extension.
* Avoid Windows to go in automatic sleep mode when running.

2
TODO
View file

@ -13,8 +13,6 @@ It can be very similar at prehash, but checking only REP blocks
that already have a hash.
https://sourceforge.net/p/snapraid/discussion/1677233/thread/6615f0e3/
* Use "data" in the configuration file for "disk".
* smart/up/down working without a configuration file
- Minor

View file

@ -802,7 +802,8 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
content = content_alloc(buffer, dev);
tommy_list_insert_tail(&state->contentlist, &content->node, content);
} else if (strcmp(tag, "disk") == 0) {
} else if (strcmp(tag, "data") == 0 || strcmp(tag, "disk") == 0) {
/* "disk" is the deprecated name up to SnapRAID 9.x */
char dir[PATH_MAX];
char device[PATH_MAX];
char uuid[UUID_MAX];
@ -813,14 +814,14 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
ret = sgettok(f, buffer, sizeof(buffer));
if (ret < 0) {
/* LCOV_EXCL_START */
log_fatal("Invalid 'disk' name specification in '%s' at line %u\n", path, line);
log_fatal("Invalid 'data' name specification in '%s' at line %u\n", path, line);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (!*buffer) {
/* LCOV_EXCL_START */
log_fatal("Empty 'disk' name specification in '%s' at line %u\n", path, line);
log_fatal("Empty 'data' name specification in '%s' at line %u\n", path, line);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -830,14 +831,14 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
ret = sgetlasttok(f, dir, sizeof(dir));
if (ret < 0) {
/* LCOV_EXCL_START */
log_fatal("Invalid 'disk' dir specification in '%s' at line %u\n", path, line);
log_fatal("Invalid 'data' dir specification in '%s' at line %u\n", path, line);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (!*dir) {
/* LCOV_EXCL_START */
log_fatal("Empty 'disk' dir specification in '%s' at line %u\n", path, line);
log_fatal("Empty 'data' dir specification in '%s' at line %u\n", path, line);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -853,7 +854,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
}
if (i) {
/* LCOV_EXCL_START */
log_fatal("Duplicate disk name '%s' at line %u\n", buffer, line);
log_fatal("Duplicate 'data' name '%s' at line %u\n", buffer, line);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -1150,7 +1151,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
log_tag("blocksize:%u\n", state->block_size);
for (i = state->disklist; i != 0; i = i->next) {
struct snapraid_disk* disk = i->data;
log_tag("disk:%s:%s\n", disk->name, disk->dir);
log_tag("data:%s:%s\n", disk->name, disk->dir);
}
log_tag("mode:%s\n", lev_raid_name(state->raid_mode, state->level));
@ -4123,7 +4124,7 @@ void generate_configuration(const char* path)
printf("# and containing: %s\n", file->sub);
}
}
printf("disk %s ENTER_HERE_THE_DIR\n", map->name);
printf("data %s ENTER_HERE_THE_DIR\n", map->name);
printf("\n");
}

View file

@ -214,15 +214,15 @@ content /mnt/disk2/snapraid.content
.PD 0
.PP
.PD
disk d1 /mnt/disk1/
data d1 /mnt/disk1/
.PD 0
.PP
.PD
disk d2 /mnt/disk2/
data d2 /mnt/disk2/
.PD 0
.PP
.PD
disk d3 /mnt/disk3/
data d3 /mnt/disk3/
.PD 0
.PP
.PD
@ -248,15 +248,15 @@ content G:\\array\\snapraid.content
.PD 0
.PP
.PD
disk d1 F:\\array\\
data d1 F:\\array\\
.PD 0
.PP
.PD
disk d2 G:\\array\\
data d2 G:\\array\\
.PD 0
.PP
.PD
disk d3 H:\\array\\
data d3 H:\\array\\
.PD 0
.PP
.PD
@ -452,15 +452,15 @@ For example, operating from a server named \[dq]darkstar\[dq], you can use
the options:
.PP
.RS 4
disk d1 F:\\array\\
data d1 F:\\array\\
.PD 0
.PP
.PD
disk d2 G:\\array\\
data d2 G:\\array\\
.PD 0
.PP
.PD
disk d3 H:\\array\\
data d3 H:\\array\\
.PD 0
.PP
.PD
@ -567,7 +567,7 @@ space to recover the files.
For example, if you have that disk \[dq]d1\[dq] failed, you can change from:
.PP
.RS 4
disk d1 /mnt/disk1/
data d1 /mnt/disk1/
.PD 0
.PP
.PD
@ -576,7 +576,7 @@ disk d1 /mnt/disk1/
to:
.PP
.RS 4
disk d1 /mnt/new_spare_disk/
data d1 /mnt/new_spare_disk/
.PD 0
.PP
.PD
@ -1235,15 +1235,21 @@ more copies of the same files.
.PP
You have to store at least one copy for each parity disk used
plus one. Using some more doesn\'t hurt.
.SS disk NAME DIR
Defines the name and the mount point of the disks of the array.
NAME is used to identify the disk, and it must be unique.
DIR is the mount point of the disk in the file\-system.
.SS data NAME DIR
Defines the name and the mount point of the data disks of
the array. NAME is used to identify the disk, and it must
be unique. DIR is the mount point of the disk in the
file\-system.
.PP
You can change the mount point as you like, as long you
keep the NAME fixed.
.PP
You should use one option for each disk of the array.
You should use one option for each data disk of the array.
.PP
You can rename later a disk, changing the NAME directly
in the configuration file, and then run a \'sync\' command.
In the rename case, the association is done using the stored
UUID of the disks.
.SS nohidden
Excludes all the hidden files and directory.
In Unix hidden files are the ones starting with \[dq].\[dq].
@ -1388,15 +1394,15 @@ content /var/snapraid/snapraid.content
.PD 0
.PP
.PD
disk d1 /mnt/disk1/
data d1 /mnt/disk1/
.PD 0
.PP
.PD
disk d2 /mnt/disk2/
data d2 /mnt/disk2/
.PD 0
.PP
.PD
disk d3 /mnt/disk3/
data d3 /mnt/disk3/
.PD 0
.PP
.PD
@ -1441,15 +1447,15 @@ content C:\\snapraid\\snapraid.content
.PD 0
.PP
.PD
disk d1 G:\\array\\
data d1 G:\\array\\
.PD 0
.PP
.PD
disk d2 H:\\array\\
data d2 H:\\array\\
.PD 0
.PP
.PD
disk d3 I:\\array\\
data d3 I:\\array\\
.PD 0
.PP
.PD

View file

@ -33,9 +33,9 @@ content /mnt/disk2/snapraid.content
# WARNING: Adding here your /home, /var or /tmp disks is NOT a good idea!
# SnapRAID is better suited for files that rarely changes!
# Format: "disk DISK_NAME DISK_MOUNT_POINT"
disk d1 /mnt/disk1/
disk d2 /mnt/disk2/
disk d3 /mnt/disk3/
data d1 /mnt/disk1/
data d2 /mnt/disk2/
data d3 /mnt/disk3/
# Excludes hidden files and directories (uncomment to enable).
#nohidden

View file

@ -33,9 +33,9 @@ content L:\array\snapraid.content
# WARNING: Adding here your boot C:\ disk is NOT a good idea!
# SnapRAID is better suited for files that rarely changes!
# Format: "disk DISK_NAME DISK_MOUNT_POINT"
disk d1 K:\array\
disk d2 L:\array\
disk d3 M:\array\
data d1 K:\array\
data d2 L:\array\
data d3 M:\array\
# Excludes hidden files and directories (uncomment to enable).
#nohidden

View file

@ -125,9 +125,9 @@ Getting Started
:content /var/snapraid/snapraid.content
:content /mnt/disk1/snapraid.content
:content /mnt/disk2/snapraid.content
:disk d1 /mnt/disk1/
:disk d2 /mnt/disk2/
:disk d3 /mnt/disk3/
:data d1 /mnt/disk1/
:data d2 /mnt/disk2/
:data d3 /mnt/disk3/
If you are in Windows, you should use the Windows path format, with drive
letters and backslashes instead of slashes.
@ -136,9 +136,9 @@ Getting Started
:content C:\snapraid\snapraid.content
:content F:\array\snapraid.content
:content G:\array\snapraid.content
:disk d1 F:\array\
:disk d2 G:\array\
:disk d3 H:\array\
:data d1 F:\array\
:data d2 G:\array\
:data d3 H:\array\
If you have many disks, and you run out of drive letters, you can mount
disks directly in sub folders. See:
@ -247,9 +247,9 @@ Getting Started
For example, operating from a server named "darkstar", you can use
the options:
:disk d1 F:\array\
:disk d2 G:\array\
:disk d3 H:\array\
:data d1 F:\array\
:data d2 G:\array\
:data d3 H:\array\
:pool C:\pool
:share \\darkstar
@ -309,11 +309,11 @@ Getting Started
For example, if you have that disk "d1" failed, you can change from:
:disk d1 /mnt/disk1/
:data d1 /mnt/disk1/
to:
:disk d1 /mnt/new_spare_disk/
:data d1 /mnt/new_spare_disk/
STEP 2 -> Fix
Run the fix command, storing the log in an external file with:
@ -953,15 +953,21 @@ Configuration
You have to store at least one copy for each parity disk used
plus one. Using some more doesn't hurt.
disk NAME DIR
Defines the name and the mount point of the disks of the array.
NAME is used to identify the disk, and it must be unique.
DIR is the mount point of the disk in the file-system.
data NAME DIR
Defines the name and the mount point of the data disks of
the array. NAME is used to identify the disk, and it must
be unique. DIR is the mount point of the disk in the
file-system.
You can change the mount point as you like, as long you
keep the NAME fixed.
You should use one option for each disk of the array.
You should use one option for each data disk of the array.
You can rename later a disk, changing the NAME directly
in the configuration file, and then run a 'sync' command.
In the rename case, the association is done using the stored
UUID of the disks.
nohidden
Excludes all the hidden files and directory.
@ -1088,9 +1094,9 @@ Configuration
:parity /mnt/diskp/snapraid.parity
:content /mnt/diskp/snapraid.content
:content /var/snapraid/snapraid.content
:disk d1 /mnt/disk1/
:disk d2 /mnt/disk2/
:disk d3 /mnt/disk3/
:data d1 /mnt/disk1/
:data d2 /mnt/disk2/
:data d3 /mnt/disk3/
:exclude /lost+found/
:exclude /tmp/
:smartctl d1 -d sat %s
@ -1103,9 +1109,9 @@ Configuration
:parity E:\snapraid.parity
:content E:\snapraid.content
:content C:\snapraid\snapraid.content
:disk d1 G:\array\
:disk d2 H:\array\
:disk d3 I:\array\
:data d1 G:\array\
:data d2 H:\array\
:data d3 I:\array\
:exclude Thumbs.db
:exclude \$RECYCLE.BIN
:exclude \System Volume Information

View file

@ -138,9 +138,9 @@ the following options:
content /var/snapraid/snapraid.content
content /mnt/disk1/snapraid.content
content /mnt/disk2/snapraid.content
disk d1 /mnt/disk1/
disk d2 /mnt/disk2/
disk d3 /mnt/disk3/
data d1 /mnt/disk1/
data d2 /mnt/disk2/
data d3 /mnt/disk3/
If you are in Windows, you should use the Windows path format, with drive
letters and backslashes instead of slashes.
@ -149,9 +149,9 @@ letters and backslashes instead of slashes.
content C:\snapraid\snapraid.content
content F:\array\snapraid.content
content G:\array\snapraid.content
disk d1 F:\array\
disk d2 G:\array\
disk d3 H:\array\
data d1 F:\array\
data d2 G:\array\
data d3 H:\array\
If you have many disks, and you run out of drive letters, you can mount
disks directly in sub folders. See:
@ -264,9 +264,9 @@ clients needs to use to access such shared disks.
For example, operating from a server named "darkstar", you can use
the options:
disk d1 F:\array\
disk d2 G:\array\
disk d3 H:\array\
data d1 F:\array\
data d2 G:\array\
data d3 H:\array\
pool C:\pool
share \\darkstar
@ -330,11 +330,11 @@ space to recover the files.
For example, if you have that disk "d1" failed, you can change from:
disk d1 /mnt/disk1/
data d1 /mnt/disk1/
to:
disk d1 /mnt/new_spare_disk/
data d1 /mnt/new_spare_disk/
---- 4.4.2 STEP 2 -> Fix ----
Run the fix command, storing the log in an external file with:
@ -1023,17 +1023,23 @@ more copies of the same files.
You have to store at least one copy for each parity disk used
plus one. Using some more doesn't hurt.
7.5 disk NAME DIR
7.5 data NAME DIR
-----------------
Defines the name and the mount point of the disks of the array.
NAME is used to identify the disk, and it must be unique.
DIR is the mount point of the disk in the file-system.
Defines the name and the mount point of the data disks of
the array. NAME is used to identify the disk, and it must
be unique. DIR is the mount point of the disk in the
file-system.
You can change the mount point as you like, as long you
keep the NAME fixed.
You should use one option for each disk of the array.
You should use one option for each data disk of the array.
You can rename later a disk, changing the NAME directly
in the configuration file, and then run a 'sync' command.
In the rename case, the association is done using the stored
UUID of the disks.
7.6 nohidden
------------
@ -1176,9 +1182,9 @@ An example of a typical configuration for Unix is:
parity /mnt/diskp/snapraid.parity
content /mnt/diskp/snapraid.content
content /var/snapraid/snapraid.content
disk d1 /mnt/disk1/
disk d2 /mnt/disk2/
disk d3 /mnt/disk3/
data d1 /mnt/disk1/
data d2 /mnt/disk2/
data d3 /mnt/disk3/
exclude /lost+found/
exclude /tmp/
smartctl d1 -d sat %s
@ -1191,9 +1197,9 @@ An example of a typical configuration for Windows is:
parity E:\snapraid.parity
content E:\snapraid.content
content C:\snapraid\snapraid.content
disk d1 G:\array\
disk d2 H:\array\
disk d3 I:\array\
data d1 G:\array\
data d2 H:\array\
data d3 I:\array\
exclude Thumbs.db
exclude \$RECYCLE.BIN
exclude \System Volume Information