You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking for a solution for a situation when I'm checking the state of a hard disk in STANDBY mode (it spun down) and I don't want to wake it up. The typical smartctl output is the following:
$ sudo smartctl -n standby --all /dev/sda
smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.5.0-0.deb12.4-amd64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org
Device is in STANDBY mode, exit(2)
When I use pySMART in this context I got the following output:
Python 3.12.2 (main, Feb 17 2024, 07:08:59) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pySMART import *
>>> SMARTCTL.sudo=True
>>> SMARTCTL.options=["-n", "standby"]
>>> SMARTCTL.smartctl_path="/usr/sbin/smartctl"
>>> d=Device("sda")
>>> d
<SAT device on /dev/sda mod:None sn:None>
How can I detect in Device() class if the HDD is in STANDBY mode and the rest of the class is empty? In my mind one or more of the following suggestions would help:
a new data member in Device() class (e.g. powerState) which can inform the user that the rest of the class is not initialized
access to the raw output of the latest smartctl command
access to the return code of the latest smartctl command
Any recommendation for this?
Thanks in advance.
Peter
The text was updated successfully, but these errors were encountered:
As a temporary workaround I use this code to detect STANDBY state of a HDD:
...
rv.standby_mode = False
SMARTCTL.options = []
SMARTCTL.smartctl_path = smartctl_path
# If sudo command should be used
if sudo:
SMARTCTL.sudo = True
else:
SMARTCTL.sudo = False
# If no check should be applied in standby power mode of an HDD
if nocheck:
SMARTCTL.add_options(["-n", "standby"])
# Check if `smartctl` can be executed.
output = SMARTCTL.info(self.__path)
if not output:
return None
# Check if the disk is in STANDBY mode
if "Device is in STANDBY mode" in output[3]:
rv.standby_mode = True
return rv
# Get SMART data from pySMART.
sd = Device(self.__path)
...
Please confirm this approach or suggest a better one. Thanks.
Hi,
I'm looking for a solution for a situation when I'm checking the state of a hard disk in STANDBY mode (it spun down) and I don't want to wake it up. The typical
smartctl
output is the following:When I use pySMART in this context I got the following output:
How can I detect in
Device()
class if the HDD is in STANDBY mode and the rest of the class is empty? In my mind one or more of the following suggestions would help:powerState
) which can inform the user that the rest of the class is not initializedsmartctl
commandsmartctl
commandAny recommendation for this?
Thanks in advance.
Peter
The text was updated successfully, but these errors were encountered: