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.

Spin up script not working since update 6.9

Featured Replies

Hi can anyone tell me why my script wont work since update to 6.9, the script spins my drives up during busy time at time 

 

#!/bin/bash
disks=$(ls /dev/md* | sed "sX/dev/mdXX");
for disknum in $disks; do
    /usr/local/sbin/mdcmd spinup $disknum;
done
 

below is error i get 

Script location: /tmp/user.scripts/tmpScripts/Spin Up Drives/script
Note that closing this window will abort the execution of this script
/usr/local/sbin/mdcmd: line 11: echo: write error: Invalid argument
/usr/local/sbin/mdcmd: line 11: echo: write error: Invalid argument
/usr/local/sbin/mdcmd: line 11: echo: write error: Invalid argument
/usr/local/sbin/mdcmd: line 11: echo: write error: Invalid argument
/usr/local/sbin/mdcmd: line 11: echo: write error: Invalid argument
/usr/local/sbin/mdcmd: line 11: echo: write error: Invalid argument

 

any help would be great 

  • Replies 61
  • Views 10.5k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • This script will spin up every drive and keep the GUI in sync with everything (as it does it the exact same way the GUI does).    It doesn't appear the emhttp supports spin up or spin down. 

  • Spin down is no longer handled by mdcmd but by emhttpd, not sure if there's a new command we can now use for spin up, I'm also interested in that.

  • For now you can wait to see if anyone else replies here.   P.S. I edited the topic so the issue is more clear.

Spin down is no longer handled by mdcmd but by emhttpd, not sure if there's a new command we can now use for spin up, I'm also interested in that.

  • Author

Ah ok anywhere else we can post and ask ?? found it a very useful script 

For now you can wait to see if anyone else replies here.

 

P.S. I edited the topic so the issue is more clear.

  • JorgeB changed the title to Spin up script not working since update 6.9

sdspin in /usr/local/sbin is called by emhttp but i dont know of a replacement mdcmd way to spin up that the array knows about straight away.

 

#!/bin/bash
#
# Deal with spin up/down status of HDDs
#
# This script is initiated from emhttpd, like so:
#
#    sdspin <device> [up | down | status ]
#
# "device" is the HDD rdev name, such as "sdd".
#
#  up == Spin the drive up
#  down == Spin the drive down
#  status == return the current status via rc
#
# Default (if no $2) is "status".

# Exit code:
#   0 - Success (if up/down), device spun up (if status)
#   1 - Failure
#   2 - Device spun down (if status)

# Spin down/up SAS drives plugin
# v0.85
#
# (c) 2019-2021 @doron - CC BY-SA 4.0

 

It is also updated by doron's plugin to support SAS Drives.

Edited by SimonF

  • Author

@JorgeB have you tried script above ??

Edited by coblck

On 3/5/2021 at 7:28 PM, SimonF said:

sdspin <device> up

This works to spin up the disk, but it doesn't update the GUI status, so the disk won't spin down again. 

  • Author

So the drive wont spin down after the default time has elapsed ??

24 minutes ago, JorgeB said:

This works to spin up the disk, but it doesn't update the GUI status, so the disk won't spin down again. 

I have found that smartctl -iA /dev/sdh wakes a drive up and causes system to see active if you run it twice, as need IO against drive.

 

But when Tom fixes Smartctl(6.9.1) issues it may not work.

Edited by SimonF

43 minutes ago, coblck said:

So the drive wont spin down after the default time has elapsed ??

Correct.

 

24 minutes ago, SimonF said:

I have found that smartctl -iA /dev/sdh wakes a drive up and causes system to see active if you run it twice,

Thanks, worth a try.

I guess another thing I can use is instead of just running the spin up script as I was doing before, change it to use sdspin <device> up and then run another script with sdspin <device> down, this achieves what I need.

  • Author

If you get a working scripted please let me know as this stuffs above my pay grade 😁 very much appreciated. Cheers lads

18 minutes ago, JorgeB said:

sdspin <device> up

You could use this and then do smartctl -A after for the IO.

2 minutes ago, SimonF said:

You could use this and then do smartctl -A after for the IO.

Good idea.

30 minutes ago, SimonF said:
49 minutes ago, JorgeB said:

sdspin <device> up

You could use this and then do smartctl -A after for the IO.

This works for me.

 

47 minutes ago, coblck said:

If you get a working scripted please let me know as this stuffs above my pay grade

Basically you need to run a script that does:

 

/usr/local/sbin/sdspin /dev/sdX up
/usr/sbin/smartctl -A /dev/sdX

 

Where X is replaced with the different array devices, ideally the script should get the device list from the array, since sdX can change when new controllers/devices are added, sometimes it even changes without any new ones, I'm not really a script guy, but it should be easy the get them, if not you can always do it manually, but need to be aware that they can change.

 

  • Author
41 minutes ago, JorgeB said:


/usr/local/sbin/sdspin /dev/sdX up
/usr/sbin/smartctl -A /dev/sdX

 

 

 

 

So this will spin up all the drives or do i have to replace X with my drives allocation letter ? if so do i need to write the script for as much drives as i have ??

Edited by coblck

On 3/7/2021 at 3:05 PM, coblck said:

So this will spin up all the drives or do i have to replace X with my drives allocation letter ? if so do i need to write the script for as much drives as i have ??

 

replace it and add the two lines per drive, that's what I'm using to keep two drives spinning:

#!/bin/bash
/usr/local/sbin/sdspin /dev/sdc up;
/usr/local/sbin/sdspin /dev/sde up;
/usr/sbin/smartctl -A /dev/sdc;
/usr/sbin/smartctl -A /dev/sde;

 

Edited by MightyT

  • Author

Brill will try it this week once i get a minute, i take it they spin down if out with cron schedule ??

According to their spindown schedule, yes.

  • Author

Great many thanks have script repeating every 25 mins as spin down is at 30m so they are awake from 7pm to midnight on the weekend when plex is used most. 

And it's not working anymore in 6.9.1, well sort of. It works but not only doesn't get the status reported with 'smartctl -A', the disk log even shows spinning down despite the script keeping them running. Any ideas anyone?

  • Author

Will leave it on 6.9 for now till a workaround is fixed 

18 hours ago, MightyT said:

Any ideas anyone

Need to look at some other way to generate DiskIO at a partition level as 6.9.1 is discounting at a disk level to allow spin down.

 

What is the use case, can you provide me with a bit of a back ground on what you need to do?

  • Author

Where looking at getting the discs to spin up at a certain time of day and staying spun up. 

For now I just 'cat' a small txt file for each disk, that wakes the disks up and refreshes the status,  I'm hoping this keeps them spinning since there is no  read caching that I'm aware of.

 

Use case is, like coblck said, keeping the disks spun during a certain time of day while having relatively strict spindown settings at other times. For me it is too noisy while I'm working (and rarely accessing anything), and then in the evening and on the weekends I just want to keep them spinning since I'm not in the room aynway, to reduce spinup/spindown cycles.

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.