3

At first, I set up my RHEL7-x64 to sleep the zfs drives using this,this, and this. I believe I tried hd-idle first, when the problems began.

I had written a script idle_drives_enable to handle it @reboot in crontab -e (in a current state of using the hdparm method, as my latest effort).

#!/bin/bash

# idle_drives_enable
# Sets idle times to drives, usually needed at boot

# Default idle time covers all drives, including zfs drives, unless otherwise specified
DEFAULT_IDLE_TIME=120;

# Root drive we want to increase a bit, so specify separately
ROOT_IDLE_TIME=360;

#------------------------------------------------------------------
# Using hd-idle
# @dependency sudo yum install hd-idle
#
## 120 seconds is 10 minutes, 360 is 30 minutes
## Set default idle time on all.
#/sbin/hd-idle -i $DEFAULT_IDLE_TIME;

## Set root drive idle time longer, incase doing work, dont want to continually be waking it up

## sdb is current root, but sometimes changes
##/sbin/hd-idle -a /dev/sdb

## Use uuid instead because it never changes.  Specifying the root partition is enough to trigger the whole drive.
#/sbin/hd-idle -a /dev/disk/by-uuid/bbc69fc6-12fa-499a-a0c6-e0f65e248ce2 -i $ROOT_IDLE_TIME;

#echo "/usr/local/bin/idle_drives_enable complete! Default idle time of $DEFAULT_IDLE_TIME seconds was set. Additionally, the root drive is set to idle after $ROOT_IDLE_TIME seconds.";


#------------------------------------------------------------------------
# hd-idle is not allowing wake, are these considered scsi??
# testing with hdparm instead

echo "executing /usr/local/bin/idle_drives_enable..."
echo "using hdparm"
echo "Here is the output of the current hdparm -C"
/sbin/hdparm -C /dev/sd?

echo "setting idle times now..."
/sbin/hdparm -q -S  $DEFAULT_IDLE_TIME -y /dev/sd?

echo "done settting idle times. to default idle time ($DEFAULT_IDLE_TIME seconds)."
echo "Here is the output of the current hdparm -C"
/sbin/hdparm -C /dev/sd?

echo "/usr/local/bin/idle_drives_enable complete!"

I set zfs prop atime=off
I also set in /etc/fstab noatime for my boot drive which contains root/home xfs & swap only.

Those were the only changes made.

After first the reboot test, the zfs pools are no longer available, and this continues.

After testing with hdparm I found it had the same symptoms (no zfs on boot). I eventually realized it just wasnt importing correctly on boot. If I just zfs export then zfs import, the pool comes back online just fine, and the sleep on idle, and rewaking on access of the pool works fine at this point. (atleast when using hdparm). I didn't think of that yet when using hd-idle.

Interestingly I found that on the 6 drive RaidZ2 array, when I access certain folders, only certain drives wake up, that's pretty cool.

What I have done to try to fix:

  • turned on atime property on zfs, didnt fix, so turned back off.
  • commented the cron job so the idle times are not being set at boot.

I suspect maybe I tried hd-idle first, and it has some residual settings that might just not be working, and need to be reset.

Any ideas on where to look as to why the zfs pool is no longer available at boot?

Update In the end I think I had just somehow messed up my implementation of ZFS. This script works great. Here is what I ended up with if anybody else wants to sleep their drives.

#!/bin/bash                                                                                                                                     

# idle_drives_enable
# Sets idle times to drives, usually needed at boot

# Default idle time covers all drives, including zfs drives, unless otherwise specified
DEFAULT_IDLE_TIME=120;

# Root drive we want to increase a bit, so specify separately 
ROOT_IDLE_TIME=360;


#ALLDRIVELIST=("a" "b" "c" "d" "e" "f" "g");
#for DRIVE in "${ALLDRIVELIST[@]}";
#do
#    #/sbin/hdparm -C /dev/sd$DRIVE 
#     
#done

#------------------------------------------------------------------
# Using hd-idle 
# @dependency sudo yum install hd-idle
#
## 120 seconds is 10 minutes, 360 is 30 minutes
## Set default idle time on all.  
#/sbin/hd-idle -i $DEFAULT_IDLE_TIME;

## Set root drive idle time longer, incase doing work, dont want to continually be waking it up

## sdb is current root, but sometimes changes
##/sbin/hd-idle -a /dev/sdb

## Use uuid instead because it never changes.  Specifying the root partition is enough to trigger the whole drive. 
#/sbin/hd-idle -a /dev/disk/by-uuid/bbc69fc6-12fa-499a-a0c6-e0f65e248ce2 -i $ROOT_IDLE_TIME;

#echo "/usr/local/bin/idle_drives_enable complete! Default idle time of $DEFAULT_IDLE_TIME seconds was set. Additionally, the root drive is set to idle after $ROOT_IDLE_TIME seconds.";


#------------------------------------------------------------------------
# hd-idle is not allowing wake, are these considered scsi??
# testing with hdparm instead

echo "executing /usr/local/bin/idle_drives_enable..."
echo "using hdparm"
echo "Here is the output of the current hdparm -C"
/sbin/hdparm -C /dev/sd?

echo "setting idle times now..."
/sbin/hdparm -q -S  $DEFAULT_IDLE_TIME -y /dev/sd?

echo "done settting idle times. to default idle time ($DEFAULT_IDLE_TIME seconds)."
echo "Here is the output of the current hdparm -C"
/sbin/hdparm -C /dev/sd?

echo "/usr/local/bin/idle_drives_enable complete!"
  • Did you ever solve the issue? – ajeh Jun 25 '18 at 0:29
  • Hi, I think i did, I think it was just a problem with my ZFS implementation. After reinstalling zfs, the idle_drives_enable scripts has been working great. Hope its useful to someone. – Brian Thomas Jun 25 '18 at 18:26
  • Maybe post an answer when you have a chance. – ajeh Jun 25 '18 at 18:56
  • OK, I'm not sure there is an answer. what issue are you having? E.g. the way i laid it out in the question is the way to correctly implement it. I just had a bad zfs implementation i think. If you run into the same scenario, i would like to know, in which case it may mean the method i have above is whats causing the drives to disappear until a zfs reinstall, or some other command that i havent realized yet. But I believe if you follow the question carefully you will probably end up with a nice drive idling scenario, where your ZFS drives sleep when not in use. – Brian Thomas Jun 28 '18 at 17:49
  • @ajeh i added that to an update on the OP. – Brian Thomas Jun 28 '18 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.