Skip to content

Implement retrieval of SMART data for Windows #59

Description

@jamesmarkchan

Objective: Implement solution for Windows to retrieve SMART data using Java.

Deliverables:

  1. Java code for Windows that can access SMART data from an SSD and populate the SmartData and Benchmark objects.
  2. msi installer contains packaged version of smartctl 7.5 so user does not need to install their own version

Research Java Methods for Windows SMART Access:

  1. Executing smartctl (Recommended Cross-Platform Approach):
    • The most robust and cross-platform way to get SMART data in Java is to execute the smartctl command-line utility (from smartmontools) as an external process and parse its output.
    • java.lang.ProcessBuilder and Process classes are used to run external commands.
    • You'll need to parse the smartctl -a /dev/sdX output. This involves reading the InputStream from the Process and using string manipulation, regular expressions, or a custom parser to extract the attribute names and values.
    • User Responsibility: You'll need to inform users that smartmontools needs to be installed on their system. You could even provide an "install smartmontools" button/link in jDiskMark.

Implementation Steps:

  • Determine the drive path (e.g., \\.\PHYSICALDRIVE0).
  • Construct the smartctl command (e.g., smartctl -a /dev/sda for Linux-like paths, or smartctl -a /dev/pd0 for Windows physical drive paths, though smartctl often handles WMI paths automatically).
  • Execute the command using ProcessBuilder.
  • Read and parse the output.
  • Create and populate a SmartData object.
  • Set this SmartData object in the Benchmark instance

Metadata

Metadata

Labels

windowswindows environment

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions