feat: read out less (unnecessary) SMART data

This commit is contained in:
Daniel Langbein 2023-08-09 11:41:23 +02:00
parent 136c99d2ba
commit 70e2a16038

View File

@ -96,7 +96,13 @@ class DriveLogger(Logger):
:param device: For example `/dev/sda` or `/dev/disk/by-uuid/<uuid>`
:return: Temperature in celsius
"""
returncode, stdout, stderr = execute_capture(['smartctl', '-j', '-a', f'{device}'])
# -j: JSON output.
# -a: Print all SMART device information.
# For NVMe, this is equivalent to: '-H -i -c -A -l error -l selftest'.
# -H: Print health status.
# -A: Prints only the vendor specific SMART Attributes.
returncode, stdout, stderr = execute_capture(['smartctl', '-j', '-A', f'{device}'])
if returncode != 0:
raise LoggerReadEx(f'smartctl failed with returncode {returncode}\nstdout: {stdout}\nstderr: {stderr}')