Recent

Author Topic: S.M.A.R.T.: How to read?  (Read 1583 times)

Milsa

  • Full Member
  • ***
  • Posts: 242
S.M.A.R.T.: How to read?
« on: January 06, 2021, 06:35:18 pm »
I can't find anything about this.
I work with Lazarus 2.0.10, FPC 3.2.0, SVN 63526
This information is actual to: 1st Aug 2020

MarkMLl

  • Hero Member
  • *****
  • Posts: 2065
Re: S.M.A.R.T.: How to read?
« Reply #1 on: January 06, 2021, 06:54:38 pm »
And you won't find it here if you don't tell people what OS etc. you're using.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

Blaazen

  • Hero Member
  • *****
  • Posts: 3028
  • POKE 54296,15
    • Eye-Candy Controls
Re: S.M.A.R.T.: How to read?
« Reply #2 on: January 06, 2021, 06:58:29 pm »
Linux:
Code: Pascal  [Select][+][-]
  1. $ sudo smartctl -a /dev/sda
Lazarus 2.1.0 r64546 FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Milsa

  • Full Member
  • ***
  • Posts: 242
Re: S.M.A.R.T.: How to read?
« Reply #3 on: January 06, 2021, 10:01:32 pm »
And you won't find it here if you don't tell people what OS etc. you're using.

MarkMLl
Windows and Linux.
I work with Lazarus 2.0.10, FPC 3.2.0, SVN 63526
This information is actual to: 1st Aug 2020

Milsa

  • Full Member
  • ***
  • Posts: 242
Re: S.M.A.R.T.: How to read?
« Reply #4 on: January 06, 2021, 10:02:38 pm »
Linux:
Code: Pascal  [Select][+][-]
  1. $ sudo smartctl -a /dev/sda
In "Programming > General"? ;-)
I work with Lazarus 2.0.10, FPC 3.2.0, SVN 63526
This information is actual to: 1st Aug 2020

MarkMLl

  • Hero Member
  • *****
  • Posts: 2065
Re: S.M.A.R.T.: How to read?
« Reply #5 on: January 06, 2021, 10:45:56 pm »
Linux:
Code: Pascal  [Select][+][-]
  1. $ sudo smartctl -a /dev/sda
In "Programming > General"? ;-)

I think you mean "please explain how that helps me get it under program control."

The canonical answer would be that the source of that utility will be available, and in practice it is likely to be a thin wrapper around something in /proc or /sys. However you might also find that it interfaces to the /dev/sda "device driver" (i.e. in the current context a kernel module) via an ioctl call, and my experience with these is that you can find yourself in very deep water due to data structure packing peculiarities etc.

Poking around on Debian suggests that the libatasmart4 package is relevant, but I've not gone any deeper looking at the API. My suggestion would be at least to start off with a "quick and dirty" solution parsing the output of some of the dedicated utilities, particularly since some of them appear to be oriented towards Munin etc. so are designed for that sort of thing.

Sorry I can't help on Windows, haven't really touched it for decades.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

Milsa

  • Full Member
  • ***
  • Posts: 242
Re: S.M.A.R.T.: How to read?
« Reply #6 on: January 07, 2021, 12:32:59 am »
Thank you for your answer. Excuse me my previous answer. I did not want to offend you. I just wasn't sure we understood.

I thought there was a library for SMART for Lazarus. I used to find something for Delphi, but now I can't find it. I suspect something was still missing in that code.
I work with Lazarus 2.0.10, FPC 3.2.0, SVN 63526
This information is actual to: 1st Aug 2020

Milsa

  • Full Member
  • ***
  • Posts: 242
Re: S.M.A.R.T.: How to read?
« Reply #7 on: January 07, 2021, 12:35:51 am »
I found it now!
https://www.delphipraxis.net/97172-s-m-r-t-figured-out.html

I couldn't run this code. I'll try again.
I work with Lazarus 2.0.10, FPC 3.2.0, SVN 63526
This information is actual to: 1st Aug 2020

speter

  • Full Member
  • ***
  • Posts: 160
Re: S.M.A.R.T.: How to read?
« Reply #8 on: January 07, 2021, 05:10:40 am »
Milsa, two comments about the code you have linked:
 (1) it is from 2007; and so might be totally out of date; and
 (2) do you have code for the "smart_drv" unit (which is in the uses statement)? I am guessing, but if you don't have it, it might be a dead-end....

I found it now!
https://www.delphipraxis.net/97172-s-m-r-t-figured-out.html

I couldn't run this code. I'll try again.

cheers
S.

EDIT: the code for the smart_drv unit is included on the page. :)
« Last Edit: January 07, 2021, 05:14:58 am by speter »
I climbed mighty mountains, and saw that they were actually tiny foothills. :)

Laz 2.0.10 / FPC 3.2.0 / Windows 10 (64bit)

Milsa

  • Full Member
  • ***
  • Posts: 242
Re: S.M.A.R.T.: How to read?
« Reply #9 on: January 17, 2021, 08:27:13 pm »
My link is usable only for IDE drives. I have SATA and MVME drives. Does exists any code for SATA or MVME drives?
I work with Lazarus 2.0.10, FPC 3.2.0, SVN 63526
This information is actual to: 1st Aug 2020

MarkMLl

  • Hero Member
  • *****
  • Posts: 2065
Re: S.M.A.R.T.: How to read?
« Reply #10 on: January 17, 2021, 09:31:08 pm »
Does the utility that Blaazen pointed you at work? This might vary depending on which driver (kernel module) is being used... I'm really not up to date on the possibilities.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

JernejL

  • Jr. Member
  • **
  • Posts: 91
Re: S.M.A.R.T.: How to read?
« Reply #11 on: January 18, 2021, 10:54:37 am »
On windows, query it from WMI.
 
« Last Edit: January 19, 2021, 02:34:46 pm by JernejL »

 

TinyPortal © 2005-2018