Ticket #242 (closed defect: fixed)
HDD STANDBY, No -I parameter, (fix included, changed to -I)
| Reported by: | JoeSchmuck | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 8.0-RELEASE |
| Component: | Backend | Version: | 8.0-RELEASE |
| Keywords: | ataidle | Cc: | joeschmuckatelli2002@… |
Description
Request reopening Ticket 202 I submitted 2 weeks ago because whatever the "fix" was, it didn't fix it. This was originally reported against RC3 and RC4 came out the same day so the fix was not in that build. It should have been in RC5.
The Samsung HD204UI hard drives do not spindown after set time.
I have tried other settings but all have failed to turn off the hard drives. Using this setup does work in 0.7.2 v.5543 of FreeNAS.
Settings from Edit Disk Screen:
Name: ad6
Disks: ad6
Description: Member of AudioVideo??
Transfer Mode: Auto
HDD Standby: 5
Advanced Power Management: Disabled
Acustic Level: Disabled
Enable S.M.A.R.T.: Checked
SMART Extra Options: blank
Group Membership: AudioVideo??()
I have tried other combinations including using Adv Power Management levels. I cannot get the hard drives to spin down. I have not touched the Acoustic settings yet but I really don't want the drives to operate any slower than they are.
Another user reported the following but I don't know if this was fixed... "Neither does my Western Digital WD20EARS disks. I have mine in a raidz, I don't know if that has something to do with it."
I'm happy to provide additional data if requested.
Attachments
Change History
comment:2 Changed 13 months ago by JoeSchmuck
- Component changed from FreeBSD to Backend
Changed from FreeBSD component to Backend.
Changed 13 months ago by JoeSchmuck
-
attachment
ix-ataidle-Recommended Changes.txt
added
ix-ataidle recommended changes
comment:3 follow-up: ↓ 5 Changed 13 months ago by JoeSchmuck
- Cc joeschmuckatelli2002@… added
- Keywords ataidle added
- Priority changed from minor to major
Please keep in mind that I'm not a programmer but I did create a FreeBSD VM and start building and testing FreeNAS 8.x so I could figure out this hard drive problem. This works for my system but since there was some code which I didn't unsderstand it's purpose, it may need to be added back for compatability with someone else.
There are a few problems with the ix-ataidle code and here are my comments. I have included the updated file for your review and inclusion into the project.
The problems I found:
- HDD Standby setting 360 is invalid, 330 is the maximum supported by ataidle and the GUI should be adjusted to reflect this value. The remaining values are valid. It would also be nice if once you commited a change in the GUI that is would become effective immediately vice only after a reboot. A seperate ticket will go in for that request.
- I placed the switches in order per the following usage (doubt switch order is a big deal here but sometimes it matters)
- Removed one section that had no meaning, There doesn't seem to be a reason to send the command twice for each drive, once for the APM and AAM and then once for the standby value so I removed the first command.
- Not sure what the sleep 60 and the rest of that line was for but it's gone.
First I started with why my Samsung HD204UI drives would not go into Standby and I discovered these drives do not handle APM well. APM value must be set at 128 or higher or the drive will cycle on an off. As for the Standby, well it didn't work because the "-S" switch was left out. One downside to using ataidle is when the -S command is sent, the drives typically spindown immediately. This is a known side effect.
I placed an asterisk "*" and number at the beginning of each line I changed and here are my comments for those lines:
Lines 1 & 2: rearanged order of switches in ataidle_args.
Lines 3, 4, 5: deleted since looking for a not null is never going to be false since we modify the variable twice before this check. It also issues the APM and AAM command and I'm not sure why they are done seperate from the Standby command so they are gone. If there was a reason to keep them seperate, I don't know why.
Line 6: What is this line all about? Sleep 60, why, and why the null? I truly don't understand this except for issuing the standby command, which is missing the -S switch.
Line 7: Here is where we only send out this command once and with the switches in the proper format.
Here are my comments against the code:
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: ix-ataidle
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: nojail shutdown
. /etc/rc.subr
ataidle_start()
{
local IFS=\|
local f="disk_disks disk_hddstandby disk_advpowermgmt disk_acousticlevel"
eval local $f
local cmd sf
sf=$(echo $f | sed -e 's/ /, /g')
${FREENAS_SQLITE_CMD} ${FREENAS_CONFIG} \
"SELECT $sf FROM storage_disk WHERE disk_disks LIKE 'ad%' OR disk_disks LIKE 'ada%'" | \
while eval read $f; do
ataidle_args=""
if [ "${disk_advpowermgmt}" != "Disabled" ]; then
ataidle_args="-P ${disk_advpowermgmt}"
else
ataidle_args="-P 0"
fi
if [ "${disk_acousticlevel}" != "Disabled" ]; then
if [ "${disk_acousticlevel}" = "Minimum" ]; then
disk_acousticlevel=1
elif [ "${disk_acousticlevel}" = "Medium" ]; then
disk_acousticlevel=64
elif [ "${disk_acousticlevel}" = "Maximum" ]; then
disk_acousticlevel=127
fi
else
disk_acousticlevel=0
fi
* 1 old ataidle_args="${ataidle_args} -A ${disk_acousticlevel}"
* 2 new ataidle_args="-A ${disk_acousticlevel} ${ataidle_args}"
* 3 delete if [ -n "${ataidle_args}" ]; then
* 4 delete /usr/local/sbin/ataidle ${ataidle_args} ${disk_disks}
* 5 delete fi
if [ "${disk_hddstandby}" != "Always On" ]; then
* 6 delete (sleep 60; /usr/local/sbin/ataidle ${disk_hddstandby} ${disk_disks}) > /dev/null 2>&1 &
* 7 add ataidle_args="-S ${disk_hddstandby} ${ataidle_args}"
fi
* 8 add /usr/local/sbin/ataidle ${ataidle_args} ${disk_disks}
done
}
name="ix-ataidle"
start_cmd="ataidle_start"
stop_cmd=':'
load_rc_config $name
run_rc_command "$1"
comment:4 Changed 13 months ago by JoeSchmuck
- Summary changed from Hard drives do not spin down to HDD STANDBY, No -S parameter, (fix included)
comment:5 in reply to: ↑ 3 Changed 12 months ago by b1167684@…
Replying to JoeSchmuck:
- Removed one section that had no meaning, There doesn't seem to be a reason to send the command twice for each drive, once for the APM and AAM and then once for the standby value so I removed the first command.
That makes sense if setting APM options fail. E.g. WD20EARS drives prohibit APM access. In such case the command aborts without setting the spindown time.
- Not sure what the sleep 60 and the rest of that line was for but it's gone.
Setting the spindown time also cause the drive to spindown immediately. To avoid spindown and spinup again by continue system initialization, the commands will be issued with a delay of 60 seconds. That way setting the spindown timeout (and spinning down the drives) will be done after the system is booted.
If one add the missing "-S" switch everything should work as intended (except APM on several WD Caviar Green)
comment:6 Changed 12 months ago by JoeSchmuck
I'd like to change my position and use the -I parameter as it's proper. I have no clue why I was fixated on the -S.
I see the changes you made to ix-ataidle @ 6504 however why wasn't the -S or -I parameter included at line 51 "(sleep 60; /usr/local/sbin/ataidle ${disk_hddstandby} ${disk}) > /dev/null 2>&1 & ". I know issuing the command "ataidle 5 ada0" has no effect on my system however "ataidle -I 5 ada0" will cause the drive to enter Standby after 5 minutes. 5 minutes is what I'm using for testing purposes.
My recommendation is to change line 51 as follows:
(sleep 60; /usr/local/sbin/ataidle -I ${disk_hddstandby} ${disk}) > /dev/null 2>&1 &
It looks like you do need to sleep since you already issued a previous command and this will force a delay, without it I had problems. Maybe 60 could be reduced to 5 seconds.
As for error messages, whenever I issue the Idle or Standby command to my Samsung drives an error message comes back stating the command was not successful however it really was. Since I do not have and WD drives I cannot test to see if the indications are the same. Here is my error message:
ata2: timeout waiting for DRQ (pass1:ata2:0:0:0): IDLE. ACB: e3 00 00 00 00 40 00 00 00 00 3c 00 (pass1:ata2:0:0:0): CAM Status: CCB request completed with an error Failed to configure idle mode.
I suspect ataidle needs to be updated to support these drives properly. I have left a message for Bruce (programmer of ataidle) to see if he can fix this problem. It appears that the timeout is the issue but I'll let Bruce tell me what the real problem is.
As for errors, I think we can handle seeing the error message as long as the command works and just note the issue somewhere until ataidle is updated.
I rebuild with line 51 changed as described to test it out and it works fine.
-Mark

It was me with the WD20EARS disks, and it doesnt work for me either. I have mine set to Level 127 in power management, setting it lower makes no difference.