Opened 16 months ago

Closed 9 months ago

Last modified 2 months 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 16 months ago.
smartctl-x-nvme0n1.txt (3.0 KB ) - added by Matthew Eaton 16 months ago.

Download all attachments as: .zip

Change History (17)

comment:1 by Christian Franke, 16 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, 16 months ago

Attachment: smartctl-x-nvme0.txt added

by Matthew Eaton, 16 months ago

Attachment: smartctl-x-nvme0n1.txt added

comment:2 by Matthew Eaton, 16 months ago

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

comment:3 by Mark Thompson, 15 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, 14 months ago

Related or duplicate: GH issues/217.

comment:5 by Christian Franke, 9 months ago

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

comment:6 by Christian Franke, 9 months ago

comment:7 by Christian Franke, 9 months ago

Resolution: fixed
Status: acceptedclosed

comment:8 by Christian Franke, 9 months ago

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

comment:9 by Matthew Eaton, 9 months ago

Tested r5607 and confirmed the fix. Thanks!

comment:10 by Christian Franke, 8 months ago

Ticket #1827 has been marked as a duplicate of this ticket.

comment:11 by rzsn, 8 months ago

Ticket #1828 has been marked as a duplicate of this ticket.

comment:12 by Christian Franke, 7 months ago

GH issues/267 has been marked as a duplicate of this ticket.

comment:13 by Christian Franke, 2 months ago

r5627 reverts parts of r5603 because my original assumption was possibly wrong. The broadcast NSID is needed to read the self-test log. Starting a test with NSID=1 should also work with single namespace devices. This matches with NVMe specs.

If possible, please re-test -t short and -l selftest with smartctl r5627 or later. Feel free to reopen this ticket if this does no longer work.

See https://builds.smartmontools.org/ for various binaries.

comment:14 by Matthew Eaton, 2 months ago

I re-tested on r5629 and confirmed this issue is still fixed. Thanks!

# smartctl -t short /dev/nvme0n1 ; echo $?
smartctl pre-7.5 2024-10-23 r5629 [x86_64-linux-6.8.0-45-generic] (local build)
Copyright (C) 2002-24, Bruce Allen, Christian Franke, www.smartmontools.org

Self-test has begun (NSID 0x1)
Use smartctl -X to abort test
0
# smartctl -l selftest /dev/nvme0n1 ; echo $?
smartctl pre-7.5 2024-10-23 r5629 [x86_64-linux-6.8.0-45-generic] (local build)
Copyright (C) 2002-24, Bruce Allen, Christian Franke, www.smartmontools.org

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

0
# smartctl -l selftest /dev/nvme0n1 ; echo $?
smartctl pre-7.5 2024-10-23 r5629 [x86_64-linux-6.8.0-45-generic] (local build)
Copyright (C) 2002-24, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF SMART DATA SECTION ===
Self-test Log (NVMe Log 0x06, NSID 0xffffffff)
Self-test status: No self-test in progress
Num  Test_Description  Status                       Power_on_Hours  Failing_LBA  NSID Seg SCT Code
 0   Short             Completed without error                 277            -     -   -   -    -
 1   Short             Completed without error                 277            -     -   -   -    -

0

comment:15 by Christian Franke, 2 months ago

That was quick - Thanks!

Note: See TracTickets for help on using tickets.