How do I issue a spindown / standby command to the cache drive / pool?


Recommended Posts

Sending a disk to sleep is easy:

mdcmd spindown 0
mdcmd spindown 1
...

 

I tried to reverse engineer the icon click, but was not successful. As an example. Clicking the icon calls "http://tower/webGui/include/ToggleState.php" with the following POST content:

device=Device&name=cache&action=down&state=STARTED&csrf=blabla&csrf_token=blabla

 

As "device" has been set to "Device" it calls this line in "ToggleState.php":

if ($name) emhttpd("cmdSpin$action=$name"); else emhttpd("cmdSpin{$device}All=true");

 

Which executes curl:

  $ch = curl_init("http://127.0.0.1/update.htm?$cmd&startState=$state&csrf_token=$csrf");
  curl_setopt_array($ch, [CURLOPT_UNIX_SOCKET_PATH => '/var/run/emhttpd.socket', CURLOPT_RETURNTRANSFER => true]);
  curl_exec($ch);

 

The update.htm part confuses me as a static HTML page is not able to execute anything. Maybe this is rewritten through the NGINX webserver?!

 

Whatever... I tried to find the "cmdSpin" string in the Unraid Source Code and was only successful in the unassigned devices plugin:

function spin_disk($down, $dev) {
    if ($down) {
        exec("/usr/local/sbin/emcmd cmdSpindown=$dev");
    } else {
        exec("/usr/local/sbin/emcmd cmdSpinup=$dev");
    }
}

 

EDIT:

Ok. This command works:

/usr/local/sbin/emcmd cmdSpindown=cache

 

Why isn't this mentioned anywhere? ^^

Link to comment
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.