Nvme to usb using Realtek RTL9210B and SMART status issue

SYSTEM INFORMATION
OS type and version 11.3
Webmin version 1.994

So I got a NVME to USB enclosure that uses the Realtek RTL9210B chipset.

Webmin doesn’t see it as a NVME device and I understand that but the issue is between the web gui info and what I get from smartctl is completely different.

webmin gives this

But the cli shows this…

# smartctl -x -d sntrealtek /dev/sdb
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.16.0-0.bpo.4-amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       Samsung SSD 970 EVO Plus 1TB
Serial Number:                      S6S1NJ0RB08811D
Firmware Version:                   3B2QEXM7
PCI Vendor/Subsystem ID:            0x144d
IEEE OUI Identifier:                0x002538
Total NVM Capacity:                 1,000,204,886,016 [1.00 TB]
Unallocated NVM Capacity:           0
Controller ID:                      6
NVMe Version:                       1.3
Number of Namespaces:               1
Namespace 1 Size/Capacity:          1,000,204,886,016 [1.00 TB]
Namespace 1 Utilization:            198,013,059,072 [198 GB]
Namespace 1 Formatted LBA Size:     512
Namespace 1 IEEE EUI-64:            002538 5b1140b3f5
Local Time is:                      Sun Jun  5 23:11:46 2022 PDT
Firmware Updates (0x16):            3 Slots, no Reset required
Optional Admin Commands (0x0017):   Security Format Frmw_DL Self_Test
Optional NVM Commands (0x0057):     Comp Wr_Unc DS_Mngmt Sav/Sel_Feat Timestmp
Log Page Attributes (0x0f):         S/H_per_NS Cmd_Eff_Lg Ext_Get_Lg Telmtry_Lg
Maximum Data Transfer Size:         128 Pages
Warning  Comp. Temp. Threshold:     82 Celsius
Critical Comp. Temp. Threshold:     85 Celsius

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     7.54W       -        -    0  0  0  0        0       0
 1 +     7.54W       -        -    1  1  1  1        0     200
 2 +     7.54W       -        -    2  2  2  2        0    1000
 3 -   0.0500W       -        -    3  3  3  3     2000    1200
 4 -   0.0050W       -        -    4  4  4  4      500    9500

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         0

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        28 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    0%
Data Units Read:                    52,709 [26.9 GB]
Data Units Written:                 1,110,583 [568 GB]
Host Read Commands:                 1,416,076
Host Write Commands:                19,707,001
Controller Busy Time:               143
Power Cycles:                       23
Power On Hours:                     112
Unsafe Shutdowns:                   5
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:               28 Celsius
Temperature Sensor 2:               30 Celsius

Warning: NVMe Get Log truncated to 0x200 bytes, 0x200 bytes zero filled
Error Information (NVMe Log 0x01, 16 of 64 entries)
No Errors Logged

Clearly there is a issue…

# smartctl -H -d sntrealtek /dev/sdb
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.16.0-0.bpo.4-amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
# smartctl -d test /dev/sdb
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.16.0-0.bpo.4-amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

/dev/sdb [USB NVMe Realtek]: Device of type 'sntrealtek' [NVMe] detected
/dev/sdb [USB NVMe Realtek]: Device of type 'sntrealtek' [NVMe] opened

Also adding smartctl params to the module config also doesn’t do anything to fix this

image

-d auto should also detect the smart status like the cli does


BTW NVMe drives don’t have the explicit lines

SMART support is: Available - device has SMART capability.
SMART support is: Enabled

As I believe smart health is enabled regardless using the -H switch shows this.

@Joe anything or not fixable??

This is more a @Jamie question.

I think the issue is that Webmin expects that NVME drives use /dev/nvme paths, but this shows up as a regular USB drive with a /dev/sda path. I suppose we need to add that -d sntrealtek flag, but it’s unclear how this can be detected?

You can test via this…

smartctl -d test /dev/sdb

Which gives you this

/dev/sdb [USB NVMe Realtek]: Device of type 'sntrealtek' [NVMe] detected
/dev/sdb [USB NVMe Realtek]: Device of type 'sntrealtek' [NVMe] opened

Or you can also use the auto type

smartctl -x -d auto /dev/sdb

Which does give all the info without needing to know exactly what the device type is.

# smartctl -x -d auto /dev/sdb
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.16.0-0.bpo.4-amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       Samsung SSD 970 EVO Plus 1TB
Serial Number:                      <REMOVED>
Firmware Version:                   3B2QEXM7
PCI Vendor/Subsystem ID:            0x144d
IEEE OUI Identifier:                0x002538
Total NVM Capacity:                 1,000,204,886,016 [1.00 TB]
Unallocated NVM Capacity:           0
Controller ID:                      6
NVMe Version:                       1.3
Number of Namespaces:               1
Namespace 1 Size/Capacity:          1,000,204,886,016 [1.00 TB]
Namespace 1 Utilization:            593,763,422,208 [593 GB]
Namespace 1 Formatted LBA Size:     512
Namespace 1 IEEE EUI-64:            002538 5b1140b3f5
Local Time is:                      Tue Jun  7 22:09:27 2022 PDT
Firmware Updates (0x16):            3 Slots, no Reset required
Optional Admin Commands (0x0017):   Security Format Frmw_DL Self_Test
Optional NVM Commands (0x0057):     Comp Wr_Unc DS_Mngmt Sav/Sel_Feat Timestmp
Log Page Attributes (0x0f):         S/H_per_NS Cmd_Eff_Lg Ext_Get_Lg Telmtry_Lg
Maximum Data Transfer Size:         128 Pages
Warning  Comp. Temp. Threshold:     82 Celsius
Critical Comp. Temp. Threshold:     85 Celsius

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     7.54W       -        -    0  0  0  0        0       0
 1 +     7.54W       -        -    1  1  1  1        0     200
 2 +     7.54W       -        -    2  2  2  2        0    1000
 3 -   0.0500W       -        -    3  3  3  3     2000    1200
 4 -   0.0050W       -        -    4  4  4  4      500    9500

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         0

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        29 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    0%
Data Units Read:                    377,086 [193 GB]
Data Units Written:                 3,084,847 [1.57 TB]
Host Read Commands:                 11,571,611
Host Write Commands:                81,502,053
Controller Busy Time:               187
Power Cycles:                       26
Power On Hours:                     159
Unsafe Shutdowns:                   8
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:               29 Celsius
Temperature Sensor 2:               30 Celsius

Warning: NVMe Get Log truncated to 0x200 bytes, 0x200 bytes zero filled
Error Information (NVMe Log 0x01, 16 of 64 entries)
No Errors Logged

Thanks, that’s useful! Seems like we could always add -d auto to the smartctl command to properly detect the drive type.

1 Like

is there a file i can edit to check this?

You could apply this patch : Always auto-detect drive type https://forum.virtualmin.com/t/nvme-to-… · webmin/webmin@e83ab6d · GitHub

No change

Maybe because NMVE doesnt actually say

SMART support is: Available - device has SMART capability.
SMART support is: Enabled

I think the code under
sub get_drive_status

needs to be changed to detect this

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

I added these line

        elsif ($out =~ /NVMe\s+Version:/i) {
                $rv{'support'} = 1;
                $rv{'enabled'} = 1;
                }

and I get this now except the smart control command at the bottom shouldnt be seen for nmve drives since they do not support this.

W00T!! I got a working file for now – in fact I think you can actually remove some code seeing the actually testing for nmve devices is no longer needed with my fix. You can also see all the attributes of the nvme drives now.

Let me know if you want a copy of it.

Yes, I’d like to see your fix!

@sgrayban Yes, please share.

$ diff /usr/share/webmin/smart-status/smart-status-lib.pl smart-status-lib.pl

319a320,323
>         elsif ($out =~ /NVMe\s+Version:/i) {
>                 $rv{'support'} = 1;
>                 $rv{'enabled'} = 1;
>                 }

That’s it – if you just test for that instead of looking for the actual /dev/nvme its all you need. BTW I removed the other patch because that didn’t work. I can’t figure out how to attach a file here or I would.

I could add the code that would disable the smart testing buttons for NMVE drives if wanted.

Thanks for that patch!

What does smartctl -i /dev/sdb output on your system?

1 Like

This…

smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.16.0-0.bpo.4-amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number: Samsung SSD 970 EVO Plus 1TB
Serial Number: S6S1NJ0RB08811D
Firmware Version: 3B2QEXM7
PCI Vendor/Subsystem ID: 0x144d
IEEE OUI Identifier: 0x002538
Total NVM Capacity: 1,000,204,886,016 [1.00 TB]
Unallocated NVM Capacity: 0
Controller ID: 6
NVMe Version: 1.3
Number of Namespaces: 1
Namespace 1 Size/Capacity: 1,000,204,886,016 [1.00 TB]
Namespace 1 Utilization: 629,739,073,536 [629 GB]
Namespace 1 Formatted LBA Size: 512
Namespace 1 IEEE EUI-64: 002538 5b1140b3f5
Local Time is: Fri Jun 10 22:58:46 2022 PDT

As you can see it has NVMe Version so you dont need to test for a nvme device anymore or shouldn’t have to.

Thanks! I’ll incorporate your patch in the next release…

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.