Skip to content

Add disk type information #2857

Closed
Closed

Description

@PavelTurk

There are different types of disks - optical, hard disks, floppy, sd card, flash, network etc. I suggest to add this information for disks.

Activity

  1. dbwiddis commented on Mar 29, 2025

    @dbwiddis
    Member

    This is generally available using the OSFileStore class with either getName(), getDescription(), or you can sometimes infer things from getType(). Here's the output for Windows, for example (from the latest CI run):

    File System:
       File Descriptors: 39889/16711680
       3 1/2 Inch Floppy Drive (A:) (Removable drive) [] 0 bytes of 0 bytes free (NaN%), 0 of 0 files free (NaN%) is \\?Voolume{6bae4c43-08f7-11f0-9f62-806e6f6e6963}\  and is mounted at A:\
       Local Fixed Disk (C:) (Fixed drive) [NTFS] 79.6 GiB of 255.5 GiB free (31.1%), 0 of 0 files free (NaN%) is \\?\Volume{5340b4dc-0000-0000-0000-501f00000000}\  and is mounted at C:\
       Local Fixed Disk (D:) (Fixed drive) [NTFS] 147.0 GiB of 150.0 GiB free (98.0%), 0 of 0 files free (NaN%) is \\?\Volume{3230d594-0000-0000-0000-100000000000}\  and is mounted at D:\
    

    You'd have to correlate the filesystem to the hardware to match it up. See example here.

    See also #146.

  2. PavelTurk commented on Mar 29, 2025

    @PavelTurk
    Author

    @dbwiddis When creating this issue, I was specifically trying to avoid any kind of parsing to determine the disk type. What I meant is an enum with predefined disk types, so that each user wouldn't have to reinvent the wheel, but simply select icons for the existing disk types.

  3. dbwiddis commented on Mar 29, 2025

    @dbwiddis
    Member

    When creating this issue, I was specifically trying to avoid any kind of parsing to determine the disk type.

    Fair enough, but operating systems don't provide this information in any standard format other than name or description. Here's what the OS provides on Windows, for example, which goes into "type":

    private static String getDriveType(String drive) {
    switch (Kernel32.INSTANCE.GetDriveType(drive)) {
    case 2:
    return "Removable drive";
    case 3:
    return "Fixed drive";
    case 4:
    return "Network drive";
    case 5:
    return "CD-ROM";
    case 6:
    return "RAM drive";
    default:
    return "Unknown drive type";
    }
    }

    I could tell you it's a "removable drive" with that type "2", but not whether it's a floppy or thumb drive, without the name or description. And that's Windows-only, not cross-platform.

    You might consider just using Java's FileSystemView class.
    FileSystemView.getFileSystemView().isFloppyDrive() can tell you if you have a floppy drive, for example. isComputerNode() probably identifies a network drive, etc.

    I'm happy to consider adding something to the OSHI API if you can tell me where I can get the information cross-platform other than in the name or description.

  4. PavelTurk commented on Mar 29, 2025

    @PavelTurk
    Author

    @dbwiddis Thank you for your suggestion. I am already using

    FileSystemView.getFileSystemView().isFloppyDrive()
    

    to check if a disk is a floppy. To check if it is a network drive, I use the output of (windows):

    Process process = new ProcessBuilder("cmd", "/c", "net use").start();
    

    To check for an optical disk, I use the following code:

    String storeType = store.type().toUpperCase();
    if (storeType.equals("CDFS") || storeType.equals("UDF") || storeType.equals("ISO9660") || storeType.equals("JOLIET")) {
        return true;
    }
    

    This is all I found I can do in Java to check if the disk is optical, floppy, or a network drive.

    At the same time, I thought that by using native code, it would be possible to determine the type of any disk on all platforms. If that's not possible, it would be very sad.

  5. dbwiddis commented on Mar 29, 2025

    @dbwiddis
    Member

    To check if it is a network drive, I use the output of (windows):

    Process process = new ProcessBuilder("cmd", "/c", "net use").start();
    

    At the same time, I thought that by using native code, it would be possible to determine the type of any disk on all platforms. If that's not possible, it would be very sad.

    It is possible using native code on Windows: see the snippet above using Kernel32.INSTANCE.GetDriveType(). This is a native function mapped on JNA which, as a dependency, is available to you to use, if you know you're on Windows. Here are the return values.

    Other than Windows, however, this information is difficult to get. While we try to use native methods (such as udev) to collect information we're still limited to strings describing the disk, or device paths.

    On macOS, we use a regex to match the volume name (/dev/disk for local disk, localhost: or smb: for network, etc., for example). I don't know of any other way.

    On Linux, and Unix we do a similar match of /dev in the volume, parse the volume name, or match filesystem types. I don't know of any other way.

    Compared to the individual parsing on all the *nix systems, OSHI at least standardizes the types in the "Description" which has a more limited set of Strings you can try to match (and matches them to the Windows output as well). I honestly think that, or the FileSystemView methods, are the best you can do cross-platform.

    If you think you can improve OSHI's parsing (such as using /dev/fd for floppies) feel free to submit a PR; I do not consider floppy disks a high priority. I think the FileSystemView methods are sufficient for the overwhelming majority of real world use cases.

  6. dbwiddis commented on Apr 15, 2025

    @dbwiddis
    Member

    I'm going to close this issue as I think I've outlined the options. Other than the OSHI API which does its best to use standardized cross-platform strings (for easier parsing) you can directly use the native call on Windows using the already-included JNA dependency, or the FileSystemView methods in Java. Beyond that, parsing strings is really the only option.

  7. dbwiddis commented on May 3, 2026

    @dbwiddis
    Member

    Revisiting this idea. While a fully cross-platform disk type enum may not be feasible, we could expose what the OS does provide:

    Linux: /sys/block/<device>/queue/rotational reliably distinguishes SSD (0) vs HDD (1). This is what lsblk -d -o NAME,ROTA uses. Additionally, /sys/block/<device>/device/type provides SCSI device type codes, and the transport (/sys/block/<device>/device/transport) can identify NVMe, USB, etc.

    Windows: IOCTL_STORAGE_QUERY_PROPERTY with StorageDeviceProperty returns a STORAGE_DEVICE_DESCRIPTOR containing BusType (NVMe, SATA, USB, etc.) and RemovableMedia. WMI MSFT_PhysicalDisk has a MediaType field (0=Unspecified, 3=HDD, 4=SSD). Both are accessible via JNA/FFM.

    macOS: IOKit provides IOMedia properties including Whole, Removable, and the device characteristics dictionary which can indicate solid-state vs. rotational.

    Proposal

    Add to HWDiskStore:

    /**
     * Whether this disk is a solid-state drive (non-rotational media).
     * Returns true for SSDs and NVMe drives, false for HDDs,
     * or false if the information is unavailable.
     */
    boolean isSolidState();
    
    /**
     * Whether this disk uses removable media.
     */
    boolean isRemovable();

    These are simple booleans rather than an enum, avoiding the "what categories do we define" problem. They cover the most common use case (SSD vs HDD distinction for performance tuning and monitoring dashboards) and are implementable on Linux, Windows, and macOS.

    Returning false as a default when the information is unavailable is consistent with OSHI's existing pattern for optional hardware details.

  8. added
    new feature
    up for grabs
    on May 3, 2026
  9. coderabbitai commented on May 3, 2026

    @coderabbitai
    Contributor

    Coding Plan

    Summary

    • Introduce two boolean properties (solidState, removable) as orthogonal, independently-determinable characteristics rather than forcing a single enum categorization
    • Extend the immutable field pattern established by AbstractHWDiskStore and HWPartition, maintaining backward compatibility via constructor overloading with false defaults
    • Implement platform-specific detection: MSFT_PhysicalDisk/IOCTL_STORAGE_QUERY_PROPERTY for Windows, sysfs queue/rotational and removable for Linux, IOKit Solid State and Removable properties for macOS
    • Default to false for platforms or devices where properties cannot be determined, consistent with OSHI patterns
    Design Choices
    Design Choice 1: Boolean Properties vs Enum for Disk Type Classification

    Options Considered:

    1. Enum (DiskType) — Single field with values like HDD, SSD, OPTICAL, FLOPPY, NETWORK, UNKNOWN; forces categorization into exactly one type
    2. Two Booleans (solidState, removable) — Orthogonal properties that can be independently determined; avoids forced categorization; covers primary use cases

    Chosen Option: 2

    Rationale: Two boolean fields provide independent answers to the most common questions: "Is this an SSD or HDD?" and "Is this removable?" This avoids forcing devices into artificial categories (e.g., a removable SSD would need to be one or the other with an enum). Using false as the default is consistent with OSHI patterns for unknown/unsupported values, and booleans are simpler to extend if additional properties are needed in the future.

    💡 User Tips

    Regenerate the plan with different choices with @coderabbitai <feedback>.

    Implementation Steps

    Phase 1: API and Core Infrastructure

    Extend the public API and base classes to support the two new boolean properties. This establishes the contract that all platform implementations will fulfill.

    Task 1: Extend HWDiskStore Interface

    Add the two new boolean methods to the public disk store interface.

    • Add boolean isSolidState(); method to HWDiskStore.java in oshi-common
    • Add boolean isRemovable(); method to HWDiskStore.java in oshi-common
    • Add Javadoc: isSolidState() returns true for solid-state storage (SSD, NVMe, flash), false for rotational (HDD) or if unknown
    • Add Javadoc: isRemovable() returns true for removable media (USB drives, SD cards, optical), false otherwise or if unknown
    Task 2: Extend AbstractHWDiskStore Base Class

    Add the two booleans as immutable fields in the base abstract class, following the established pattern.

    • Add private final boolean solidState; field to AbstractHWDiskStore.java
    • Add private final boolean removable; field to AbstractHWDiskStore.java
    • Create new 6-parameter constructor: (String name, String model, String serial, long size, boolean solidState, boolean removable)
    • Modify existing 4-parameter constructor to delegate to new constructor with false, false as defaults
    • Add @Override public boolean isSolidState() getter
    • Add @Override public boolean isRemovable() getter
    • Update toString() to include solidState and removable values
    Task 3: Update Intermediate Common Classes

    Extend the constructor chains in the platform-specific common base classes to accept and pass through both boolean properties.

    • Update WindowsHWDiskStore.java in oshi-common: add 6-param constructor calling super(..., solidState, removable), keep 4-param delegating with false, false
    • Update LinuxHWDiskStore.java in oshi-common: same pattern
    • Update MacHWDiskStore.java in oshi-common: same pattern
    🤖 Prompt for AI agents
    This phase wires the two new boolean properties (`solidState`, `removable`)
    through the public API and base class hierarchy — great first step, and a really
    important foundation for everything that follows!
    
    - **Update `HWDiskStore.java`** in oshi-common:
      - Add method declaration: `boolean isSolidState();`
      - Add method declaration: `boolean isRemovable();`
    - Add Javadoc for `isSolidState()`: returns true for solid-state storage (SSD,
    NVMe, flash), false for rotational (HDD) or if unknown
    - Add Javadoc for `isRemovable()`: returns true for removable media (USB drives,
    SD cards, optical), false otherwise or if unknown
    
    - **Update `AbstractHWDiskStore.java`**:
      - Add `private final boolean solidState;` field
      - Add `private final boolean removable;` field
    - Add new 6-parameter constructor: `(String name, String model, String serial,
    long size, boolean solidState, boolean removable)`
    - Update existing 4-parameter constructor to delegate to the new constructor
    with `false, false` as defaults
      - Add `@Override public boolean isSolidState()` getter returning the field
      - Add `@Override public boolean isRemovable()` getter returning the field
      - Update `toString()` to include solidState and removable values
    
    - **Update intermediate common classes** (`WindowsHWDiskStore.java`,
    `LinuxHWDiskStore.java`, `MacHWDiskStore.java` in oshi-common):
    - For each: add a 6-param constructor that calls `super(..., solidState,
    removable)`
    - Keep the existing 4-param constructor delegating to the new one with `false,
    false`
    

    Phase 2: Major Platform Detection Implementation

    Implement detection for the three major platforms (Windows, Linux, macOS) where reliable detection mechanisms exist.

    Task 1: Windows Disk Type Detection

    Implement solid-state and removable detection using WMI and storage device properties.

    • For solid-state detection: Query MSFT_PhysicalDisk WMI class MediaType property (value 4 = SSD, value 3 = HDD) via a new driver in oshi-common/src/main/java/oshi/driver/common/windows/wmi/
    • Alternatively, use IOCTL_STORAGE_QUERY_PROPERTY with StorageDeviceSeekPenaltyProperty — no seek penalty indicates SSD
    • For removable detection: Query Win32_DiskDrive MediaType property containing "Removable" or use STORAGE_DEVICE_DESCRIPTOR.RemovableMedia field
    • Update WindowsHWDiskStoreJNA.java in oshi-core to query both properties and pass booleans to constructor
    • Update WindowsHWDiskStoreFFM.java in oshi-core-ffm with equivalent logic
    Task 2: Linux Disk Type Detection

    Implement solid-state and removable detection using sysfs and udev properties.

    • Add constant ROTATIONAL = "queue/rotational" to LinuxHWDiskStore.java for sysfs attribute path
    • Add constant REMOVABLE = "removable" for sysfs attribute
    • Update LinuxHWDiskStoreJNA.java in oshi-core:
      • Read /sys/block/<device>/queue/rotational via device.getSysattrValue("queue/rotational") — value "0" = solidState true, "1" = solidState false
      • Read /sys/block/<device>/removable via device.getSysattrValue("removable") — value "1" = removable true
      • For LVM/DM devices: default both to false (underlying device type not easily accessible)
    • Update LinuxHWDiskStoreFFM.java in oshi-core-ffm with equivalent logic
    Task 3: macOS Disk Type Detection

    Implement solid-state and removable detection using IOKit properties.

    • Add SOLID_STATE("Solid State") to CFKey enum in MacHWDiskStore.java
    • Add REMOVABLE("Removable") to CFKey enum in MacHWDiskStore.java
    • Update MacHWDiskStoreJNA.java in oshi-core:
      • Query IOKit IOMedia or parent IOBlockStorageDevice for "Solid State" boolean property → solidState
      • Query IOKit IOMedia for "Removable" boolean property → removable
    • Update MacHWDiskStoreFFM.java in oshi-core-ffm with equivalent logic
    🤖 Prompt for AI agents
    This phase implements the actual disk type detection for Windows, Linux, and
    macOS — the three platforms where reliable detection mechanisms exist. Each
    platform has its own detection strategy, and both booleans (`solidState`,
    `removable`) need to be populated.
    
    **Windows** (`WindowsHWDiskStoreJNA.java` in oshi-core,
    `WindowsHWDiskStoreFFM.java` in oshi-core-ffm):
    - For solid-state detection: Add a new WMI driver in
    `oshi-common/src/main/java/oshi/driver/common/windows/wmi/` to query the
    `MSFT_PhysicalDisk` WMI class `MediaType` property:
      - Value 4 → solidState = true (SSD)
      - Value 3 → solidState = false (HDD)
    - Alternatively, use `IOCTL_STORAGE_QUERY_PROPERTY` with
    `StorageDeviceSeekPenaltyProperty` — no seek penalty indicates SSD
    - For removable detection: Query `Win32_DiskDrive` `MediaType` property for
    "Removable", or use `STORAGE_DEVICE_DESCRIPTOR.RemovableMedia` field
    - Pass both booleans to the 6-param constructor
    - Apply equivalent logic in both JNA and FFM implementations
    
    **Linux** (`LinuxHWDiskStoreJNA.java` in oshi-core, `LinuxHWDiskStoreFFM.java`
    in oshi-core-ffm):
    - Add constants to `LinuxHWDiskStore.java`: `ROTATIONAL = "queue/rotational"`
    and `REMOVABLE = "removable"`
    - Read `/sys/block/<device>/queue/rotational` via
    `device.getSysattrValue("queue/rotational")`:
      - `"0"` → solidState = true
      - `"1"` → solidState = false
    - Read `/sys/block/<device>/removable` via
    `device.getSysattrValue("removable")`:
      - `"1"` → removable = true
    - For LVM/DM devices: default both to false (underlying device type not easily
    accessible)
    - Apply equivalent logic in both JNA and FFM implementations
    
    **macOS** (`MacHWDiskStoreJNA.java` in oshi-core, `MacHWDiskStoreFFM.java` in
    oshi-core-ffm):
    - Add `SOLID_STATE("Solid State")` to the `CFKey` enum in `MacHWDiskStore.java`
    - Add `REMOVABLE("Removable")` to the `CFKey` enum in `MacHWDiskStore.java`
    - Query IOKit `IOMedia` or parent `IOBlockStorageDevice` for the `"Solid State"`
    boolean property → solidState
    - Query IOKit `IOMedia` for the `"Removable"` boolean property → removable
    - Apply equivalent logic in both JNA and FFM implementations
    

    Phase 3: Unix Platform Implementations

    Update the remaining Unix platform implementations to support the new fields, defaulting to false where detection is not straightforward.

    Task 1: FreeBSD Disk Type Support

    Update FreeBSD implementation with basic detection or false defaults.

    • Update FreeBsdHWDiskStore.java in oshi-core to call the 6-param super constructor
    • Check if GEOM provides rotational info via geom disk list output; if "rotationrate: 0" → solidState true, if > 0 → solidState false
    • Default removable to false (can be enhanced in future)
    • Default both to false if not determinable
    Task 2: OpenBSD Disk Type Support

    Update OpenBSD implementation with false defaults.

    • Update OpenBsdHWDiskStore.java in oshi-core to call the 6-param super constructor with false, false
    • Limited detection available; can be enhanced in future PRs
    Task 3: Solaris Disk Type Support

    Update Solaris implementation with false defaults.

    • Update SolarisHWDiskStore.java in oshi-core to call the 6-param super constructor with false, false
    • Detection can be added in future enhancement if iostat -En provides reliable hints
    Task 4: AIX Disk Type Support

    Update AIX implementation with false defaults.

    • Update AixHWDiskStore.java in oshi-core to call the 6-param super constructor with false, false
    • perfstat_disk_t type field could be mapped in future enhancement
    🤖 Prompt for AI agents
    This phase updates the remaining Unix platform implementations (FreeBSD,
    OpenBSD, Solaris, AIX) to support the new `solidState` and `removable` fields.
    Most will default to `false`, with basic detection where it's feasible — every
    platform contributing something is a wonderful step forward, and these can
    always be improved in follow-up contributions!
    
    **FreeBSD** (`FreeBsdHWDiskStore.java` in oshi-core):
    - Update to call the 6-param super constructor
    - Attempt to parse GEOM output from `geom disk list`:
      - `"rotationrate: 0"` → solidState = true
      - rotation rate > 0 → solidState = false
    - Default removable to false (can be enhanced in future)
    - Default both to false if not determinable
    
    **OpenBSD** (`OpenBsdHWDiskStore.java` in oshi-core):
    - Update to call the 6-param super constructor passing `false, false`
    - No additional detection logic at this time (can be enhanced in future PRs)
    
    **Solaris** (`SolarisHWDiskStore.java` in oshi-core):
    - Update to call the 6-param super constructor passing `false, false`
    - No additional detection logic at this time (`iostat -En` parsing can be added
    in a future enhancement)
    
    **AIX** (`AixHWDiskStore.java` in oshi-core):
    - Update to call the 6-param super constructor passing `false, false`
    - No additional detection logic at this time (`perfstat_disk_t` type field
    mapping can be added in a future enhancement)
    

    Phase 4: Testing and Documentation

    Validate the new functionality and ensure documentation is updated.

    Task 1: Update Disk Store Tests

    Add test coverage for the new boolean properties.

    • Update DisksTest.java in oshi-core test directory
    • Add assertion: assertThat(disk.isSolidState(), is(notNullValue())) (boolean is never null, but validates method exists)
    • Add assertion: assertThat(disk.isRemovable(), is(notNullValue()))
    • Verify toString() output includes solidState and removable values
    Task 2: Update Changelog

    Document the new feature in the changelog.

    • Add entry to CHANGELOG.md under the appropriate version section
    • Note the new isSolidState() and isRemovable() methods on HWDiskStore
    🤖 Prompt for AI agents
    This phase adds test coverage and updates the changelog — a wonderful way to
    wrap things up and make sure everything is well-documented for future
    contributors!
    
    **Update `DisksTest.java`** in the oshi-core test directory:
    - Add assertion: `assertThat(disk.isSolidState(), is(notNullValue()))` to verify
    the method exists and is always populated (boolean is never null)
    - Add assertion: `assertThat(disk.isRemovable(), is(notNullValue()))` for the
    same reason
    - Verify that the `toString()` output includes the solidState and removable
    values
    
    **Update `CHANGELOG.md`**:
    - Add an entry under the appropriate version section
    - Note the addition of the new `isSolidState()` and `isRemovable()` methods on
    `HWDiskStore`
    
    Research

    OSHI has a clean three-tier architecture for disk stores: the HWDiskStore interface (oshi-common), AbstractHWDiskStore abstract base class holding immutable identity fields (oshi-common), platform-specific intermediate common classes for Windows/Linux/macOS (oshi-common), and concrete JNA implementations (oshi-core) plus FFM implementations (oshi-core-ffm). Unix platforms (FreeBSD, OpenBSD, Solaris, AIX) extend AbstractHWDiskStore directly. The established pattern for adding immutable fields—demonstrated by HWPartition.label—involves adding a new constructor parameter while maintaining a backward-compatible overload that delegates with a default value.


    🚀 Next Steps

    🤖 All AI agent prompts combined
    Task: 1
    
    This phase wires the two new boolean properties (`solidState`, `removable`)
    through the public API and base class hierarchy — great first step, and a really
    important foundation for everything that follows!
    
    - **Update `HWDiskStore.java`** in oshi-common:
      - Add method declaration: `boolean isSolidState();`
      - Add method declaration: `boolean isRemovable();`
    - Add Javadoc for `isSolidState()`: returns true for solid-state storage (SSD,
    NVMe, flash), false for rotational (HDD) or if unknown
    - Add Javadoc for `isRemovable()`: returns true for removable media (USB drives,
    SD cards, optical), false otherwise or if unknown
    
    - **Update `AbstractHWDiskStore.java`**:
      - Add `private final boolean solidState;` field
      - Add `private final boolean removable;` field
    - Add new 6-parameter constructor: `(String name, String model, String serial,
    long size, boolean solidState, boolean removable)`
    - Update existing 4-parameter constructor to delegate to the new constructor
    with `false, false` as defaults
      - Add `@Override public boolean isSolidState()` getter returning the field
      - Add `@Override public boolean isRemovable()` getter returning the field
      - Update `toString()` to include solidState and removable values
    
    - **Update intermediate common classes** (`WindowsHWDiskStore.java`,
    `LinuxHWDiskStore.java`, `MacHWDiskStore.java` in oshi-common):
    - For each: add a 6-param constructor that calls `super(..., solidState,
    removable)`
    - Keep the existing 4-param constructor delegating to the new one with `false,
    false`
    ===============================================================================
    
    Task: 2
    
    This phase implements the actual disk type detection for Windows, Linux, and
    macOS — the three platforms where reliable detection mechanisms exist. Each
    platform has its own detection strategy, and both booleans (`solidState`,
    `removable`) need to be populated.
    
    **Windows** (`WindowsHWDiskStoreJNA.java` in oshi-core,
    `WindowsHWDiskStoreFFM.java` in oshi-core-ffm):
    - For solid-state detection: Add a new WMI driver in
    `oshi-common/src/main/java/oshi/driver/common/windows/wmi/` to query the
    `MSFT_PhysicalDisk` WMI class `MediaType` property:
      - Value 4 → solidState = true (SSD)
      - Value 3 → solidState = false (HDD)
    - Alternatively, use `IOCTL_STORAGE_QUERY_PROPERTY` with
    `StorageDeviceSeekPenaltyProperty` — no seek penalty indicates SSD
    - For removable detection: Query `Win32_DiskDrive` `MediaType` property for
    "Removable", or use `STORAGE_DEVICE_DESCRIPTOR.RemovableMedia` field
    - Pass both booleans to the 6-param constructor
    - Apply equivalent logic in both JNA and FFM implementations
    
    **Linux** (`LinuxHWDiskStoreJNA.java` in oshi-core, `LinuxHWDiskStoreFFM.java`
    in oshi-core-ffm):
    - Add constants to `LinuxHWDiskStore.java`: `ROTATIONAL = "queue/rotational"`
    and `REMOVABLE = "removable"`
    - Read `/sys/block/<device>/queue/rotational` via
    `device.getSysattrValue("queue/rotational")`:
      - `"0"` → solidState = true
      - `"1"` → solidState = false
    - Read `/sys/block/<device>/removable` via
    `device.getSysattrValue("removable")`:
      - `"1"` → removable = true
    - For LVM/DM devices: default both to false (underlying device type not easily
    accessible)
    - Apply equivalent logic in both JNA and FFM implementations
    
    **macOS** (`MacHWDiskStoreJNA.java` in oshi-core, `MacHWDiskStoreFFM.java` in
    oshi-core-ffm):
    - Add `SOLID_STATE("Solid State")` to the `CFKey` enum in `MacHWDiskStore.java`
    - Add `REMOVABLE("Removable")` to the `CFKey` enum in `MacHWDiskStore.java`
    - Query IOKit `IOMedia` or parent `IOBlockStorageDevice` for the `"Solid State"`
    boolean property → solidState
    - Query IOKit `IOMedia` for the `"Removable"` boolean property → removable
    - Apply equivalent logic in both JNA and FFM implementations
    ===============================================================================
    
    Task: 3
    
    This phase updates the remaining Unix platform implementations (FreeBSD,
    OpenBSD, Solaris, AIX) to support the new `solidState` and `removable` fields.
    Most will default to `false`, with basic detection where it's feasible — every
    platform contributing something is a wonderful step forward, and these can
    always be improved in follow-up contributions!
    
    **FreeBSD** (`FreeBsdHWDiskStore.java` in oshi-core):
    - Update to call the 6-param super constructor
    - Attempt to parse GEOM output from `geom disk list`:
      - `"rotationrate: 0"` → solidState = true
      - rotation rate > 0 → solidState = false
    - Default removable to false (can be enhanced in future)
    - Default both to false if not determinable
    
    **OpenBSD** (`OpenBsdHWDiskStore.java` in oshi-core):
    - Update to call the 6-param super constructor passing `false, false`
    - No additional detection logic at this time (can be enhanced in future PRs)
    
    **Solaris** (`SolarisHWDiskStore.java` in oshi-core):
    - Update to call the 6-param super constructor passing `false, false`
    - No additional detection logic at this time (`iostat -En` parsing can be added
    in a future enhancement)
    
    **AIX** (`AixHWDiskStore.java` in oshi-core):
    - Update to call the 6-param super constructor passing `false, false`
    - No additional detection logic at this time (`perfstat_disk_t` type field
    mapping can be added in a future enhancement)
    ===============================================================================
    
    Task: 4
    
    This phase adds test coverage and updates the changelog — a wonderful way to
    wrap things up and make sure everything is well-documented for future
    contributors!
    
    **Update `DisksTest.java`** in the oshi-core test directory:
    - Add assertion: `assertThat(disk.isSolidState(), is(notNullValue()))` to verify
    the method exists and is always populated (boolean is never null)
    - Add assertion: `assertThat(disk.isRemovable(), is(notNullValue()))` for the
    same reason
    - Verify that the `toString()` output includes the solidState and removable
    values
    
    **Update `CHANGELOG.md`**:
    - Add an entry under the appropriate version section
    - Note the addition of the new `isSolidState()` and `isRemovable()` methods on
    `HWDiskStore`
    
    💡 Iterate on the plan with: @coderabbitai <feedback>
    Example Feedback
    - @coderabbitai You can skip phase 3. Add a simple unit test case for phase 2.
    - @coderabbitai For design choice 1 go ahead with option 3 and replan.
    

    💬 Have feedback or questions? Drop into our discord!

  10. dbwiddis commented on May 3, 2026

    @dbwiddis
    Member

    @coderabbitai You generated a plan based on the original proposal. As an alternative to enum, I suggested two new API methods returning booleans that provide the essential information in #2857 (comment). Please update your coding plan to reflect that proposal.

  11. coderabbitai commented on May 3, 2026

    @coderabbitai
    Contributor

    I've updated the plan above based on your feedback. Ready to proceed when you are!

  12. added a commit that references this issue on May 6, 2026
    7830542
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    new featureup for grabs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions