Skip to content

Commit

Permalink
Adapt spin down/up detection to Unraid ge 6.9.0 and SAS
Browse files Browse the repository at this point in the history
hdparm does not detect SAS drives power state correctly. Unraid 6.9.0 introduced "sdspin", which is the focal point for spin down detection.
With SAS spindown plugin installed, sdspin correctly detects power state for all drives.
  • Loading branch information
doron1 authored Feb 7, 2021
1 parent d176286 commit d12c352
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,19 @@ function getDisks() {
$validDisks = getDisks();
$totalSpunDown = 0;
foreach ($validDisks as $disk) {
$result = shell_exec("hdparm -C /dev/{$disk['device']}");
if ( $debug ) {
logger($result);
}
if ( ! strpos($result,"active") ) {
$totalSpunDown++;
if ( file_exists("/usr/local/sbin/sdspin") ) {
exec("/usr/local/sbin/sdspin /dev/{$disk['device']}",$out,$ret);
if ( $ret == 2 ) {
$totalSpunDown++;
}
} else {
$result = shell_exec("hdparm -C /dev/{$disk['device']}");
if ( $debug ) {
logger($result);
}
if ( ! strpos($result,"active") ) {
$totalSpunDown++;
}
}
}
if ( $debug ) {
Expand Down Expand Up @@ -123,4 +130,4 @@ function getDisks() {
@unlink($turboPaths['backgroundPID']);
@unlink($turboPaths['status']);

?>
?>

0 comments on commit d12c352

Please sign in to comment.