Does the s3 sleep plugin work if disks never spin down.


Recommended Posts

I recently changed a few settings on my server to help increase disk life. I am keeping in on less hours, but I set the disks to never spin down. However, I noticed that night my NAS wasn't shutting down (I use s3 sleep for shutdowns). Does s3 sleep only shut down the NAS if all the disks have spun down. If so, is there a workaround for people who never spin disks down?

  • Upvote 1
Link to comment
  • 2 months later...

Since this thread is being noticed by someone, I'll post my findings up to this point. No, s3 sleep does not have an option that allows for shutdowns when the disks are still spinning. However, Unraid keeps a record of all disk reads and writes in /sys/block/$DEV/stat with $DEV being the disk name. You can find an array of all hard drives (not cache) by running var=($(grep -PA1 '^name="(parity|disk)' $ini|sed -r '/^--/d;/^name=/d;s/"//g;s/^device=//')) 

var will contain all DEVs of the disks that are not cache. Then you can do a for loop like so DEV="${var[index]}" and append the contents of the file in /sys/block/$DEV/stat to a variable for each DEV in var. Sleep for a few seconds then run the loop again, except with another variable. Compare the two variables. If they are equal, no disk use. If not, the disk has been used (read or written from).

If you want individual disk stats like write only, you can look into /sys/block/$DEV/stat and adjust your script accordingly (it has all info about disk reads, writes, ioticks, etc.) You can find documentation on it as this file occurs in many linux distros.

P.S. Tested the script and it works!

Link to comment

Yes, this will work. Keep in mind that this will ignore all disk stats and the machine might turn off when you're using it. Its fine on most days, but I use my box past the cutoff all the time. I just have a 30 min timer and it resets when the disks are being used. Never have to worry about damaging my disks with spindows more often than necessary or unexpected turnoffs.

Edited by DisplayNerd
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.