Jump to content
Covecube Inc.
  • 0

Any way to check if the pool state is OK via CLI?


I'm planning to run a scheduled rclone sync script to the cloud of my pool, but it's critical that it doesn't run if files are missing due to a missing drive, because it will match the destination to the source - effectively deleting files from the cloud. I don't wanna use copy instead of sync, as that will recover files I don't want to recover when I run the opposite copy script for disaster recovery in the future, creating an unwanted mess.

So, I was wondering if there's any CLI tool I can use to check if the pool is OK (no missing drives), so I can use it as a basis for running the script. 

Or rather, towards the scanner. Halting the execution if there are any health warnings going on.

Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Ended up writing a batch script for now. Just needs a copy of smartctl.exe in the same directory, and a sync or script command to be run respectively of the result. 

Checks the number of drives found as well as overall health. Writes a couple of log files based on last run.
Commented in norwegian, but easy enough to understand and adapt to whatever if anyone wants something similar.

@echo off
chcp 65001 >nul 2>&1

cd %~dp0
set smartdataloggfil=SMART_DATA.LOG
set sistestatusloggfil=SISTE_STATUS.LOG
set antalldisker=2

echo Sjekker generell smart helse for alle tilkoblede disker.

:: Slett gammel smart logg hvis den finnes.
del %smartdataloggfil% > nul 2>&1
del %sistestatusloggfil% > nul 2>&1

:: Generer oppdatert smartdata loggfil.
for /f "tokens=1" %%A in ('smartctl.exe --scan') do (smartctl.exe -H %%A | findstr "test result" >> %smartdataloggfil%)

:: Sjekk smartdata loggen at alle disker har PASSED.
for /f "tokens=6" %%A in (%smartdataloggfil%) do (
	if not "%%A"=="PASSED" (

:: Kjør synkronisering mot sky hvis alle disker er OK.
echo SMART Resultat: %FAILEDFUNNET% (0=OK, 1=FEIL).
echo Antall disker funnet: %DISKCOUNTER% / %antalldisker%.
set ALTOK=0

:: Sjekker at SMART er OK og at riktig antall disker ble funnet.
if %FAILEDFUNNET% equ 0 (
	if %DISKCOUNTER% equ %antalldisker% ( 
		set ALTOK=1

:: Utfør logging og arbeid basert på resultat.
if %ALTOK% equ 1 (
	echo Alle disker OK. Utfører synkronisering mot skyen. > %sistestatusloggfil%
) else (
	echo Dårlig SMART helse oppdaget, kjører ikke synkronisering. > %sistestatusloggfil%


Link to post
Share on other sites
  • 0

DrivePool has the dpcmd CLI tool, but I couldn't find any options re indicating missing disks.

You could test by copying a file to the pool - if it succeeds, there are no missing disks (since pools become read-only while disks are detected missing).

I see another problem however - if it is critical that disks not be missing, and if there is no checking during the sync operation itself, then there is no protection against the risk of a disk going missing during the sync operation?

Therefore if a disk going missing means the sync will remove files from the cloud, that indicates you are not using (full) duplication - perhaps you could sync from the individual disks that make up the pool, that way if a disk goes missing during the sync then the sync itself could stop?


Link to post
Share on other sites
  • 0
13 minutes ago, Shane said:

 if there is no checking during the sync operation itself, then there is no protection against the risk of a disk going missing during the sync operation?

Good point. But doing individual disks means more follow-up maintenance... 

I think I'll just move the script into a simple multithreaded app instead so I can loop and monitor it in a relaxed manner (don't wanna hammer the disks with SMART requests) and kill a separate sync thread on demand if needed. If I'm not mistaken, rclone won't start delete files until all the uploads are complete (gonna check that again). So that creates a small margin of error and/or delay.

Thanks for checking the other tool.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...