Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux? |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-31-2023, 06:07 PM
|
#1
|
LQ Newbie
Registered: Apr 2023
Posts: 2
Rep:
|
Adjust idle timer on WD40EZAZ hard drive
Current Situations:
I have a WD40EZAZ hard drive mounted to a small linux machine via a USB3 to SATA cable. It works great. However the hard drive stops spinning after approximately 3 minutes after my last access. It makes a sound like I would imagine tiny hard drive brakes would sound. It starts back up again if I use the hard drive. I've timed it several times and it always puts on the brakes after approximately 3 minutes.
I am worried about all the stopping and starting of the hard drive.
What I would like:
I would like to increase the amount of time before it goes into whatever mode it is going into (not sure if it's called standby, idle, or some other term). I would like to set it to somewhere between 10 minutes to one hour.
Is there a difference between standby and idle, am I adjusting the wrong parameter?
What I've tried:
I've spent several hours reading through similar situations and tried several commands. They have had no effect on the actual measured time before the HD puts on the brakes:
1) sudo sdparm --flexible -6 -l --save --set SCT=18000 /dev/sda
SCT was set to 1800 (which is 3 minutes). This command does allow me to adjust SCT.
sudo sdparm --flexible -6 -l -a /dev/sda shows me SCT=18000 after I adjust it, but the HD still stops after 3 minutes.
2) sudo hdparm -S 252 /dev/sda
Quote:
/dev/sda:
setting standby to 252 (21 minutes)
SG_IO: bad/missing sense data, sb[]: 70 00 01 00 00 00 00 0a 00 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
This makes the hard drive spin up but it stops after 3 minutes.
3) sudo hdparm -J /dev/sda
Quote:
SG_IO: bad/missing sense data, sb[]: 70 00 01 00 00 00 00 0a 00 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: bad/missing sense data, sb[]: 70 00 07 00 00 00 00 0a 00 00 00 00 74 71 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: bad/missing sense data, sb[]: 70 00 07 00 00 00 00 0a 00 00 00 00 74 71 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: bad/missing sense data, sb[]: 70 00 01 00 00 00 00 0a 00 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
wdidle3 = disabled
|
4) idle3-tools
I have not tried them. Not sure if they are still recommended or safe.
5) sudo smartctl -x -d sat /dev/sda
Gives a bunch of information
Details (excerpts from command output):
> sudo sdparm --flexible -6 -l -a /dev/sda
This shows the SCT value before I set it to 18000 (from 1800). It had no measurable effect on the delay before the drive stopped.
Quote:
/dev/sda: WDC WD40 EZAZ-00SF3B0 4101
Direct access device specific parameters: WP=0 DPOFUA=0
...
Power condition [po] mode page:
PM_BG 0 [cha: n, def: 0, sav: 0] Power management, background functions, precedence
STANDBY_Y 0 [cha: n, def: 0, sav: 0] Standby_y timer enable
IDLE_C 0 [cha: n, def: 0, sav: 0] Idle_c timer enable
IDLE_B 0 [cha: n, def: 0, sav: 0] Idle_b timer enable
IDLE 0 [cha: n, def: 0, sav: 0] Idle_a timer enable
STANDBY 1 [cha: y, def: 1, sav: 1] Standby_z timer enable
ICT 0 [cha: n, def: 0, sav: 0] Idle_a condition timer (100 ms)
SCT 1800 [cha: y, def:18000, sav:1800] Standby_z condition timer (100 ms)
IBCT 0 [cha: n, def: 0, sav: 0] Idle_b condition timer (100 ms)
ICCT 0 [cha: n, def: 0, sav: 0] Idle_c condition timer (100 ms)
SYCT 0 [cha: n, def: 0, sav: 0] Standby_y condition timer (100 ms)
CCF_IDLE 0 [cha: n, def: 0, sav: 0] check condition on transition from idle
CCF_STAND 0 [cha: n, def: 0, sav: 0] check condition on transition from standby
CCF_STOPP 0 [cha: n, def: 0, sav: 0] check condition on transition from stopped
|
> sudo smartctl -x -d sat /dev/sda
Quote:
=== START OF INFORMATION SECTION ===
Device Model: WDC WD40EZAZ-00SF3B0
Serial Number: WD-WXM2AA2J7JX5
LU WWN Device Id: 5 0014ee 215897c69
Firmware Version: 80.00A80
User Capacity: 4,000,787,030,016 bytes [4.00 TB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Rotation Rate: 5400 rpm
Form Factor: 3.5 inches
TRIM Command: Available, deterministic, zeroed
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ACS-3 T13/2161-D revision 5
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Wed May 31 17:53:07 2023 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
AAM feature is: Unavailable
APM feature is: Unavailable
Rd look-ahead is: Enabled
Write cache is: Enabled
DSN feature is: Unavailable
ATA Security is: Disabled, NOT FROZEN [SEC1]
Wt Cache Reorder: Unknown
=== START OF READ SMART DATA SECTION ===
SMART Status not supported: Incomplete response, ATA output registers missing
SMART overall-health self-assessment test result: PASSED
Warning: This result is based on an Attribute check.
General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection: Disabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: (51600) seconds.
Offline data collection
capabilities: (0x7b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 111) minutes.
Conveyance self-test routine
recommended polling time: ( 2) minutes.
SCT capabilities: (0x3031) SCT Status supported.
SCT Feature Control supported.
SCT Data Table supported.
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAGS VALUE WORST THRESH FAIL RAW_VALUE
1 Raw_Read_Error_Rate POSR-K 200 200 051 - 0
3 Spin_Up_Time POS--K 211 210 021 - 2416
4 Start_Stop_Count -O--CK 100 100 000 - 155
5 Reallocated_Sector_Ct PO--CK 200 200 140 - 0
7 Seek_Error_Rate -OSR-K 200 200 000 - 0
9 Power_On_Hours -O--CK 099 099 000 - 1317
10 Spin_Retry_Count -O--CK 100 100 000 - 0
11 Calibration_Retry_Count -O--CK 100 253 000 - 0
12 Power_Cycle_Count -O--CK 100 100 000 - 4
192 Power-Off_Retract_Count -O--CK 200 200 000 - 1
193 Load_Cycle_Count -O--CK 200 200 000 - 155
194 Temperature_Celsius -O---K 123 111 000 - 24
196 Reallocated_Event_Count -O--CK 200 200 000 - 0
197 Current_Pending_Sector -O--CK 200 200 000 - 0
198 Offline_Uncorrectable ----CK 100 253 000 - 0
199 UDMA_CRC_Error_Count -O--CK 200 200 000 - 0
200 Multi_Zone_Error_Rate ---R-- 100 253 000 - 0
||||||_ K auto-keep
|||||__ C event count
||||___ R error rate
|||____ S speed/performance
||_____ O updated online
|______ P prefailure warning
General Purpose Log Directory Version 1
SMART Log Directory Version 1 [multi-sector log support]
Address Access R/W Size Description
0x00 GPL,SL R/O 1 Log Directory
0x01 SL R/O 1 Summary SMART error log
0x02 SL R/O 5 Comprehensive SMART error log
0x03 GPL R/O 6 Ext. Comprehensive SMART error log
0x04 GPL R/O 256 Device Statistics log
0x04 SL R/O 8 Device Statistics log
0x06 SL R/O 1 SMART self-test log
0x07 GPL R/O 1 Extended self-test log
0x09 SL R/W 1 Selective self-test log
0x0c GPL R/O 2048 Pending Defects log
0x10 GPL R/O 1 NCQ Command Error log
0x11 GPL R/O 1 SATA Phy Event Counters log
0x24 GPL R/O 294 Current Device Internal Status Data log
0x30 GPL,SL R/O 9 IDENTIFY DEVICE data log
0x80-0x9f GPL,SL R/W 16 Host vendor specific log
0xa0-0xa7 GPL,SL VS 16 Device vendor specific log
0xa8-0xb6 GPL,SL VS 1 Device vendor specific log
0xb7 GPL,SL VS 78 Device vendor specific log
0xb9 GPL,SL VS 4 Device vendor specific log
0xbd GPL,SL VS 1 Device vendor specific log
0xc0 GPL,SL VS 1 Device vendor specific log
0xc1 GPL VS 93 Device vendor specific log
0xe0 GPL,SL R/W 1 SCT Command/Status
0xe1 GPL,SL R/W 1 SCT Data Transfer
SMART Extended Comprehensive Error Log Version: 1 (6 sectors)
No Errors Logged
SMART Extended Self-test Log Version: 1 (1 sectors)
No self-tests have been logged. [To run self-tests, use: smartctl -t]
SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
SCT Status Version: 3
SCT Version (vendor specific): 258 (0x0102)
Device State: Active (0)
Current Temperature: 24 Celsius
Power Cycle Min/Max Temperature: 21/32 Celsius
Lifetime Min/Max Temperature: 18/33 Celsius
Under/Over Temperature Limit Count: 0/0
Vendor specific:
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SCT Temperature History Version: 2
Temperature Sampling Period: 1 minute
Temperature Logging Interval: 1 minute
Min/Max recommended Temperature: 0/60 Celsius
Min/Max Temperature Limit: -41/85 Celsius
Temperature History Size (Index): 478 (382)
Index Estimated Time Temperature Celsius
383 2023-05-31 09:56 23 ****
... ..( 25 skipped). .. ****
409 2023-05-31 10:22 23 ****
410 2023-05-31 10:23 ? -
411 2023-05-31 10:24 23 ****
... ..( 2 skipped). .. ****
414 2023-05-31 10:27 23 ****
415 2023-05-31 10:28 24 *****
416 2023-05-31 10:29 25 ******
417 2023-05-31 10:30 25 ******
418 2023-05-31 10:31 25 ******
419 2023-05-31 10:32 24 *****
420 2023-05-31 10:33 25 ******
421 2023-05-31 10:34 24 *****
... ..( 8 skipped). .. *****
430 2023-05-31 10:43 24 *****
431 2023-05-31 10:44 ? -
432 2023-05-31 10:45 24 *****
433 2023-05-31 10:46 23 ****
... ..(426 skipped). .. ****
382 2023-05-31 17:53 23 ****
SCT Error Recovery Control command not supported
Device Statistics (GP Log 0x04)
Page Offset Size Value Flags Description
0x01 ===== = = === == General Statistics (rev 1) ==
0x01 0x008 4 4 --- Lifetime Power-On Resets
0x01 0x010 4 1317 --- Power-on Hours
0x01 0x018 6 2049391216 --- Logical Sectors Written
0x01 0x020 6 2411064 --- Number of Write Commands
0x01 0x028 6 182392208 --- Logical Sectors Read
0x01 0x030 6 1378263 --- Number of Read Commands
0x01 0x038 6 446232704 --- Date and Time TimeStamp
0x03 ===== = = === == Rotating Media Statistics (rev 1) ==
0x03 0x008 4 29 --- Spindle Motor Power-on Hours
0x03 0x010 4 28 --- Head Flying Hours
0x03 0x018 4 157 --- Head Load Events
0x03 0x020 4 0 --- Number of Reallocated Logical Sectors
0x03 0x028 4 0 --- Read Recovery Attempts
0x03 0x030 4 0 --- Number of Mechanical Start Failures
0x03 0x038 4 0 --- Number of Realloc. Candidate Logical Sectors
0x03 0x040 4 1 --- Number of High Priority Unload Events
0x04 ===== = = === == General Errors Statistics (rev 1) ==
0x04 0x008 4 0 --- Number of Reported Uncorrectable Errors
0x04 0x010 4 0 --- Resets Between Cmd Acceptance and Completion
0x05 ===== = = === == Temperature Statistics (rev 1) ==
0x05 0x008 1 24 --- Current Temperature
0x05 0x010 1 23 --- Average Short Term Temperature
0x05 0x018 1 22 --- Average Long Term Temperature
0x05 0x020 1 32 --- Highest Temperature
0x05 0x028 1 18 --- Lowest Temperature
0x05 0x030 1 26 --- Highest Average Short Term Temperature
0x05 0x038 1 19 --- Lowest Average Short Term Temperature
0x05 0x040 1 22 --- Highest Average Long Term Temperature
0x05 0x048 1 21 --- Lowest Average Long Term Temperature
0x05 0x050 4 0 --- Time in Over-Temperature
0x05 0x058 1 60 --- Specified Maximum Operating Temperature
0x05 0x060 4 0 --- Time in Under-Temperature
0x05 0x068 1 0 --- Specified Minimum Operating Temperature
0x06 ===== = = === == Transport Statistics (rev 1) ==
0x06 0x008 4 314 --- Number of Hardware Resets
0x06 0x010 4 327 --- Number of ASR Events
0x06 0x018 4 0 --- Number of Interface CRC Errors
0xff ===== = = === == Vendor Specific Statistics (rev 1) ==
0xff 0x008 7 0 --- Vendor Specific
0xff 0x010 7 0 --- Vendor Specific
0xff 0x018 7 0 --- Vendor Specific
|||_ C monitored condition met
||__ D supports DSN
|___ N normalized value
Pending Defects log (GP Log 0x0c)
No Defects Logged
SATA Phy Event Counters (GP Log 0x11)
ID Size Value Description
0x0001 2 0 Command failed due to ICRC error
0x0002 2 0 R_ERR response for data FIS
0x0003 2 0 R_ERR response for device-to-host data FIS
0x0004 2 0 R_ERR response for host-to-device data FIS
0x0005 2 0 R_ERR response for non-data FIS
0x0006 2 0 R_ERR response for device-to-host non-data FIS
0x0007 2 0 R_ERR response for host-to-device non-data FIS
0x0008 2 0 Device-to-host non-data FIS retries
0x0009 2 79 Transition from drive PhyRdy to drive PhyNRdy
0x000a 2 81 Device-to-host register FISes sent due to a COMRESET
0x000b 2 0 CRC errors within host-to-device FIS
0x000d 2 0 Non-CRC errors within host-to-device FIS
0x000f 2 0 R_ERR response for host-to-device data FIS, CRC
0x0012 2 0 R_ERR response for host-to-device non-data FIS, CRC
0x8000 4 1232587 Vendor specific
|
|
|
|
06-11-2023, 12:12 PM
|
#2
|
LQ Newbie
Registered: Apr 2023
Posts: 2
Original Poster
Rep:
|
I have been unable to adjust the hard drive timer in a way that actually affects the spindown time.
I've written the following script to keep the drive spinning for an hour after its last access (bash isn't my native language):
Code:
fs_watch="sda1"
hd="sda"
frequency="120"
timeout="3600"
fs_get_reads() {
fs=$1
line=`grep "$fs" /proc/diskstats`
reads=`echo $line | cut -d" " -f4`
echo $reads
}
last_reads=$( fs_get_reads $fs_watch )
last_change=0
while [ 1 ]
do
sleep $frequency
reads=$( fs_get_reads $fs_watch )
now=$(date +%s)
tdiff=$(($now-$last_change))
# NOT ACCESSED TIMEOUT EXCEEDED
# do nothing, let the built in hd timer put the drive to sleep
if [ "$reads" = "$last_reads" -a $tdiff -ge $timeout ];then
:
# NOT ACCESSED NOT TIMED OUT
# keep the drive spinning
elif [ "$reads" = "$last_reads" -a $tdiff -lt $timeout ];then
dd if=/dev/sda bs=512 count=1 of=/dev/null iflag=direct &> /dev/null
# ACCESSED
# drive was accessed so update last_reads last_change
# shouldn't need to keep it spinning, but just in case read something
elif [ "$reads" != "$last_reads" ];then
last_change=$now
last_reads=$reads
dd if=/dev/sda bs=512 count=1 of=/dev/null iflag=direct &> /dev/null
fi
done
I run the code as root and have added it to crontab. The code is stable if the drive is mounted or not.
The drive is primarily a document/photo archive. So I only look at reads to determine if there was activity.
I originally tried "hdparm -C /dev/sda" to keep it spinning, but for some reason that would only keep it going for 20 minutes. I have no idea why it only worked for 20 minutes.
I then tried "fdisk -l /dev/sda". That didn't work at all.
I'd like to find a command or ioctl that would keep it spinning without having to use the read/write heads. But I guess it's not that big of a deal.
The drive is still connected externally via a USB to SATA adapter. I have not tried connecting the HD to an actual SATA port and using hdparm commands.
Let me know if you see any improvements in either the command to keep it spinning or the script in general.
|
|
|
06-25-2023, 03:49 AM
|
#3
|
Member
Registered: Jan 2010
Location: Minnesota, USA
Distribution: Slackware 13.37, 14.2, 15.0
Posts: 698
Rep: 
|
You seem to be looking in the right places.
I noticed that the smartctl says that the drive is in "power-saving mode".
I think there is more than one place where drives can be spun down after a timeout.
One is in hdparm.
Trying to find the other in settings. Cannot find it.
There may be some behaviors built-in to the USB adaptor, especially about limiting power usage.
Would have to try it connected to SATA, or read a review (do not expect them to tell you in any shipped manual).
I would do hdparm from root, as I do not trust sudo much.
This is a WD drive.
There is one setting unique to a "Green drive"
If this is your only drive then use /dev/sda,
otherwise look in dmesg to find the actual dev identifier.
There might be other info there when this drive is plugged in.
>> dmesg | tail
>> hdparm -J /dev/sda
Ideally it should not accept this command.
If it does output something, then read the man page for hdparm.
You will need a special utility from Western Digital to change that timeout value.
|
|
|
All times are GMT -5. The time now is 07:09 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|