Opened 8 months ago

Closed 4 weeks ago

Last modified 4 weeks ago

#1741 closed defect (fixed)

nvme self test commands fail when specifying a namespace

Reported by: Matthew Eaton Owned by: Christian Franke
Priority: minor Milestone: Release 7.5
Component: smartctl Version: 7.4
Keywords: nvme Cc:

Description

The nvme self test commands in smartctl fail with a non-zero retval when specifying a namespace (e.g. /dev/nvme0n1). These commands work when specifying the character device (e.g. /dev/nvme0). This issue also affects other smartctl functionality that implies -l selftest.

# smartctl -t short /dev/nvme0n1
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-5.15.0-79-generic] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

Read Self-test Log failed: Invalid Field in Command (0x002)
# smartctl -t short /dev/nvme0
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-5.15.0-79-generic] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

Self-test has begun
Use smartctl -X to abort test
# smartctl -l selftest /dev/nvme0n1
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-5.15.0-79-generic] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF SMART DATA SECTION ===
Read Self-test Log failed: Invalid Field in Command (0x002)
# smartctl -l selftest /dev/nvme0
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-5.15.0-79-generic] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF SMART DATA SECTION ===
Self-test Log (NVMe Log 0x06)
Self-test status: Short self-test in progress (31% completed)
Num  Test_Description  Status                       Power_on_Hours  Failing_LBA  NSID Seg SCT Code
 0   Short             Completed without error                 962            -     -   -   -    -
 1   Short             Completed without error                 962            -     -   -   -    -
 2   Short             Completed without error                 962            -     -   -   -    -

Attachments (2)

smartctl-x-nvme0.txt (3.6 KB ) - added by Matthew Eaton 8 months ago.
smartctl-x-nvme0n1.txt (3.0 KB ) - added by Matthew Eaton 8 months ago.

Download all attachments as: .zip

Change History (11)

comment:1 by Christian Franke, 8 months ago

Milestone: undecided

Please provide a full smartctl -x output for this device.

NVMe specs allow NSID 0 (controller only, not yet supported by smartctl), broadcast NSID and individual NSIDs for the Device Self-test command. This firmware does not support the latter.

by Matthew Eaton, 8 months ago

Attachment: smartctl-x-nvme0.txt added

by Matthew Eaton, 8 months ago

Attachment: smartctl-x-nvme0n1.txt added

comment:2 by Matthew Eaton, 8 months ago

Attached smartctl -x output for /dev/nvme0 and /dev/nvme0n1.

comment:3 by Mark Thompson, 7 months ago

I believe the proper name is 'nvme0'. Rationale: 'nvme0n1' is the first namespace, however 'nvme0' is the first registered device controller. If you use 'nvme0n1' I suspect there is no Self-test Log Data for this namespace, however the device controller does have the requested data. I suspect the invalid command is genuine and the function should not be changed.

comment:4 by Christian Franke, 6 months ago

Related or duplicate: GH issues/217.

comment:5 by Christian Franke, 4 weeks ago

Milestone: undecidedRelease 7.5
Owner: set to Christian Franke
Status: newaccepted

comment:6 by Christian Franke, 4 weeks ago

comment:7 by Christian Franke, 4 weeks ago

Resolution: fixed
Status: acceptedclosed

comment:8 by Christian Franke, 4 weeks ago

If possible, please test a recent CI build from https://builds.smartmontools.org/

comment:9 by Matthew Eaton, 4 weeks ago

Tested r5607 and confirmed the fix. Thanks!

Note: See TracTickets for help on using tickets.