bergware/dynamix

HDD activity not detected for disks behind Adaptec RAID controller - solution proposal

MichaelAnders opened this issue · 2 comments

I have an Adaptec 51254 RAID controller allowing for 12 SATA ports.

Problem: Your S3 sleep plugin won't allow bringing the system to S3 if HDD activity should be evaluated.

HDD's cannot be spinned down via unraid UI or hdparm, the controller brings them back up immediately.

Solution is to not use each disk as JBOD but instead use them as individual arrays consisting of just one disk. For arrays spin down times can be defined in the controller menu and that works fine.

However - "hdparm -C" will never get the proper result, the disks are always "active" though they are off.

I had created some code to handle this before but found a better way around that on the web. Instead of relying on the state of the drive, check if there has been any IO happening. The following code works perfectly - it finds there is no activity on the disks regardless of their activity state.

I changed my code locally (repacked into txz and adjusted the MD5) and it works fine - should work well for all disks.

The code I'm using now:

HDD_activity() {
result=
if [[ $checkHDD == yes ]]; then
# Create a file on the ramdisk and cycle it to test for disk activity
( if [ ! -f /dev/shm/1 ] ; then touch /dev/shm/1 /dev/shm/2; fi ; mv /dev/shm/1 /dev/shm/2; cat /proc/diskstats > /dev/shm/1 ) >/dev/null 2>&1

for dev in ${array[@]}; do
  # Check if drive has been non idle since last run
  if [ "$(diff /dev/shm/1 /dev/shm/2 | grep $dev )" =  "" ]; then
    result=
  else
    result=1
    break;
  fi
done

fi

if [[ -n $result ]]; then
log "Disk activity on going: $dev"
echo $result
fi
}

Thanks for your proposal. When time permits I make an update.

New version is out, which has your proposed solution.