Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (โ‹ฎ) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Getting a list of array drives for custom script

Featured Replies

Hi,

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 ๐Ÿ™‚

Anyway....

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

If you can parse /var/local/emhttp/disks.ini you should be on the right track.

  • Author

Thanks for the quick reply, looks like that is what I need.

It even has temp listed in main gui ๐Ÿ™‚ย so could do away with the hddtemp docker for cleaner and simpler system.

Not got any unassigned drives installed at the minute, will have to check if/how they show and work on parsing that as you say.

Your unassigned drives will probably find themselves listed in /var/local/emhttp/devs.ini in a similar manner.

Good luck!

  • Author

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ย ๐Ÿ‘

  • Author

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.

ย 

##GET LIST OF ARRAY DISKS
declare -a diskList
while IFS='= ' read var val
do
    if [[ $var == \[*] ]]
    then
        section=${var:2:-2}
        diskList+=($section)
        eval declare -A ${section}_data
    elif [[ $val ]]
    then
        if [[ $var == "temp" ]]
        then
           eval ${section}_data[temperature]=$val
        fi 
        eval ${section}_data[$var]=$val
    fi
done < /var/local/emhttp/disks.ini

##CHECK DISKS
#echo disklist
for disk in "${diskList[@]}"
do
    checkedtemp=0
    temp=${disk}_data[temperature]
    if [[ ${!temp} =~ ^[0-9]+$ ]]
    then
        checkedtemp=${!temp}
    else
        checkedtemp=spundown
    fi
    echo $disk - temperature = $checkedtemp
done

ย 

image.png.5effa28102396143763a277b5f60554a.png

ย 

image.png.704eb09b172f91998485759ac58e4dc3.png

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions โ†’ Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.