Spin up script not working since update 6.9


Recommended Posts

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 

Link to comment
  • 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
Link to comment
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
Link to comment
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.

Link to comment
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.

 

  • Like 1
Link to comment
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
Link to comment
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
  • Thanks 1
Link to comment
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?

Link to comment

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.

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.

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.