Jump to content

Getting a list of array drives for custom script

Recommended Posts


First time posting on unraid forum 🙂, been using unraid now for couple of years and loving it.

Setup is a Ryzen 3900x on a X470 board with 64GB RAM with 20+2 3TB drives, querky setup with a cut down 24 hotswap bay case for array drives with dual 8088 links, DSub 5W5 power hookup so both main server and drive case powered from main server PSU and most recently PWM passthrough from main server to array case via serial cable with custom fan header links connecting array case fans to main server chasis fan header in main case. Will sort some pictures if anyone interested in seeing my franken server 🙂


Working on a custom script for the array chassis fans, hardware wise am all sorted passing PWM signal from main server to the 24 bay drive only chassis. It has 3 high speed 120x38 server fans on the array case and need some temp controlled PWM to reduce both the noice and power consumption by these beast of fans.
Making with custom script as autofan seems to use smart data and wake spun down drives so am checking state to only check temp for spun up drives following an example script from online.

Need to isolate drives which are part of the array and struggling to find a way to do so, as only want to check array drives, pool/cache drives are in main server.

Will be keeping the main array in the second case specifically and would rather not hard code drives as intend to use 23 and 24th bays for a pair of hot spares and would prefer script to just check any drives which are part of the array and dont want to forget to update list if/when these are used or a drive replaced or to mess with a UI update method.

Topics in searches I did listed disks in /dev specifying sd* but unassigned and pool drives will be included in this.
Closest I think I've seen is referring to the super.dat file however struggling to get the data in a useable format. Unfortunately havn't got much experience with shell/bash.

Got most of the rest sorted already sored based around the custom fan control script on another site modified to use HDDTemp docker and hdparam to check idle state to bypass spun down drives to avoid spinning up drives unnecessarily.
Hopefully someone might be able to offer a suggestion 🙂

Edited by Joseph Trice-Rolph
Link to comment

Managed to pull out the temp param 🙂


sed -nr "/^\[\"disk2\"\]/ { :l /^temp[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /var/local/emhttp/disks.ini


Looking very promising and cutting out checking for idle etc as can just pull temp direct from that and a chunk of additional complexity in needing to pull from HDDTemp to work around various SMART formats as have mixed drive models.


Thanks again, made my evening 👍

Link to comment

So thought it would be good to share progress.

First time writing bash script so probably a little crude.

Have gotten as far as pulling array of disks from disks.ini along with an array or parameters for each disk and outputting a list of disks with either their unraid temp or 'spundown'.

Open to any advice or amendment suggestions.


declare -a diskList
while IFS='= ' read var val
    if [[ $var == \[*] ]]
        eval declare -A ${section}_data
    elif [[ $val ]]
        if [[ $var == "temp" ]]
           eval ${section}_data[temperature]=$val
        eval ${section}_data[$var]=$val
done < /var/local/emhttp/disks.ini

#echo disklist
for disk in "${diskList[@]}"
    if [[ ${!temp} =~ ^[0-9]+$ ]]
    echo $disk - temperature = $checkedtemp





Link to comment

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.

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.

  • Create New...