Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support NVMe storage #4

Closed
3 of 4 tasks
ashaduri opened this issue Apr 23, 2021 · 33 comments
Closed
3 of 4 tasks

Support NVMe storage #4

ashaduri opened this issue Apr 23, 2021 · 33 comments
Assignees
Labels
enhancement New feature or request fixed The issue has been fixed

Comments

@ashaduri
Copy link
Owner

ashaduri commented Apr 23, 2021

This is a feature request to track NVMe support.

To fully support NVMe, the following criteria have to be met:

  • Better-than-experimental NVMe support in smartctl.
  • Full NVMe JSON output support in smartctl.
  • JSON input support in GSmartControl.
  • NVMe support in GSmartControl GUI, as NVMe information differs significantly from (S)ATA.

Any help is appreciated.

@Etaash-mathamsetty
Copy link

yes please add nvme support I have to use a proprietary application otherwise

@pnevmoslon
Copy link

There is https://github.com/linux-nvme/nvme-cli and it works well for my Samsung 960 EVO 250GB. Perhaps it is worth adding it as a backend to GSmartControl?

@ashaduri
Copy link
Owner Author

There is https://github.com/linux-nvme/nvme-cli and it works well for my Samsung 960 EVO 250GB. Perhaps it is worth adding it as a backend to GSmartControl?

Hi,
Is there any added benefit of using nvme-cli instead of smartctl?
It would be a lot easier to support smartctl's NVME as GSmartControl is transitioning to JSON support for (S)ATA as well.

@pnevmoslon
Copy link

There is https://github.com/linux-nvme/nvme-cli and it works well for my Samsung 960 EVO 250GB. Perhaps it is worth adding it as a backend to GSmartControl?

Sorry, I had an old version of smartmontools installed and I was sure that it did not work with NVME. Of course, there is no point in adding nvme-cli, the latest version of smartmontools works well.

@hamishmb
Copy link

Oh yeah, I reported this last year. IIRC the issue is that smartctl outputs the information differently for NVME disks for some reason.

smartctl_output.txt

Attached is my nvme smartctl output for posterity.

@ssnjimb
Copy link

ssnjimb commented Jun 29, 2022

I have a BC711 NVMe SK hynix 256GB (Dell 3511) and it shows as unknown model :-(

@hamishmb
Copy link

In smartctl?

@ssnjimb
Copy link

ssnjimb commented Jun 29, 2022

Yes version 1.1.4

@hamishmb
Copy link

Hmm, do you mean the GUI, GSmartControl?

The smartctl on my Linux Mint 20.3 (Ubuntu 20.04 LTS) install says it's version 7.1, so 1.1.4 would be very very old.

It is known that GSmartControl doesn't support NVME yet (hence the bug), but if this is a bug in smartctl it might be quite interesting. Run "smartctl -a <your_device>" to see what smartctl thinks.

@1ucay
Copy link

1ucay commented Nov 25, 2022

Release 7.3 - https://github.com/smartmontools/smartmontools/releases

C:\Program Files\GSmartControl>smartctl.exe -j --all /dev/sda
{
  "json_format_version": [
    1,
    0
  ],
  "smartctl": {
    "version": [
      7,
      3
    ],
    "svn_revision": "5338",
    "platform_info": "x86_64-w64-mingw32-w11-b25247",
    "build_info": "(sf-7.3-1)",
    "argv": [
      "smartctl",
      "-j",
      "--all",
      "/dev/sda"
    ],
    "exit_status": 0
  },
  "local_time": {
    "time_t": 1669414621,
    "asctime": "Fri Nov 25 23:17:01 2022 SE"
  },
  "device": {
    "name": "/dev/sda",
    "info_name": "/dev/sda",
    "type": "nvme",
    "protocol": "NVMe"
  },
  "model_name": "Samsung SSD 970 PRO 512GB",
  "serial_number": "S463NF0MXXXXXXX",
  "firmware_version": "1B2QEXP7",
  "nvme_pci_vendor": {
    "id": 5197,
    "subsystem_id": 5197
  },
  "nvme_ieee_oui_identifier": 9528,
  "nvme_total_capacity": 512110190592,
  "nvme_unallocated_capacity": 0,
  "nvme_controller_id": 4,
  "nvme_version": {
    "string": "1.3",
    "value": 66304
  },
  "nvme_number_of_namespaces": 1,
  "nvme_namespaces": [
    {
      "id": 1,
      "size": {
        "blocks": 1000215216,
        "bytes": 512110190592
      },
      "capacity": {
        "blocks": 1000215216,
        "bytes": 512110190592
      },
      "utilization": {
        "blocks": 107557128,
        "bytes": 55069249536
      },
      "formatted_lba_size": 512,
      "eui64": {
        "oui": 9528,
        "ext_id": 384696446185
      }
    }
  ],
  "user_capacity": {
    "blocks": 1000215216,
    "bytes": 512110190592
  },
  "logical_block_size": 512,
  "smart_support": {
    "available": true,
    "enabled": true
  },
  "smart_status": {
    "passed": true,
    "nvme": {
      "value": 0
    }
  },
  "nvme_smart_health_information_log": {
    "critical_warning": 0,
    "temperature": 39,
    "available_spare": 100,
    "available_spare_threshold": 10,
    "percentage_used": 2,
    "data_units_read": 77788198,
    "data_units_written": 53882918,
    "host_reads": 1089040374,
    "host_writes": 751165311,
    "controller_busy_time": 3261,
    "power_cycles": 1502,
    "power_on_hours": 6373,
    "unsafe_shutdowns": 185,
    "media_errors": 0,
    "num_err_log_entries": 9712,
    "warning_temp_time": 0,
    "critical_comp_time": 0,
    "temperature_sensors": [
      39,
      43
    ]
  },
  "temperature": {
    "current": 39
  },
  "power_cycle_count": 1502,
  "power_on_time": {
    "hours": 6373
  }
}

C:\Program Files\GSmartControl>smartctl.exe -j --all /dev/sdb
{
  "json_format_version": [
    1,
    0
  ],
  "smartctl": {
    "version": [
      7,
      3
    ],
    "svn_revision": "5338",
    "platform_info": "x86_64-w64-mingw32-w11-b25247",
    "build_info": "(sf-7.3-1)",
    "argv": [
      "smartctl",
      "-j",
      "--all",
      "/dev/sdb"
    ],
    "exit_status": 0
  },
  "local_time": {
    "time_t": 1669414327,
    "asctime": "Fri Nov 25 23:12:07 2022 SE"
  },
  "device": {
    "name": "/dev/sdb",
    "info_name": "/dev/sdb",
    "type": "nvme",
    "protocol": "NVMe"
  },
  "model_name": "KINGSTON SEDC1000M3840G",
  "serial_number": "50026B728XXXX",
  "firmware_version": "S68F0120",
  "nvme_pci_vendor": {
    "id": 9798,
    "subsystem_id": 9798
  },
  "nvme_ieee_oui_identifier": 9911,
  "nvme_total_capacity": 3840755982336,
  "nvme_unallocated_capacity": 0,
  "nvme_controller_id": 1,
  "nvme_version": {
    "string": "1.3",
    "value": 66304
  },
  "nvme_number_of_namespaces": 1,
  "nvme_namespaces": [
    {
      "id": 1,
      "size": {
        "blocks": 7501476528,
        "bytes": 3840755982336
      },
      "capacity": {
        "blocks": 7501476528,
        "bytes": 3840755982336
      },
      "utilization": {
        "blocks": 7501476528,
        "bytes": 3840755982336
      },
      "formatted_lba_size": 512,
      "eui64": {
        "oui": 9911,
        "ext_id": 172439069653
      }
    }
  ],
  "user_capacity": {
    "blocks": 7501476528,
    "bytes": 3840755982336
  },
  "logical_block_size": 512,
  "smart_support": {
    "available": true,
    "enabled": true
  },
  "smart_status": {
    "passed": true,
    "nvme": {
      "value": 0
    }
  },
  "nvme_smart_health_information_log": {
    "critical_warning": 0,
    "temperature": 31,
    "available_spare": 100,
    "available_spare_threshold": 10,
    "percentage_used": 0,
    "data_units_read": 67103406,
    "data_units_written": 60312101,
    "host_reads": 237642019,
    "host_writes": 246983288,
    "controller_busy_time": 29727,
    "power_cycles": 622,
    "power_on_hours": 4342,
    "unsafe_shutdowns": 56,
    "media_errors": 0,
    "num_err_log_entries": 0,
    "warning_temp_time": 0,
    "critical_comp_time": 0
  },
  "temperature": {
    "current": 31
  },
  "power_cycle_count": 622,
  "power_on_time": {
    "hours": 4342
  }
}

@HubKing
Copy link

HubKing commented Feb 12, 2023

On Windows, CrystalDiskInfo could show the information of my Samsung NVME like any other disks. Both GsmartControl and Gnome Disks could not read it. nvme-cli could show the same data as Crystal. Well, I could use the command, but that is not as convenient as using the GUI. If dealing with NVME is too much work, how about just install nvme-cli as a dependency and simply call it and parse its output?

Anyway, since all modern laptops and desktops now use NVME as the main, if not the only, storage, I think NVME support really is needed.

@bjlockie
Copy link

bjlockie commented Apr 9, 2023

My new laptop only has a nvme drive.

@ashaduri ashaduri mentioned this issue Apr 14, 2023
@antonio-petricca
Copy link

Any chance to support this format?

@bjlockie
Copy link

Any chance to support this format?

Read the 1st post.
Support in smartctl is still experimental.
You're welcome to supply a patch if you don't want to wait.

@antonio-petricca
Copy link

antonio-petricca commented Apr 17, 2023

Hi , I will try doing it as soon as I will get enough time. :)

Could you kindly provide building and debugging information?

Edit: I managed how to build ir (with a bit of hacking for configure_dev script).

@cfelicio
Copy link

cfelicio commented Oct 2, 2023

Any chance to support this format?

Read the 1st post. Support in smartctl is still experimental. You're welcome to supply a patch if you don't want to wait.

looks like the latest smartctl (7.4) recently released has full support for NVME. I just tested updating the smartctl version on the gsmartcontrol folder, and it will still show unknown driver, but if you run smartctl via cmd, I can get all stats correctly on Windows. Surprisingly, this even works for external USB Nvme, which other solutions fail to achieve (e.g. CrystalDiskInfo). Looking forward to support on the GUI.

@jccardot
Copy link

jccardot commented Mar 9, 2024

I've got a USB to NVME adapter with a RTL9210 chipset, supported by smartctl, but the drive shows as "unknown model" in gsmartcontrol.
Attaching verbose output of gsmartcontrol and 3 invocations of smartctl (the drive is well recognized and displays all the info in the CLI, even in json format).
I have technical and programmation knowledge and am willing to help.
gsmartcontrol.txt
smartctl.txt

@jccardot
Copy link

jccardot commented Mar 12, 2024

I made a nvme version with statistics and error log based on antonio-petricca's version. Could it be worth considering? (you can find my repository here, branch nvme-support)

@ashaduri
Copy link
Owner Author

ashaduri commented Mar 27, 2024

I have started working on JSON and NVMe support.

Meanwhile, please attach as many JSON outputs as you can to this issue.
I'm looking for anything:

  • smartctl --json=o -x /dev/... and
  • smartctl --json=o --info --health --capabilities /dev/...
    outputs for any kind of drive - (S)ATA, NVMe, SCSI, USB, CD/DVD/Bluray, flash drives, etc.

@DrMcCoy
Copy link

DrMcCoy commented Mar 27, 2024

Some of mine:

0_nvme0n1-i.json
0_nvme0n1-x.json
0_sda-i.json
0_sda-x.json
1_nvme0n1-i.json
1_nvme0n1-x.json
1_sda-i.json
1_sda-x.json

@jccardot
Copy link

here it is
SATA SSD:
smartctl-a.txt
smartctl-a2.txt
SATA HD:
smartctl-b.txt
smartctl-b2.txt
USB NVME:
smartctl-c.txt
smartctl-c2.txt

@TomaszGasior
Copy link

Here's output for my SSD disk. I hope, it helps. smartctl.txt

@scribblemaniac
Copy link

I'm looking forward to the NVME support 🙂 Here are some more JSON outputs to help:
NVME SSDs: 1-x/1-i *, 2-x/2-i *, 3-x/3-i *
SATA SSDs: 1-x/1-i *, 2-x/2-i, 3-x/3-i
SATA HDDs: 1-x/1-i *, 2-x/2-i *
USB Flash Drives: 1-x/1-i †, 2-x/2-i †, 3-x/3-i †, 4-x/4-i
CD/DVD Drive: 1-x/1-i
MicroSD (via USB adapter): 1-x/1-i
USB 3.25" Floppy Drive: 1-x/1-i
SATA HDDs (via USB adapter): 1-x/1-i, 2-x/2-i, 3-x/3-i, 4-x/4-i (failed drive), 5-x/5-i
BMC Virtual Drives: 1-x/1-i (floppy) †, 2-x/2-i (HDD) †

* Serial number, WWN, and EUI64 have been redacted in these outputs
† Required adding the -d scsi argument to the command. Without this, the output looks like this: x/i

@cryobry
Copy link

cryobry commented Apr 17, 2024

My NVMe json.

@ashaduri
Copy link
Owner Author

Thanks everyone for providing the outputs!

GSmartControl now fully supports NVMe drives (yay!), including self-tests.
There are minor things missing still (like attribute warnings), but I feel confident I can close this issue. Please open new issues if you find major problems.

Smartmontools 7.4 is required. Please note that NVMe support is still marked "experimental" in it.

Meanwhile, please help me test the "main" branch. There have been major changes in it (including defaulting to JSON parser for all drives).

@andreymal
Copy link

help me test the "main" branch

A bit off-topic here, but I can't build it in my Arch Linux installation (tried GCC 13.2.1 and 14.1.1), it fails with the same error as GitHub Actions https://github.com/ashaduri/gsmartcontrol/actions/runs/9079753013/job/24949631989#step:5:38

@ashaduri
Copy link
Owner Author

A bit off-topic here, but I can't build it in my Arch Linux installation (tried GCC 13.2.1 and 14.1.1), it fails with the same error as GitHub Actions https://github.com/ashaduri/gsmartcontrol/actions/runs/9079753013/job/24949631989#step:5:38

Thanks, should be fixed now.

@ashaduri ashaduri added fixed The issue has been fixed and removed help wanted Extra attention is needed labels May 16, 2024
@akvadrako
Copy link

I have tested the main branch with my NVME drive. It does show me the detailed information, but it doesn't let me run tests. When I select the "Perform tests..." menu item it just pops up the detail screen. There is an error on the console:

<warn>  [hz] Warning: exit: Some SMART command to the disk failed, or there was a checksum error in a SMART data structure

The execution log contains:

{
  "json_format_version": [
    1,
    0
  ],
  "smartctl": {
    "version": [
      7,
      4
    ],
    "pre_release": false,
    "svn_revision": "5530",
    "platform_info": "x86_64-linux-6.9.4-200.fc40.x86_64",
    "build_info": "(local build)",
    "argv": [
      "smartctl",
      "--xall",
      "--json=o",
      "/dev/nvme0n1"
    ],
    "output": [
      "smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.9.4-200.fc40.x86_64] (local build)",
      "Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org",
      "",
      "=== START OF INFORMATION SECTION ===",
      "Model Number:                       WD_BLACK SN770 2TB",
      "Serial Number:                      23090Q800161",
      "Firmware Version:                   731120WD",
      "PCI Vendor/Subsystem ID:            0x15b7",
      "IEEE OUI Identifier:                0x001b44",
      "Total NVM Capacity:                 2,000,398,934,016 [2.00 TB]",
      "Unallocated NVM Capacity:           0",
      "Controller ID:                      0",
      "NVMe Version:                       1.4",
      "Number of Namespaces:               1",
      "Namespace 1 Size/Capacity:          2,000,398,934,016 [2.00 TB]",
      "Namespace 1 Formatted LBA Size:     512",
      "Namespace 1 IEEE EUI-64:            001b44 8b4e2d7632",
      "Local Time is:                      Tue Jul  2 08:39:29 2024 UTC",
      "Firmware Updates (0x14):            2 Slots, no Reset required",
      "Optional Admin Commands (0x0017):   Security Format Frmw_DL Self_Test",
      "Optional NVM Commands (0x00df):     Comp Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat Timestmp Verify",
      "Log Page Attributes (0x7e):         Cmd_Eff_Lg Ext_Get_Lg Telmtry_Lg Pers_Ev_Lg Log0_FISE_MI Telmtry_Ar_4",
      "Maximum Data Transfer Size:         256 Pages",
      "Warning  Comp. Temp. Threshold:     84 Celsius",
      "Critical Comp. Temp. Threshold:     88 Celsius",
      "Namespace 1 Features (0x02):        NA_Fields",
      "",
      "Supported Power States",
      "St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat",
      " 0 +     5.40W    5.40W       -    0  0  0  0        0       0",
      " 1 +     3.50W    3.00W       -    0  0  0  0        0       0",
      " 2 +     2.40W    2.00W       -    0  0  0  0        0       0",
      " 3 -   0.0150W       -        -    3  3  3  3     1500    2500",
      " 4 -   0.0050W       -        -    4  4  4  4    10000    6000",
      " 5 -   0.0033W       -        -    5  5  5  5   176000   25000",
      "",
      "Supported LBA Sizes (NSID 0x1)",
      "Id Fmt  Data  Metadt  Rel_Perf",
      " 0 +     512       0         2",
      " 1 -    4096       0         1",
      "",
      "=== START OF SMART DATA SECTION ===",
      "SMART overall-health self-assessment test result: PASSED",
      "",
      "SMART/Health Information (NVMe Log 0x02)",
      "Critical Warning:                   0x00",
      "Temperature:                        37 Celsius",
      "Available Spare:                    100%",
      "Available Spare Threshold:          10%",
      "Percentage Used:                    1%",
      "Data Units Read:                    21,556,436 [11.0 TB]",
      "Data Units Written:                 56,414,218 [28.8 TB]",
      "Host Read Commands:                 311,433,166",
      "Host Write Commands:                1,247,877,554",
      "Controller Busy Time:               1,205",
      "Power Cycles:                       59",
      "Power On Hours:                     790",
      "Unsafe Shutdowns:                   41",
      "Media and Data Integrity Errors:    0",
      "Error Information Log Entries:      44",
      "Warning  Comp. Temperature Time:    0",
      "Critical Comp. Temperature Time:    0",
      "Temperature Sensor 1:               52 Celsius",
      "Temperature Sensor 2:               37 Celsius",
      "",
      "Error Information (NVMe Log 0x01, 16 of 256 entries)",
      "No Errors Logged",
      "",
      "Read Self-test Log failed: Invalid Field in Command (0x4002)",
      ""
    ],
    "messages": [
      {
        "string": "Read Self-test Log failed: Invalid Field in Command (0x4002)",
        "severity": "error"
      }
    ],
    "exit_status": 4
  },
  "local_time": {
    "time_t": 1719909569,
    "asctime": "Tue Jul  2 08:39:29 2024 UTC"
  },
  "device": {
    "name": "/dev/nvme0n1",
    "info_name": "/dev/nvme0n1",
    "type": "nvme",
    "protocol": "NVMe"
  },
  "model_name": "WD_BLACK SN770 2TB",
  "serial_number": "23090Q800161",
  "firmware_version": "731120WD",
  "nvme_pci_vendor": {
    "id": 5559,
    "subsystem_id": 5559
  },
  "nvme_ieee_oui_identifier": 6980,
  "nvme_total_capacity": 2000398934016,
  "nvme_unallocated_capacity": 0,
  "nvme_controller_id": 0,
  "nvme_version": {
    "string": "1.4",
    "value": 66560
  },
  "nvme_number_of_namespaces": 1,
  "nvme_namespaces": [
    {
      "id": 1,
      "size": {
        "blocks": 3907029168,
        "bytes": 2000398934016
      },
      "capacity": {
        "blocks": 3907029168,
        "bytes": 2000398934016
      },
      "utilization": {
        "blocks": 3907029168,
        "bytes": 2000398934016
      },
      "formatted_lba_size": 512,
      "eui64": {
        "oui": 6980,
        "ext_id": 598312056370
      }
    }
  ],
  "user_capacity": {
    "blocks": 3907029168,
    "bytes": 2000398934016
  },
  "logical_block_size": 512,
  "smart_support": {
    "available": true,
    "enabled": true
  },
  "smart_status": {
    "passed": true,
    "nvme": {
      "value": 0
    }
  },
  "nvme_smart_health_information_log": {
    "critical_warning": 0,
    "temperature": 37,
    "available_spare": 100,
    "available_spare_threshold": 10,
    "percentage_used": 1,
    "data_units_read": 21556436,
    "data_units_written": 56414218,
    "host_reads": 311433166,
    "host_writes": 1247877554,
    "controller_busy_time": 1205,
    "power_cycles": 59,
    "power_on_hours": 790,
    "unsafe_shutdowns": 41,
    "media_errors": 0,
    "num_err_log_entries": 44,
    "warning_temp_time": 0,
    "critical_comp_time": 0,
    "temperature_sensors": [
      52,
      37
    ]
  },
  "temperature": {
    "current": 37
  },
  "power_cycle_count": 59,
  "power_on_time": {
    "hours": 790
  },
  "nvme_error_information_log": {
    "size": 256,
    "read": 16,
    "unread": 0
  }
}

@ashaduri
Copy link
Owner Author

ashaduri commented Jul 5, 2024

@akvadrako
You are correct.

  1. It looks like self-tests are not supported on WD NVMe, either by the drive firmware or smartctl. I have the same experience with my own WD NVMes.
  2. Self-tests are supported and seem to work on my Samsung 970 EVO NVMe. The output contains a nvme_self_test_log json key for such drives.
  3. I need to hide the "Perform tests" context menu for unsupported drives. Thanks for noticing this.

@akvadrako
Copy link

I see that it works in smartmontools 7.4 when you omit the namespace. https://www.smartmontools.org/ticket/1827

@ashaduri
Copy link
Owner Author

ashaduri commented Jul 6, 2024

I see that it works in smartmontools 7.4 when you omit the namespace. https://www.smartmontools.org/ticket/1827

Thanks for finding this. It looks like it should be fixed in smartmontools 7.5, so I don't see the need to implement a workaround in the gsmartcontrol code (yet).

@ashaduri
Copy link
Owner Author

Since smartmontools 7.4 may be widely deployed, a workaround for WD drives lacking self-tests has been implemented in the main branch.

@ashaduri
Copy link
Owner Author

ashaduri commented Nov 7, 2024

GSmartControl 2.0.0 has been released with NVMe support.
Testing is highly welcome and encouraged!
For the best results, please use smartmontools 7.4 or newer (Windows package already includes it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed The issue has been fixed
Projects
None yet
Development

No branches or pull requests