Opened 4 years ago
Closed 4 years ago
#1381 closed enhancement (fixed)
--nocheck standby is ignored if device does not support power check which causes spin up
Reported by: | Marc Gutt | Owned by: | Christian Franke |
---|---|---|---|
Priority: | minor | Milestone: | Release 7.3 |
Component: | smartctl | Version: | 7.1 |
Keywords: | Cc: |
Description
I connected an HDD through USB. The USB controller blocks some hdparm/ATA commands and by that the following:
smartctl -n standby -A /dev/sdg
returns:
CHECK POWER MODE: incomplete response, ATA output registers missing CHECK POWER MODE not implemented, ignoring -n option
I would prefer that it does not ignore the -n option in such a case to avoid HDD spin up (the reason why -n was used).
This caused a small bug in Unraid:
https://forums.unraid.net/bug-reports/stable-releases/683-usb-hdds-randomly-spin-up-but-status-stays-unchanged-r1091/
But I was able to solve it by changing the command to the "-i" option:
smartctl -n standby -i /dev/sdg
It returns the same "not implemented" error, but it does luckily not spin up the HDD.
Change History (6)
comment:1 by , 4 years ago
Component: | all → smartctl |
---|---|
Milestone: | → undecided |
comment:2 by , 4 years ago
I would prefer:
-n standby
-n standby-force
"force" adds the new "exit(5)" behaviour and would be the short form of "force nocheck even device does not support power check mode". Or "standby-skip" as a short form of "skip on errors".
comment:3 by , 4 years ago
Milestone: | undecided → Release 7.3 |
---|
comment:4 by , 4 years ago
Can I suggest the following solution
Use smartctl -n standby,- this will pass a negative value of the existing options i.e. -2 for standby.
Example
root@unraid:~# smartctl -n standby,2 /dev/sdb
smartctl 7.2 2020-12-15 r5131 [x86_64-linux-5.10.1-Unraid] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
CHECK POWER MODE: incomplete response, ATA output registers missing
CHECK POWER MODE not implemented, ignoring -n option
ATA device successfully opened
Use 'smartctl -a' (or '-x') to print SMART (and more) information
Proposed solution would return the following.
root@unraid:~# smartctl -n standby,- /dev/sdb
smartctl 7.2 2020-12-15 r5131 [x86_64-linux-4.19.107-Unraid] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
Device is in STANDBY mode, exit(2)
A value could be specified after the - to change the return value i.e. standby,-5 would result in exit(5)
if you think this is a viable solution I will look to create a patch?
comment:5 by , 4 years ago
Owner: | set to |
---|---|
Status: | new → accepted |
Thanks. Not needed for ATA because I will soon commit code for the -n POWERMODE[,STATUS1[,STATUS2]]
extension described above. This variant is IMO more flexible because it allows to specify a different exit status for each case (including 0
to interpret one or both cases as success).
Feel free to provide a related patch for SCSI later.
Long standing (14+ year old, see r2227) behavior should not be changed as others may rely on it.
We could possibly further enhance the option as
-n POWERMODE[,STATUS1[,STATUS2]]
.If
STATUS2
is specified and CHECK POWER MODE is not supported, exit immediately with this status.For example:
If device is in STANDBY mode, exit(3). If CHECK POWER MODE is not supported, exit(5). Otherwise proceed as usual.
PS: It depends on drive firmware, USB bridge and OS whether specific pass-through commands spin up the disk.
smartctl -i
may also spin up andsmartctl -A
may not.