Compare commits

..

No commits in common. "master" and "v15.0" have entirely different histories.

9 changed files with 29 additions and 155 deletions

View file

@ -20,7 +20,7 @@ jobs:
- run: make all -j$(sysctl -n hw.ncpu)
- run: make dist check
build-linux:
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: |
@ -90,12 +90,12 @@ jobs:
with:
usesh: true
prepare: |
pkg install -y autoconf automake
pkg install -y autoconf automake gmake
run: |
autoreconf -i
./configure --enable-warning-as-error
make all -j$(sysctl -n hw.ncpu)
make dist check
./configure --enable-warning-as-error MAKE=gmake
gmake all -j$(sysctl -n hw.ncpu)
gmake dist check
build-musl:
runs-on: ubuntu-latest
container: alpine:latest

View file

@ -221,18 +221,12 @@ e11c452e2adec376e6fcaee9ff2ec4de4e943c35690229c9c67056c5eaed52a1 snapraid-14.9-
6e8892175bfe240ae7828d513342180a249511a2d5baf8c003ae8b2bb82e0f46 snapraid-14.10-windows-x64.zip
1ec0572359fb31f2827702d792db0bdf6a95161eb9e2a6deff2bdc7e1f5b794b snapraid-14.10-windows-x86.zip
6930d629c73b5307ec32277310ed13887b1bd051e30dc41c75b4752040032d1c snapraid-14.10-x86_64-1_am.txz
ceba44e15566386d923d6895ecab81f7437848b03a4cf9585c02d3636197ce19 snapraid-15.0.tar.gz
9d55d0308ce41beb29956b59f9d2e32d419c930118266d3e08b15f658119f4fb snapraid-15.0-1-x86_64.pkg.tar.zst
ad66c0b4c016775c9a759adf2a5202bebb357d319b0063b9cf68befde9a67363 snapraid-15.0-1.x86_64.rpm
704706c21b432719c4da8cd237c1f26327af89c86604dc339a38d63574004a22 snapraid-15.0-windows-x64.zip
58b3ed90307e41b7a6e862d2dc070204c98b5c3ac24718e2fb9fe03e275bc2ce snapraid-15.0-windows-x86.zip
9483df5a39a8b59c32433331ac92a4eef54dcff4722694a5bc5e89bcefb6b3b0 snapraid-15.0-x86_64-1_am.txz
fb2d6a9cf9c8ea30c6962f4a48764dc9012fe61d6e23f40a8d959dadea02278b snapraid-15.1.tar.gz
5e627e08caa8d7647fd40e5288b8d59846d1f3d65d586bae74a57cd99a23f497 snapraid-15.1-1-x86_64.pkg.tar.zst
8922234dd566c876b17cbaadad6a22690d05240250455e504513906d933e16dd snapraid-15.1-1.x86_64.rpm
64849f463986d0d80b948dbb07e9af6402bed230a9cf17dbd1110199aca56486 snapraid-15.1-windows-x64.zip
f7be230f7849d89941a280dc8c2cc6e158844e0fe6f00adbb6aa9ac0f65322b8 snapraid-15.1-windows-x86.zip
4dbd01ab2582a74fab4d7ee8f9b11966d4188fba9eedcd31fcc0a5588cd0c702 snapraid-15.1-x86_64-1_am.txz
1e15cc11b26b02fbb54a679c0379161bf3c94aadfaf29081d876990d809a43f9 snapraid-15.0rc2.tar.gz
a546944800a5001c3960715b97ba73cae219c854da1bb55dca16ce70fe06c6d6 snapraid-15.0rc2-1-x86_64.pkg.tar.zst
1327c122a66f91e7780e77431a318907661e690a4aca7fa78f9d504e8dde9e06 snapraid-15.0rc2-1.x86_64.rpm
092d1e91915e7644288805d1a91bd6f20ee0591d70157f5bb5980e26eaf82c1a snapraid-15.0rc2-windows-x64.zip
2c010c4ea69f39d28f266d978d78e0b2c3a845ab47f847cb5a305fc242994691 snapraid-15.0rc2-windows-x86.zip
7ada0dd95bad90895c3faaf627f99da02a4e31ac948d05f012efd2ab05a37d97 snapraid-15.0rc2-x86_64-1_am.txz
128b5b0f80a6a0911e77ed3b5d9d81529f5ea1d8fffbb5112e3af3467d80464a snapraid_14.0-1_amd64.deb
b9c41ae2e8edbc413abd3172b7ed2da2cba7fa0e631d0f47fc1dafccf7c6e92c snapraid_14.1-1_amd64.deb
e6456b926bb053d34645e31e5e3d8363e952c9869e873eb348abb1149598d331 snapraid_14.2-1_amd64.deb
@ -244,5 +238,4 @@ b71b556da4be6263a904fb8ac489933875467adbb920dd3911e54d87e9637ca3 snapraid_14.6-
c0e00a25b9bce40ff74f5a55401c3bfedac1881fd99aaa90a692f5858d417f7d snapraid_14.8-1_amd64.deb
09064689a64d965ac33ee89fb8b2cc14dfec0745f2b3b86a78f377fc353b7e07 snapraid_14.9-1_amd64.deb
15f5fd9f639912c94daae9d75d3567b7a3fc0e18475880f972acd8d8e9e0992c snapraid_14.10-1_amd64.deb
845091e7eeb2495fc3899dc6e8fab2c3fe7a5945f345c767a7603dab90e2cb84 snapraid_15.0-1_amd64.deb
974cd45fc8f44d5642b49bd9b30e81aca2bcd7689877f9fa73d1e58d3f1b5bda snapraid_15.1-1_amd64.deb
fc875789267ec9b057d14780f04362cc32b3cb4191e707d6e0390f05ff346d46 snapraid_15.0rc2-1_amd64.deb

19
HISTORY
View file

@ -1,23 +1,8 @@
SnapRAID HISTORY
================
15.1 2026/10
============
* Add synthetic device IDs on Linux, allowing SnapRAID Daemon to
preserve history for devices without unique hardware IDs while
they remain connected within the same boot.
* Fix a failed internal inconsistency check when '--gui-touch-before'
is used before the first sync when no content file exists yet.
Also ensure that commands that can save the content file ('touch',
'scrub', 'rehash', 'rewrite') fail with a clear error message if the
array has not been synced yet. This fix is required by
SnapRAID-Daemon.
* Make test and doc variables in Makefile.am compatible with BSD make,
allowing builds, tests, and documentation generation on BSD systems
without requiring GNU make.
15.0 2026/10
============
15.0 (Work in Progress)
=======================
* Added support for automated filesystem snapshots to ensure data
consistency and improve recovery reliability.
When the 'snapshot' option is enabled, SnapRAID transparently manages

View file

@ -228,28 +228,13 @@ dist-hook:
LANG_CODES = de es fr it ja ko pl pt ro ru sv uk zh
LIST_LANG_D = \
doc/snapraid-de.d \
doc/snapraid-es.d \
doc/snapraid-fr.d \
doc/snapraid-it.d \
doc/snapraid-ja.d \
doc/snapraid-ko.d \
doc/snapraid-pl.d \
doc/snapraid-pt.d \
doc/snapraid-ro.d \
doc/snapraid-ru.d \
doc/snapraid-sv.d \
doc/snapraid-uk.d \
doc/snapraid-zh.d
LIST_D = doc/snapraid.d doc/snapraid_log.d $(patsubst %, doc/snapraid-%.d, $(LANG_CODES))
LIST_D = doc/snapraid.d doc/snapraid_log.d $(LIST_LANG_D)
LIST_MAN = doc/snapraid.1 doc/snapraid_log.1 $(patsubst %, doc/snapraid-%.1, $(LANG_CODES))
LIST_MAN = $(LIST_D:.d=.1)
LIST_TXT = doc/snapraid.txt doc/snapraid_log.txt $(patsubst %, doc/snapraid-%.txt, $(LANG_CODES))
LIST_TXT = $(LIST_D:.d=.txt)
LIST_XML = $(LIST_D:.d=.xml)
LIST_XML = doc/snapraid.xml doc/snapraid_log.xml $(patsubst %, doc/snapraid-%.xml, $(LANG_CODES))
EXTRA_DIST = \
autogen.sh autover.sh valgrind.supp \
@ -400,13 +385,8 @@ else # HAVE_POSIX
CHECKCOUNT_DEFAULT = 500
endif # HAVE_POSIX
CHECKCOUNT_0 = $(CHECKCOUNT_DEFAULT)
CHECKCOUNT_1 = 500
CHECKCOUNT = $(CHECKCOUNT_$(SHORTCHECK))
CHECKSIZE_0 = 4000
CHECKSIZE_1 = 100
CHECKSIZE = $(CHECKSIZE_$(SHORTCHECK))
CHECKCOUNT = $(if $(filter 1,$(SHORTCHECK)),500,$(CHECKCOUNT_DEFAULT))
CHECKSIZE = $(if $(filter 1,$(SHORTCHECK)),100,4000)
CONF = $(srcdir)/test/test-par6.conf
THERMAL = $(srcdir)/test/test-par6-thermal.conf

10
TODO
View file

@ -6,23 +6,19 @@ This is the list of TODO items for SnapRAID.
16.x Releases
=============
* Support a `[power_control: off]` tag in `smartctl` options to disable power
management (`up` and `down`) on specific disks (e.g. for SAS drives that
fail to wake up on write). Emit an attribute tag in probe for snapraid-daemon.
* Enable MuseAir and disable random seed
* Use statx() instead of lstat() when scanning directories.
* Add a new 'restore' command, similar to 'fix', that recovers a whole disk
using the same multithreaded approach as sync/scrub.
* Use statx() instead of lstat() when scanning directories.
* Integration with MergerFS ?
* Restore ownership and permissions, at least in Unix.
* Restore directory timestamps.
* Enable MuseAir and disable random seed
* Check Reliability Test. We can derive Failure probability from MBTF
https://github.com/linuxhw/SMART
https://github.com/linuxhw/EnterpriseDrive

View file

@ -1530,8 +1530,7 @@ int snapraid_main(int argc, char* argv[])
if (state.opt.force_realloc)
state_locate_mark_tail_blocks_for_resync(&state, opt.parity_tail);
/* skip touch itself until content is loaded and sync has initialized parity sizes */
if (opt.gui_touch_before && state_is_write_ready(&state)) {
if (opt.gui_touch_before) {
ret = state_touch(&state);
/* save the new state if required */
@ -1628,9 +1627,6 @@ int snapraid_main(int argc, char* argv[])
} else if (operation == OPERATION_REHASH) {
state_read(&state);
/* prevent saving content with uninitialized parity split sizes */
state_require_write_ready(&state);
state_rehash(&state);
/*
@ -1649,9 +1645,6 @@ int snapraid_main(int argc, char* argv[])
} else if (operation == OPERATION_SCRUB) {
state_read(&state);
/* prevent saving content with uninitialized parity split sizes */
state_require_write_ready(&state);
/* refresh the size info before the content write */
state_refresh(&state);
@ -1674,9 +1667,6 @@ int snapraid_main(int argc, char* argv[])
} else if (operation == OPERATION_REWRITE) {
state_read(&state);
/* prevent saving content with uninitialized parity split sizes */
state_require_write_ready(&state);
/* intercept signals while operating */
os_signal_init(app_signal_handler, app_signal_handler);
@ -1692,9 +1682,6 @@ int snapraid_main(int argc, char* argv[])
} else if (operation == OPERATION_TOUCH) {
state_read(&state);
/* prevent saving content with uninitialized parity split sizes */
state_require_write_ready(&state);
memory();
ret = state_touch(&state);
@ -1709,7 +1696,6 @@ int snapraid_main(int argc, char* argv[])
*/
os_signal_init(app_signal_handler, app_signal_handler);
/* save the new state if required */
if (state.need_write)
state_write(&state);
} else if (operation == OPERATION_SPINUP) {

View file

@ -171,6 +171,7 @@ void state_init(struct snapraid_state* state)
state->autosave = 0;
state->need_write = 0;
state->written = 0;
state->checked_read = 0;
state->block_size = 256 * KIBI; /* default 256 KiB */
state->raid_mode = RAID_MODE_CAUCHY_RAID;
state->file_mode = ADVISE_DEFAULT;
@ -5422,37 +5423,9 @@ void state_read(struct snapraid_state* state)
log_tag("content_info:read_unixtime:%" PRId64 "\n", (int64_t)st.st_mtime);
}
log_flush();
}
/**
* Check if all configured parity splits have persistent sizes.
*/
int state_is_write_ready(struct snapraid_state* state)
{
unsigned l, s;
for (l = 0; l < state->level; ++l) {
for (s = 0; s < state->parity[l].split_mac; ++s) {
if (state->parity[l].split_map[s].size == PARITY_SIZE_INVALID)
return 0;
}
}
return 1;
}
/**
* Require sync to initialize parity sizes before commands that can save content.
* Check before modifying timestamps or metadata, as a later write could fail
* even if the command has no blocks to process (e.g. a missing content replica).
*/
void state_require_write_ready(struct snapraid_state* state)
{
if (!state_is_write_ready(state)) {
log_fatal(EUSER, "The array has not been synced yet, or its parity configuration has changed.\n");
log_fatal(EUSER, "Run 'snapraid sync' before '%s'.\n", state->command);
exit(EXIT_FAILURE);
}
/* mark that we read the content file, and it passed all the checks */
state->checked_read = 1;
}
struct state_verify_thread_context {
@ -5963,6 +5936,7 @@ void state_write(struct snapraid_state* state)
log_flush();
state->need_write = 0; /* no write needed anymore */
state->checked_read = 0; /* what we wrote is not checked in read */
state->written = 1;
}

View file

@ -130,6 +130,7 @@ struct snapraid_state {
uint64_t autosave; /**< Autosave after the specified amount of data. 0 to disable. */
int need_write; /**< If the state is changed. */
int written; /**< If the state was written at least one time */
int checked_read; /**< If the state was read and checked. */
uint32_t block_size; /**< Block size in bytes. */
unsigned raid_mode; /**< Raid mode to use. RAID_MODE_DEFAULT or RAID_MODE_ALTERNATE. */
int file_mode; /**< File access mode. Combination of ADVISE_* flags. */
@ -239,16 +240,6 @@ void state_probe(struct snapraid_state* state);
*/
void state_read(struct snapraid_state* state);
/**
* Check if all configured parity splits have persistent sizes.
*/
int state_is_write_ready(struct snapraid_state* state);
/**
* Require initialized parity split sizes before commands that can save content.
*/
void state_require_write_ready(struct snapraid_state* state);
/**
* Count the number of unsynced parity positions using an event sweep across extents.
* Counts positions in [blockmin, blockmax). The caller must ensure that the disk list,

View file

@ -4447,7 +4447,6 @@ int devmap(void)
{
#if HAVE_LINUX_DEVICE
char path[PATH_MAX];
char boot_id[64];
DIR* d = opendir("/sys/block");
if (!d) {
/* LCOV_EXCL_START */
@ -4455,22 +4454,6 @@ int devmap(void)
/* LCOV_EXCL_STOP */
}
/* optional boot identity: failure must not affect hardware mappings */
if (sysattr("/proc/sys/kernel/random/boot_id", boot_id, sizeof(boot_id)) != 0 || strlen(boot_id) != 36) {
boot_id[0] = 0;
} else {
for (unsigned i = 0; i < 36; ++i) {
if (i == 8 || i == 13 || i == 18 || i == 23) {
if (boot_id[i] == '-')
continue;
} else if (hexval(boot_id[i]) >= 0) {
continue;
}
boot_id[0] = 0;
break;
}
}
struct dirent* dd;
while (1) {
char buf[256];
@ -4534,20 +4517,6 @@ int devmap(void)
if (sysattr(path, buf, sizeof(buf)) == 0 && buf[0] != 0) {
log_tag("map:/dev/%s:%s\n", dd->d_name, esc_tag(buf));
}
/*
* This identifies the kernel device instance within one boot, not
* persistent hardware across reconnections. Missing attributes are optional.
*/
if (boot_id[0] != 0) {
pathprint(path, sizeof(path), "/sys/block/%s/diskseq", dd->d_name);
if (sysattr(path, buf, sizeof(buf)) == 0) {
char* end;
unsigned long long diskseq = strtonll(buf, &end, 10);
if (buf[0] >= '0' && buf[0] <= '9' && diskseq != 0 && end != buf && *end == 0)
log_tag("map:/dev/%s:linux-diskseq.%s.%llu\n", esc_tag(dd->d_name), esc_tag(boot_id), diskseq);
}
}
}
closedir(d);