mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-04 05:40:14 -05:00
More log_tags to make explicit the devices state
This commit is contained in:
parent
352e641e84
commit
30e329d4f3
6 changed files with 302 additions and 72 deletions
|
|
@ -710,7 +710,7 @@ static void windows_errno(DWORD error)
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
log_fatal("Unexpected Windows error %d.\n", (int)error);
|
log_fatal("Unexpected Windows error %lu.\n", error);
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2526,6 +2526,7 @@ retry:
|
||||||
f = _wpopen(cmd, L"rt");
|
f = _wpopen(cmd, L"rt");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (from popen).\n", u16tou8(conv_buf, cmd));
|
log_fatal("Failed to run '%s' (from popen).\n", u16tou8(conv_buf, cmd));
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -2534,6 +2535,7 @@ retry:
|
||||||
if (smartctl_attribute(f, file, name, smart, serial, vendor, model) != 0) {
|
if (smartctl_attribute(f, file, name, smart, serial, vendor, model) != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
pclose(f);
|
pclose(f);
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
@ -2544,6 +2546,7 @@ retry:
|
||||||
|
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (from pclose).\n", u16tou8(conv_buf, cmd));
|
log_fatal("Failed to run '%s' (from pclose).\n", u16tou8(conv_buf, cmd));
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -2612,6 +2615,7 @@ retry:
|
||||||
f = _wpopen(cmd, L"rt");
|
f = _wpopen(cmd, L"rt");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (from popen).\n", u16tou8(conv_buf, cmd));
|
log_fatal("Failed to run '%s' (from popen).\n", u16tou8(conv_buf, cmd));
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -2620,6 +2624,7 @@ retry:
|
||||||
if (smartctl_flush(f, file, name) != 0) {
|
if (smartctl_flush(f, file, name) != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
pclose(f);
|
pclose(f);
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
@ -2630,6 +2635,7 @@ retry:
|
||||||
|
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (from pclose).\n", u16tou8(conv_buf, cmd));
|
log_fatal("Failed to run '%s' (from pclose).\n", u16tou8(conv_buf, cmd));
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -2654,12 +2660,16 @@ retry:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0) {
|
||||||
|
log_tag("device:%s:%s:active\n", file, name);
|
||||||
*power = POWER_ACTIVE;
|
*power = POWER_ACTIVE;
|
||||||
else if (ret == 3)
|
} else if (ret == 3) {
|
||||||
|
log_tag("device:%s:%s:standby\n", file, name);
|
||||||
*power = POWER_STANDBY;
|
*power = POWER_STANDBY;
|
||||||
else
|
} else {
|
||||||
|
log_tag("device:%s:%s:unknown\n", file, name);
|
||||||
*power = POWER_UNKNOWN;
|
*power = POWER_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -2695,6 +2705,7 @@ retry:
|
||||||
f = _wpopen(cmd, L"rt");
|
f = _wpopen(cmd, L"rt");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (from popen).\n", u16tou8(conv_buf, cmd));
|
log_fatal("Failed to run '%s' (from popen).\n", u16tou8(conv_buf, cmd));
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -2703,6 +2714,7 @@ retry:
|
||||||
if (smartctl_flush(f, file, name) != 0) {
|
if (smartctl_flush(f, file, name) != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
pclose(f);
|
pclose(f);
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
@ -2713,6 +2725,7 @@ retry:
|
||||||
|
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (from pclose).\n", u16tou8(conv_buf, cmd));
|
log_fatal("Failed to run '%s' (from pclose).\n", u16tou8(conv_buf, cmd));
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -2739,11 +2752,14 @@ retry:
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:exit:%d\n", file, name, ret);
|
||||||
log_fatal("Failed to run '%s' with return code %xh.\n", u16tou8(conv_buf, cmd), ret);
|
log_fatal("Failed to run '%s' with return code %xh.\n", u16tou8(conv_buf, cmd), ret);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_tag("device:%s:%s:down\n", file, name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2766,7 +2782,7 @@ static int devdownifup(uint64_t device, const char* name, const char* smartctl,
|
||||||
/**
|
/**
|
||||||
* Spin up a device.
|
* Spin up a device.
|
||||||
*/
|
*/
|
||||||
static int devup(const char* wfile)
|
static int devup(uint64_t device, const char* name, const char* wfile)
|
||||||
{
|
{
|
||||||
wchar_t conv_buf[CONV_MAX];
|
wchar_t conv_buf[CONV_MAX];
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
|
|
@ -2774,11 +2790,16 @@ static int devup(const char* wfile)
|
||||||
DISK_GEOMETRY dg;
|
DISK_GEOMETRY dg;
|
||||||
DWORD bytes;
|
DWORD bytes;
|
||||||
void* buffer;
|
void* buffer;
|
||||||
|
char file[128];
|
||||||
|
|
||||||
|
snprintf(file, sizeof(file), "/dev/pd%" PRIu64, device);
|
||||||
|
|
||||||
/* open the volume */
|
/* open the volume */
|
||||||
h = CreateFileW(convert(conv_buf, wfile), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH, 0);
|
h = CreateFileW(convert(conv_buf, wfile), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH, 0);
|
||||||
if (h == INVALID_HANDLE_VALUE) {
|
if (h == INVALID_HANDLE_VALUE) {
|
||||||
windows_errno(GetLastError());
|
DWORD error = GetLastError();
|
||||||
|
windows_errno(error);
|
||||||
|
log_tag("device:%s:%s:error:%lu\n", file, name, error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2788,6 +2809,7 @@ static int devup(const char* wfile)
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
CloseHandle(h);
|
CloseHandle(h);
|
||||||
windows_errno(error);
|
windows_errno(error);
|
||||||
|
log_tag("device:%s:%s:error:%lu\n", file, name, error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2796,6 +2818,7 @@ static int devup(const char* wfile)
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
CloseHandle(h);
|
CloseHandle(h);
|
||||||
windows_errno(error);
|
windows_errno(error);
|
||||||
|
log_tag("device:%s:%s:error:%lu\n", file, name, error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2804,6 +2827,7 @@ static int devup(const char* wfile)
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
CloseHandle(h);
|
CloseHandle(h);
|
||||||
windows_errno(error);
|
windows_errno(error);
|
||||||
|
log_tag("device:%s:%s:error:%lu\n", file, name, error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2811,11 +2835,14 @@ static int devup(const char* wfile)
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
VirtualFree(buffer, 0, MEM_RELEASE);
|
VirtualFree(buffer, 0, MEM_RELEASE);
|
||||||
windows_errno(error);
|
windows_errno(error);
|
||||||
|
log_tag("device:%s:%s:error:%lu\n", file, name, error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
VirtualFree(buffer, 0, MEM_RELEASE);
|
VirtualFree(buffer, 0, MEM_RELEASE);
|
||||||
|
|
||||||
|
log_tag("device:%s:%s:up\n", file, name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2829,7 +2856,7 @@ static void* thread_spinup(void* arg)
|
||||||
|
|
||||||
start = tick_ms();
|
start = tick_ms();
|
||||||
|
|
||||||
if (devup(devinfo->wfile) != 0) {
|
if (devup(devinfo->device, devinfo->name, devinfo->wfile) != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
return (void*)-1;
|
return (void*)-1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
|
||||||
|
|
@ -2717,6 +2717,14 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* log the info read from the content file */
|
||||||
|
log_tag("content_disk:%s:%" PRIu64 ":%" PRIu64 ":%u:%s\n",
|
||||||
|
buffer,
|
||||||
|
v_total_blocks * (uint64_t)state->block_size,
|
||||||
|
v_free_blocks * (uint64_t)state->block_size,
|
||||||
|
v_pos,
|
||||||
|
uuid);
|
||||||
|
|
||||||
/* find the disk */
|
/* find the disk */
|
||||||
disk = find_disk_by_name(state, buffer);
|
disk = find_disk_by_name(state, buffer);
|
||||||
if (!disk) {
|
if (!disk) {
|
||||||
|
|
@ -2814,9 +2822,13 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||||
state->parity[v_level].free_blocks = v_free_blocks;
|
state->parity[v_level].free_blocks = v_free_blocks;
|
||||||
|
|
||||||
/* log the info read from the content file */
|
/* log the info read from the content file */
|
||||||
log_tag("content:%s:0:%s:%s:%" PRIi64 "\n", lev_config_name(v_level),
|
log_tag("content_parity:%s:%" PRIu64 ":%" PRIu64 ":%u:%s:%s:%" PRIi64 "\n",
|
||||||
state->parity[v_level].split_map[0].path,
|
lev_config_name(v_level),
|
||||||
|
v_total_blocks * (uint64_t)state->block_size,
|
||||||
|
v_free_blocks * (uint64_t)state->block_size,
|
||||||
|
0,
|
||||||
state->parity[v_level].split_map[0].uuid,
|
state->parity[v_level].split_map[0].uuid,
|
||||||
|
state->parity[v_level].split_map[0].path,
|
||||||
state->parity[v_level].split_map[0].size);
|
state->parity[v_level].split_map[0].size);
|
||||||
}
|
}
|
||||||
} else if (c == 'Q') {
|
} else if (c == 'Q') {
|
||||||
|
|
@ -2937,9 +2949,13 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||||
state->parity[v_level].split_map[s].size = v_size;
|
state->parity[v_level].split_map[s].size = v_size;
|
||||||
|
|
||||||
/* log the info read from the content file */
|
/* log the info read from the content file */
|
||||||
log_tag("content:%s:%u:%s:%s:%" PRIi64 "\n", lev_config_name(v_level), s,
|
log_tag("content_parity:%s:%" PRIu64 ":%" PRIu64 ":%u:%s:%s:%" PRIi64 "\n",
|
||||||
state->parity[v_level].split_map[s].path,
|
lev_config_name(v_level),
|
||||||
|
v_total_blocks * (uint64_t)state->block_size,
|
||||||
|
v_free_blocks * (uint64_t)state->block_size,
|
||||||
|
s,
|
||||||
state->parity[v_level].split_map[s].uuid,
|
state->parity[v_level].split_map[s].uuid,
|
||||||
|
state->parity[v_level].split_map[s].path,
|
||||||
state->parity[v_level].split_map[s].size);
|
state->parity[v_level].split_map[s].size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1168,6 +1168,7 @@ static int devsmart(dev_t device, const char* name, const char* smartctl, uint64
|
||||||
f = popen(cmd, "r");
|
f = popen(cmd, "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (from popen).\n", cmd);
|
log_fatal("Failed to run '%s' (from popen).\n", cmd);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -1176,6 +1177,7 @@ static int devsmart(dev_t device, const char* name, const char* smartctl, uint64
|
||||||
if (smartctl_attribute(f, file, name, smart, serial, vendor, model) != 0) {
|
if (smartctl_attribute(f, file, name, smart, serial, vendor, model) != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
pclose(f);
|
pclose(f);
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
@ -1186,12 +1188,14 @@ static int devsmart(dev_t device, const char* name, const char* smartctl, uint64
|
||||||
|
|
||||||
if (!WIFEXITED(ret)) {
|
if (!WIFEXITED(ret)) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:error:abort\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (not exited).\n", cmd);
|
log_fatal("Failed to run '%s' (not exited).\n", cmd);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
if (WEXITSTATUS(ret) == 127) {
|
if (WEXITSTATUS(ret) == 127) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (from sh).\n", cmd);
|
log_fatal("Failed to run '%s' (from sh).\n", cmd);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -1236,6 +1240,7 @@ static int devprobe(dev_t device, const char* name, const char* smartctl, int* p
|
||||||
f = popen(cmd, "r");
|
f = popen(cmd, "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (from popen).\n", cmd);
|
log_fatal("Failed to run '%s' (from popen).\n", cmd);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -1244,6 +1249,7 @@ static int devprobe(dev_t device, const char* name, const char* smartctl, int* p
|
||||||
if (smartctl_flush(f, file, name) != 0) {
|
if (smartctl_flush(f, file, name) != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
pclose(f);
|
pclose(f);
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
@ -1254,22 +1260,27 @@ static int devprobe(dev_t device, const char* name, const char* smartctl, int* p
|
||||||
|
|
||||||
if (!WIFEXITED(ret)) {
|
if (!WIFEXITED(ret)) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:abort\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (not exited).\n", cmd);
|
log_fatal("Failed to run '%s' (not exited).\n", cmd);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
if (WEXITSTATUS(ret) == 127) {
|
if (WEXITSTATUS(ret) == 127) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (from sh).\n", cmd);
|
log_fatal("Failed to run '%s' (from sh).\n", cmd);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
if (WEXITSTATUS(ret) == 0) {
|
if (WEXITSTATUS(ret) == 0) {
|
||||||
|
log_tag("device:%s:%s:active\n", file, name);
|
||||||
*power = POWER_ACTIVE;
|
*power = POWER_ACTIVE;
|
||||||
} else if (WEXITSTATUS(ret) == 3) {
|
} else if (WEXITSTATUS(ret) == 3) {
|
||||||
|
log_tag("device:%s:%s:standby\n", file, name);
|
||||||
*power = POWER_STANDBY;
|
*power = POWER_STANDBY;
|
||||||
} else {
|
} else {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:exit:%d\n", file, name, WEXITSTATUS(ret));
|
||||||
log_fatal("Failed to run '%s' with return code %xh.\n", cmd, WEXITSTATUS(ret));
|
log_fatal("Failed to run '%s' with return code %xh.\n", cmd, WEXITSTATUS(ret));
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -1311,6 +1322,7 @@ static int devdown(dev_t device, const char* name, const char* smartctl)
|
||||||
f = popen(cmd, "r");
|
f = popen(cmd, "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (from popen).\n", cmd);
|
log_fatal("Failed to run '%s' (from popen).\n", cmd);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -1319,6 +1331,7 @@ static int devdown(dev_t device, const char* name, const char* smartctl)
|
||||||
if (smartctl_flush(f, file, name) != 0) {
|
if (smartctl_flush(f, file, name) != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
pclose(f);
|
pclose(f);
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
@ -1329,23 +1342,28 @@ static int devdown(dev_t device, const char* name, const char* smartctl)
|
||||||
|
|
||||||
if (!WIFEXITED(ret)) {
|
if (!WIFEXITED(ret)) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:abort\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (not exited).\n", cmd);
|
log_fatal("Failed to run '%s' (not exited).\n", cmd);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
if (WEXITSTATUS(ret) == 127) {
|
if (WEXITSTATUS(ret) == 127) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:shell\n", file, name);
|
||||||
log_fatal("Failed to run '%s' (from sh).\n", cmd);
|
log_fatal("Failed to run '%s' (from sh).\n", cmd);
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
if (WEXITSTATUS(ret) != 0) {
|
if (WEXITSTATUS(ret) != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_tag("device:%s:%s:exit:%d\n", file, name, WEXITSTATUS(ret));
|
||||||
log_fatal("Failed to run '%s' with return code %xh.\n", cmd, WEXITSTATUS(ret));
|
log_fatal("Failed to run '%s' with return code %xh.\n", cmd, WEXITSTATUS(ret));
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_tag("device:%s:%s:down\n", file, name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1372,7 +1390,7 @@ static int devdownifup(dev_t device, const char* name, const char* smartctl, int
|
||||||
* Spin up a specific device.
|
* Spin up a specific device.
|
||||||
*/
|
*/
|
||||||
#if HAVE_LINUX_DEVICE
|
#if HAVE_LINUX_DEVICE
|
||||||
static int devup(dev_t device)
|
static int devup(dev_t device, const char* name)
|
||||||
{
|
{
|
||||||
char file[PATH_MAX];
|
char file[PATH_MAX];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
@ -1398,6 +1416,7 @@ static int devup(dev_t device)
|
||||||
if (f < 0) {
|
if (f < 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
free(buf);
|
free(buf);
|
||||||
|
log_tag("device:%s:%s:error:%d\n", file, name, errno);
|
||||||
log_fatal("Failed to open device '%u:%u'.\n", major(device), minor(device));
|
log_fatal("Failed to open device '%u:%u'.\n", major(device), minor(device));
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -1408,6 +1427,7 @@ static int devup(dev_t device)
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
close(f);
|
close(f);
|
||||||
free(buf);
|
free(buf);
|
||||||
|
log_tag("device:%s:%s:error:%d\n", file, name, errno);
|
||||||
log_fatal("Failed to read device '%u:%u'.\n", major(device), minor(device));
|
log_fatal("Failed to read device '%u:%u'.\n", major(device), minor(device));
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -1417,11 +1437,14 @@ static int devup(dev_t device)
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
free(buf);
|
free(buf);
|
||||||
|
log_tag("device:%s:%s:error:%d\n", file, name, errno);
|
||||||
log_fatal("Failed to close device '%u:%u'.\n", major(device), minor(device));
|
log_fatal("Failed to close device '%u:%u'.\n", major(device), minor(device));
|
||||||
return -1;
|
return -1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_tag("device:%s:%s:up\n", file, name);
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1442,7 +1465,7 @@ static void* thread_spinup(void* arg)
|
||||||
|
|
||||||
start = tick_ms();
|
start = tick_ms();
|
||||||
|
|
||||||
if (devup(devinfo->device) != 0) {
|
if (devup(devinfo->device, devinfo->name) != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
return (void*)-1;
|
return (void*)-1;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ The absolute path to a content file being used (escaped).
|
||||||
Content files store the metadata (like file hashes and timestamps)
|
Content files store the metadata (like file hashes and timestamps)
|
||||||
for the array.
|
for the array.
|
||||||
.TP
|
.TP
|
||||||
.B content:<parity_level>:<split_index>:<path>:<uuid>:<size>
|
.B content_parity:<parity_level>:<size>:<free_size>:<split_index>:<uuid>:<path>:<file_size>
|
||||||
The parity files as stored in the content file.
|
The parity files as stored in the content file.
|
||||||
.RS 4
|
.RS 4
|
||||||
.PD 0
|
.PD 0
|
||||||
|
|
@ -154,23 +154,53 @@ The parity files as stored in the content file.
|
||||||
.I <parity_level>
|
.I <parity_level>
|
||||||
One of \`parity\`, \`2\-parity\`, ..., \`6\-parity\`.
|
One of \`parity\`, \`2\-parity\`, ..., \`6\-parity\`.
|
||||||
.HP 4
|
.HP 4
|
||||||
|
.I <size>
|
||||||
|
The size of the data in the disk.
|
||||||
|
.HP 4
|
||||||
|
.I <free_size>
|
||||||
|
The free size in the disk at the time of the
|
||||||
|
latest \`sync\`.
|
||||||
|
.HP 4
|
||||||
.I <split_index>
|
.I <split_index>
|
||||||
The split index (uint). If no
|
The split index (uint). If no
|
||||||
multiple split parity is configured, there is only the
|
multiple split parity is configured, there is only the
|
||||||
index 0.
|
index 0.
|
||||||
.HP 4
|
.HP 4
|
||||||
|
.I <uuid>
|
||||||
|
The UUID of the disk containing the path.
|
||||||
|
.HP 4
|
||||||
.I <path>
|
.I <path>
|
||||||
The path (escaped).
|
The path (escaped).
|
||||||
.HP 4
|
.HP 4
|
||||||
.I <uuid>
|
.I <file_size>
|
||||||
The UUID of the partition containing the path.
|
|
||||||
.HP 4
|
|
||||||
.I <size>
|
|
||||||
The size of the parity file. Size is \-1 if not yet
|
The size of the parity file. Size is \-1 if not yet
|
||||||
fixed, meaning it can grow. This happens for the
|
fixed, meaning it can grow. This happens for the
|
||||||
latest split.
|
latest split.
|
||||||
.PD
|
.PD
|
||||||
.RE
|
.RE
|
||||||
|
.TP
|
||||||
|
.B content_disk:<disk_name>:<size>:<free_size>:<parity_index>:<uuid>
|
||||||
|
The data disk as stored in the content file.
|
||||||
|
.RS 4
|
||||||
|
.PD 0
|
||||||
|
.HP 4
|
||||||
|
.I <disk_name>
|
||||||
|
Name of the data disk.
|
||||||
|
.HP 4
|
||||||
|
.I <size>
|
||||||
|
The size of the data in the disk.
|
||||||
|
.HP 4
|
||||||
|
.I <free_size>
|
||||||
|
The free size in the disk at the time of the
|
||||||
|
latest \`sync\`.
|
||||||
|
.HP 4
|
||||||
|
.I <parity_index>
|
||||||
|
The disk position in the parity computation.
|
||||||
|
.HP 4
|
||||||
|
.I <uuid>
|
||||||
|
The UUID of the disk filesystem.
|
||||||
|
.PD
|
||||||
|
.RE
|
||||||
.SH DIAGNOSTICS TAGS
|
.SH DIAGNOSTICS TAGS
|
||||||
.TP
|
.TP
|
||||||
.B version:<version>
|
.B version:<version>
|
||||||
|
|
@ -1510,7 +1540,11 @@ The rotation rate (uint64, RPM).
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B attr:<device_file>:<disk_name>:flags:<flags_decimal>:<flags_hex>
|
.B attr:<device_file>:<disk_name>:flags:<flags_decimal>:<flags_hex>
|
||||||
Logs the SMART status flags from the utility (e.g., smartctl).
|
Logs the SMART status flags from the \`smartctl\` utility.
|
||||||
|
Per the smartctl manpage, these flags are bit\-mapped
|
||||||
|
to indicate specific issues like \[dq]Command line did not parse\[dq],
|
||||||
|
\[dq]Device could not be opened\[dq], or \[dq]SMART status check
|
||||||
|
returned \'DISK FAILING\'\[dq].
|
||||||
.RS 4
|
.RS 4
|
||||||
.PD 0
|
.PD 0
|
||||||
.HP 4
|
.HP 4
|
||||||
|
|
@ -1557,30 +1591,68 @@ The probability of at least one disk failure in
|
||||||
.RS 4
|
.RS 4
|
||||||
the next year (double).
|
the next year (double).
|
||||||
.RE
|
.RE
|
||||||
.SH COMMAND PROBE TAGS
|
.SH DEVICE STATUS TAGS
|
||||||
This section describes the tags output with the \`probe\` command.
|
These tags log the lifecycle of hardware interactions and external
|
||||||
.PP
|
command execution. They are primarily output during the \`up\`
|
||||||
Note that a \`<disk_name>\` may be associated with more \`<device_file>\`,
|
(spin\-up), \`down\` (spin\-down), and \`probe\` (power state check)
|
||||||
in case the logical disk uses more physical disks. In such a case,
|
commands.
|
||||||
you\'ll see multiple tags for the same \`<disk_name>\` but with different
|
|
||||||
\`<device_file>\`.
|
|
||||||
.SS Device Power State
|
|
||||||
Tags used to report the power state of each device.
|
|
||||||
.TP
|
.TP
|
||||||
.B probe:<device_file>:<disk_name>:<power_state>
|
.B device:<device_file>:<disk_name>:active
|
||||||
Logs the detected power state of a device.
|
Logs that the device was confirmed to be in an active power
|
||||||
|
state after a status probe.
|
||||||
.RS 4
|
.RS 4
|
||||||
.PD 0
|
.PD 0
|
||||||
.HP 4
|
.HP 4
|
||||||
.I <device_file>
|
.I <device_file>
|
||||||
The file path of the device (e.g., /dev/sdb).
|
The system path to the device node.
|
||||||
.HP 4
|
.HP 4
|
||||||
.I <disk_name>
|
.I <disk_name>
|
||||||
The configured name of the disk.
|
The SnapRAID internal disk disk_name.
|
||||||
|
.PD
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
.B device:<device_file>:<disk_name>:standby
|
||||||
|
Logs that the device was confirmed to be in a standby/spun\-down
|
||||||
|
state.
|
||||||
|
.TP
|
||||||
|
.B device:<device_file>:<disk_name>:up
|
||||||
|
Logs a successful spin\-up operation via direct O_DIRECT
|
||||||
|
read.
|
||||||
|
.TP
|
||||||
|
.B device:<device_file>:<disk_name>:down
|
||||||
|
Logs a successful spin\-down operation initiated via the
|
||||||
|
smartctl command.
|
||||||
|
.TP
|
||||||
|
.B device:<device_file>:<disk_name>:shell
|
||||||
|
Logs a failure in the command shell execution environment.
|
||||||
|
.TP
|
||||||
|
.B device:<device_file>:<disk_name>:error:<errno>
|
||||||
|
Logs a low\-level system error during direct file operations.
|
||||||
|
This is triggered when open(), read(), or close()
|
||||||
|
calls fail during a spin\-up attempt.
|
||||||
|
.RS 4
|
||||||
|
.PD 0
|
||||||
.HP 4
|
.HP 4
|
||||||
.I <power_state>
|
.I <errno>
|
||||||
The numerical power state: 0: Unknown,
|
The standard integer error number provided by
|
||||||
1: StandBy, 2: Active.
|
the OS.
|
||||||
|
.PD
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
.B device:<device_file>:<disk_name>:error:abort
|
||||||
|
Logs that an external process (smartctl) failed to complete
|
||||||
|
normally, such as being terminated by a signal rather than
|
||||||
|
exiting.
|
||||||
|
.TP
|
||||||
|
.B device:<device_file>:<disk_name>:exit:<exit_code>
|
||||||
|
Logs that the external command (smartctl) returned a non\-zero
|
||||||
|
exit code that was not explicitly recognized as a valid state.
|
||||||
|
.RS 4
|
||||||
|
.PD 0
|
||||||
|
.HP 4
|
||||||
|
.I <exit_code>
|
||||||
|
The integer exit status returned by the
|
||||||
|
process.
|
||||||
.PD
|
.PD
|
||||||
.RE
|
.RE
|
||||||
.SH ERROR TAGS
|
.SH ERROR TAGS
|
||||||
|
|
|
||||||
|
|
@ -112,19 +112,32 @@ Configuration Tags
|
||||||
Content files store the metadata (like file hashes and timestamps)
|
Content files store the metadata (like file hashes and timestamps)
|
||||||
for the array.
|
for the array.
|
||||||
|
|
||||||
=content:<parity_level>:<split_index>:<path>:<uuid>:<size>
|
=content_parity:<parity_level>:<size>:<free_size>:<split_index>:<uuid>:<path>:<file_size>
|
||||||
The parity files as stored in the content file.
|
The parity files as stored in the content file.
|
||||||
|
|
||||||
<parity_level> - One of `parity`, `2-parity`, ..., `6-parity`.
|
<parity_level> - One of `parity`, `2-parity`, ..., `6-parity`.
|
||||||
|
<size> - The size of the data in the disk.
|
||||||
|
<free_size> - The free size in the disk at the time of the
|
||||||
|
latest `sync`.
|
||||||
<split_index> - The split index (uint). If no
|
<split_index> - The split index (uint). If no
|
||||||
multiple split parity is configured, there is only the
|
multiple split parity is configured, there is only the
|
||||||
index 0.
|
index 0.
|
||||||
|
<uuid> - The UUID of the disk containing the path.
|
||||||
<path> - The path (escaped).
|
<path> - The path (escaped).
|
||||||
<uuid> - The UUID of the partition containing the path.
|
<file_size> - The size of the parity file. Size is -1 if not yet
|
||||||
<size> - The size of the parity file. Size is -1 if not yet
|
|
||||||
fixed, meaning it can grow. This happens for the
|
fixed, meaning it can grow. This happens for the
|
||||||
latest split.
|
latest split.
|
||||||
|
|
||||||
|
=content_disk:<disk_name>:<size>:<free_size>:<parity_index>:<uuid>
|
||||||
|
The data disk as stored in the content file.
|
||||||
|
|
||||||
|
<disk_name> - Name of the data disk.
|
||||||
|
<size> - The size of the data in the disk.
|
||||||
|
<free_size> - The free size in the disk at the time of the
|
||||||
|
latest `sync`.
|
||||||
|
<parity_index> - The disk position in the parity computation.
|
||||||
|
<uuid> - The UUID of the disk filesystem.
|
||||||
|
|
||||||
Diagnostics Tags
|
Diagnostics Tags
|
||||||
=version:<version>
|
=version:<version>
|
||||||
The version of SnapRAID run.
|
The version of SnapRAID run.
|
||||||
|
|
@ -961,7 +974,11 @@ Command Smart Tags
|
||||||
<rate> - The rotation rate (uint64, RPM).
|
<rate> - The rotation rate (uint64, RPM).
|
||||||
|
|
||||||
=attr:<device_file>:<disk_name>:flags:<flags_decimal>:<flags_hex>
|
=attr:<device_file>:<disk_name>:flags:<flags_decimal>:<flags_hex>
|
||||||
Logs the SMART status flags from the utility (e.g., smartctl).
|
Logs the SMART status flags from the `smartctl` utility.
|
||||||
|
Per the smartctl manpage, these flags are bit-mapped
|
||||||
|
to indicate specific issues like "Command line did not parse",
|
||||||
|
"Device could not be opened", or "SMART status check
|
||||||
|
returned 'DISK FAILING'".
|
||||||
|
|
||||||
<flags_decimal> - The raw flags value (uint64, decimal).
|
<flags_decimal> - The raw flags value (uint64, decimal).
|
||||||
<flags_hex> - The raw flags value (uint64, hexadecimal).
|
<flags_hex> - The raw flags value (uint64, hexadecimal).
|
||||||
|
|
@ -985,24 +1002,53 @@ Command Smart Tags
|
||||||
<array_prob> - The probability of at least one disk failure in
|
<array_prob> - The probability of at least one disk failure in
|
||||||
the next year (double).
|
the next year (double).
|
||||||
|
|
||||||
Command Probe Tags
|
Device Status Tags
|
||||||
This section describes the tags output with the `probe` command.
|
These tags log the lifecycle of hardware interactions and external
|
||||||
|
command execution. They are primarily output during the `up`
|
||||||
|
(spin-up), `down` (spin-down), and `probe` (power state check)
|
||||||
|
commands.
|
||||||
|
|
||||||
Note that a `<disk_name>` may be associated with more `<device_file>`,
|
=device:<device_file>:<disk_name>:active
|
||||||
in case the logical disk uses more physical disks. In such a case,
|
Logs that the device was confirmed to be in an active power
|
||||||
you'll see multiple tags for the same `<disk_name>` but with different
|
state after a status probe.
|
||||||
`<device_file>`.
|
|
||||||
|
|
||||||
Device Power State
|
<device_file> - The system path to the device node.
|
||||||
Tags used to report the power state of each device.
|
<disk_name> - The SnapRAID internal disk disk_name.
|
||||||
|
|
||||||
=probe:<device_file>:<disk_name>:<power_state>
|
=device:<device_file>:<disk_name>:standby
|
||||||
Logs the detected power state of a device.
|
Logs that the device was confirmed to be in a standby/spun-down
|
||||||
|
state.
|
||||||
|
|
||||||
<device_file> - The file path of the device (e.g., /dev/sdb).
|
=device:<device_file>:<disk_name>:up
|
||||||
<disk_name> - The configured name of the disk.
|
Logs a successful spin-up operation via direct O_DIRECT
|
||||||
<power_state> - The numerical power state: 0: Unknown,
|
read.
|
||||||
1: StandBy, 2: Active.
|
|
||||||
|
=device:<device_file>:<disk_name>:down
|
||||||
|
Logs a successful spin-down operation initiated via the
|
||||||
|
smartctl command.
|
||||||
|
|
||||||
|
=device:<device_file>:<disk_name>:shell
|
||||||
|
Logs a failure in the command shell execution environment.
|
||||||
|
|
||||||
|
=device:<device_file>:<disk_name>:error:<errno>
|
||||||
|
Logs a low-level system error during direct file operations.
|
||||||
|
This is triggered when open(), read(), or close()
|
||||||
|
calls fail during a spin-up attempt.
|
||||||
|
|
||||||
|
<errno> - The standard integer error number provided by
|
||||||
|
the OS.
|
||||||
|
|
||||||
|
=device:<device_file>:<disk_name>:error:abort
|
||||||
|
Logs that an external process (smartctl) failed to complete
|
||||||
|
normally, such as being terminated by a signal rather than
|
||||||
|
exiting.
|
||||||
|
|
||||||
|
=device:<device_file>:<disk_name>:exit:<exit_code>
|
||||||
|
Logs that the external command (smartctl) returned a non-zero
|
||||||
|
exit code that was not explicitly recognized as a valid state.
|
||||||
|
|
||||||
|
<exit_code> - The integer exit status returned by the
|
||||||
|
process.
|
||||||
|
|
||||||
Error Tags
|
Error Tags
|
||||||
These tags report specific errors that occur on data disks during the
|
These tags report specific errors that occur on data disks during the
|
||||||
|
|
|
||||||
|
|
@ -118,19 +118,32 @@ scanning the disk and reading the list of files.
|
||||||
Content files store the metadata (like file hashes and timestamps)
|
Content files store the metadata (like file hashes and timestamps)
|
||||||
for the array.
|
for the array.
|
||||||
|
|
||||||
content:<parity_level>:<split_index>:<path>:<uuid>:<size>
|
content_parity:<parity_level>:<size>:<free_size>:<split_index>:<uuid>:<path>:<file_size>
|
||||||
The parity files as stored in the content file.
|
The parity files as stored in the content file.
|
||||||
|
|
||||||
<parity_level> - One of `parity`, `2-parity`, ..., `6-parity`.
|
<parity_level> - One of `parity`, `2-parity`, ..., `6-parity`.
|
||||||
|
<size> - The size of the data in the disk.
|
||||||
|
<free_size> - The free size in the disk at the time of the
|
||||||
|
latest `sync`.
|
||||||
<split_index> - The split index (uint). If no
|
<split_index> - The split index (uint). If no
|
||||||
multiple split parity is configured, there is only the
|
multiple split parity is configured, there is only the
|
||||||
index 0.
|
index 0.
|
||||||
|
<uuid> - The UUID of the disk containing the path.
|
||||||
<path> - The path (escaped).
|
<path> - The path (escaped).
|
||||||
<uuid> - The UUID of the partition containing the path.
|
<file_size> - The size of the parity file. Size is -1 if not yet
|
||||||
<size> - The size of the parity file. Size is -1 if not yet
|
|
||||||
fixed, meaning it can grow. This happens for the
|
fixed, meaning it can grow. This happens for the
|
||||||
latest split.
|
latest split.
|
||||||
|
|
||||||
|
content_disk:<disk_name>:<size>:<free_size>:<parity_index>:<uuid>
|
||||||
|
The data disk as stored in the content file.
|
||||||
|
|
||||||
|
<disk_name> - Name of the data disk.
|
||||||
|
<size> - The size of the data in the disk.
|
||||||
|
<free_size> - The free size in the disk at the time of the
|
||||||
|
latest `sync`.
|
||||||
|
<parity_index> - The disk position in the parity computation.
|
||||||
|
<uuid> - The UUID of the disk filesystem.
|
||||||
|
|
||||||
|
|
||||||
3 DIAGNOSTICS TAGS
|
3 DIAGNOSTICS TAGS
|
||||||
==================
|
==================
|
||||||
|
|
@ -1003,7 +1016,11 @@ values.
|
||||||
<rate> - The rotation rate (uint64, RPM).
|
<rate> - The rotation rate (uint64, RPM).
|
||||||
|
|
||||||
attr:<device_file>:<disk_name>:flags:<flags_decimal>:<flags_hex>
|
attr:<device_file>:<disk_name>:flags:<flags_decimal>:<flags_hex>
|
||||||
Logs the SMART status flags from the utility (e.g., smartctl).
|
Logs the SMART status flags from the `smartctl` utility.
|
||||||
|
Per the smartctl manpage, these flags are bit-mapped
|
||||||
|
to indicate specific issues like "Command line did not parse",
|
||||||
|
"Device could not be opened", or "SMART status check
|
||||||
|
returned 'DISK FAILING'".
|
||||||
|
|
||||||
<flags_decimal> - The raw flags value (uint64, decimal).
|
<flags_decimal> - The raw flags value (uint64, decimal).
|
||||||
<flags_hex> - The raw flags value (uint64, hexadecimal).
|
<flags_hex> - The raw flags value (uint64, hexadecimal).
|
||||||
|
|
@ -1028,26 +1045,55 @@ Tags logging the overall failure probabilities for the array.
|
||||||
the next year (double).
|
the next year (double).
|
||||||
|
|
||||||
|
|
||||||
15 COMMAND PROBE TAGS
|
15 DEVICE STATUS TAGS
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
This section describes the tags output with the `probe` command.
|
These tags log the lifecycle of hardware interactions and external
|
||||||
|
command execution. They are primarily output during the `up`
|
||||||
|
(spin-up), `down` (spin-down), and `probe` (power state check)
|
||||||
|
commands.
|
||||||
|
|
||||||
Note that a `<disk_name>` may be associated with more `<device_file>`,
|
device:<device_file>:<disk_name>:active
|
||||||
in case the logical disk uses more physical disks. In such a case,
|
Logs that the device was confirmed to be in an active power
|
||||||
you'll see multiple tags for the same `<disk_name>` but with different
|
state after a status probe.
|
||||||
`<device_file>`.
|
|
||||||
|
|
||||||
---- 15.0.1 Device Power State ----
|
<device_file> - The system path to the device node.
|
||||||
Tags used to report the power state of each device.
|
<disk_name> - The SnapRAID internal disk disk_name.
|
||||||
|
|
||||||
probe:<device_file>:<disk_name>:<power_state>
|
device:<device_file>:<disk_name>:standby
|
||||||
Logs the detected power state of a device.
|
Logs that the device was confirmed to be in a standby/spun-down
|
||||||
|
state.
|
||||||
|
|
||||||
<device_file> - The file path of the device (e.g., /dev/sdb).
|
device:<device_file>:<disk_name>:up
|
||||||
<disk_name> - The configured name of the disk.
|
Logs a successful spin-up operation via direct O_DIRECT
|
||||||
<power_state> - The numerical power state: 0: Unknown,
|
read.
|
||||||
1: StandBy, 2: Active.
|
|
||||||
|
device:<device_file>:<disk_name>:down
|
||||||
|
Logs a successful spin-down operation initiated via the
|
||||||
|
smartctl command.
|
||||||
|
|
||||||
|
device:<device_file>:<disk_name>:shell
|
||||||
|
Logs a failure in the command shell execution environment.
|
||||||
|
|
||||||
|
device:<device_file>:<disk_name>:error:<errno>
|
||||||
|
Logs a low-level system error during direct file operations.
|
||||||
|
This is triggered when open(), read(), or close()
|
||||||
|
calls fail during a spin-up attempt.
|
||||||
|
|
||||||
|
<errno> - The standard integer error number provided by
|
||||||
|
the OS.
|
||||||
|
|
||||||
|
device:<device_file>:<disk_name>:error:abort
|
||||||
|
Logs that an external process (smartctl) failed to complete
|
||||||
|
normally, such as being terminated by a signal rather than
|
||||||
|
exiting.
|
||||||
|
|
||||||
|
device:<device_file>:<disk_name>:exit:<exit_code>
|
||||||
|
Logs that the external command (smartctl) returned a non-zero
|
||||||
|
exit code that was not explicitly recognized as a valid state.
|
||||||
|
|
||||||
|
<exit_code> - The integer exit status returned by the
|
||||||
|
process.
|
||||||
|
|
||||||
|
|
||||||
16 ERROR TAGS
|
16 ERROR TAGS
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue