1.\" 2.\" This file and its contents are supplied under the terms of the 3.\" Common Development and Distribution License ("CDDL"), version 1.0. 4.\" You may only use this file in accordance with the terms of version 5.\" 1.0 of the CDDL. 6.\" 7.\" A full copy of the text of the CDDL should have accompanied this 8.\" source. A copy of the CDDL is also available via the Internet at 9.\" http://www.illumos.org/license/CDDL. 10.\" 11.\" 12.\" Copyright 2021 Oxide Computer Company 13.\" Copyright 2022 Tintri by DDN, Inc. All rights reserved. 14.\" 15.Dd April 25, 2022 16.Dt NVMEADM 8 17.Os 18.Sh NAME 19.Nm nvmeadm 20.Nd NVMe administration utility 21.Sh SYNOPSIS 22.Nm 23.Fl h 24.Op Ar command 25.Nm 26.Op Fl dv 27.Cm list 28.Oo 29.Fl p 30.Fl o Ar field Ns [,...] 31.Oc 32.Op Ar ctl[/ns] Ns [,...] 33.Nm 34.Op Fl dv 35.Cm identify 36.Ar ctl[/ns] Ns [,...] 37.Nm 38.Op Fl dv 39.Cm get-logpage 40.Ar ctl[/ns] Ns [,...] 41.Ar logpage 42.Nm 43.Op Fl dv 44.Cm get-features 45.Ar ctl[/ns] Ns [,...] 46.Op Ar feature-list 47.Nm 48.Op Fl dv 49.Cm format 50.Ar ctl[/ns] 51.Op Ar lba-format 52.Nm 53.Op Fl dv 54.Cm secure-erase 55.Op Fl c 56.Ar ctl[/ns] 57.Nm 58.Op Fl dv 59.Cm detach 60.Ar ctl[/ns] 61.Nm 62.Op Fl dv 63.Cm attach 64.Ar ctl[/ns] 65.Nm 66.Op Fl dv 67.Cm list-firmware 68.Ar ctl 69.Nm 70.Op Fl dv 71.Cm load-firmware 72.Ar ctl 73.Ar firmware-file 74.Op Ar offset 75.Nm 76.Op Fl dv 77.Cm commit-firmware 78.Ar ctl 79.Ar slot 80.Nm 81.Op Fl dv 82.Cm activate-firmware 83.Ar ctl 84.Ar slot 85.Sh DESCRIPTION 86The 87.Nm 88utility can be used to enumerate the NVMe controllers and their 89namespaces, query hardware information from a NVMe controller or 90namespace, and to format or secure-erase a NVMe controller or 91namespace. 92.Pp 93The information returned by the hardware is printed by 94.Nm 95in a human-readable form were applicable. 96Generally all 0-based counts are normalized and values may be 97converted to human-readable units such as MB (megabytes), W (watts), 98or C (degrees Celsius). 99.Sh OPTIONS 100The following options are supported: 101.Bl -tag -width Ds 102.It Fl h 103Print a short help text for 104.Nm , 105or for an optionally specified 106.Nm 107command. 108.It Fl d 109Enable debugging output. 110.It Fl v 111Enable verbose output. 112.El 113.Sh ARGUMENTS 114.Nm 115expects the following kinds of arguments: 116.Bl -tag -width "ctl[/ns]" 117.It Ar command 118Any command 119.Nm 120understands. 121See section 122.Sx COMMANDS . 123.It Ar ctl[/ns] 124Specifies a NVMe controller and optionally a namespace within that 125controller. 126The controller name consists of the driver name 127.Qq nvme 128followed by an instance number. 129A namespace is specified by appending a single 130.Qq / 131followed by the namespace ID to the controller name. 132The namespace ID is the EUI64 of the namespace, or a positive non-zero 133decimal number if the namespace doesn't have an EUI64. 134For commands that don't change the device state multiple controllers 135and namespaces can be specified as a comma-separated list. 136.Pp 137The list of controllers and namespaces present in the system can be 138queried with the 139.Cm list 140command without any arguments. 141.It Ar logpage 142Specifies the log page name for the 143.Cm get-logpage 144command. 145.It Ar feature-list 146A comma-separated list of feature names for the 147.Cm get-features 148command. 149Feature names can be specified in upper or lower case and can be 150shortened the shortest unique name. 151Some features may also have an alternative short name. 152.It Ar lba-format 153A non-zero integer specifying the LBA format for the 154.Cm format 155command. 156The list of supported LBA formats on a namespace can be retrieved 157with the 158.Nm 159.Cm identify 160command. 161.It Ar firmware-file 162Specifies the name of a firmware file to be loaded into the controller 163using the 164.Cm load-firmware 165command. 166.It Ar offset 167Specifies the byte offset at which to load 168.Ar firmware-file 169within the controller's upload buffer. 170Vendors may require multiple images to be loaded at different offsets 171before a firmware set is committed to a 172.Ar slot . 173.It Ar slot 174Specifies the firmware slot into which a firmware set is committed 175using the 176.Cm commit-firmware 177command, and subsequently activated with the 178.Cm activate-firmware 179command. 180Slots and their contents can be printed using the 181.Nm 182.Cm list-firmware 183command. 184.El 185.Sh COMMANDS 186.Bl -tag -width "" 187.It Xo 188.Nm 189.Cm list 190.Oo 191.Fl p 192.Fl o Ar field Ns [,...] 193.Oc 194.Op Ar ctl[/ns] Ns [,...] 195.Xc 196Lists the NVMe controllers and their namespaces in the system and 197prints a 1-line summary of their basic properties for each. 198If a list of controllers and/or namespaces is given then the listing 199is limited to those devices. 200By default, output is human-readable; however, a parsable form can 201controlled by using the following options: 202.Bl -tag -width Fl 203.It Fl p 204Rather than printing human-readable output, outputs an entry for each of 205the specified controllers and namespaces. 206If no controllers or namespaces are given as arguments, then the primary 207namespace of each controller is listed and if the 208.Fl v 209option is specified, then all of the namespaces for a controller are 210listed. 211This option requires that output fields be selected with the 212.Fl o 213option. 214.It Fl o Ar field Ns [,...] 215A comma-separated list of one or more output fields to be used. 216Fields are listed below and the name is case insensitive. 217.El 218.Pp 219The following fields can be specified when using the parsable form: 220.Bl -tag -width CAPACITY 221.It Sy MODEL 222The model number of the device, generally containing information about 223both the manufacturer and the product. 224.It Sy SERIAL 225The NVMe controller's serial number. 226.It Sy FWREV 227The controller's firmware revision. 228.It Sy VERSION 229The version of the NVMe specification the controller supports. 230.It Sy SIZE 231The logical size in bytes of the namespace. 232.It Sy CAPACITY 233The amount of logical bytes that the namespace may actually have allocated at 234any time. 235This may be different than size due to the use of thin provisioning or due to 236administrative action. 237.It Sy USED 238The number of bytes used in the namespace. 239.It Sy INSTANCE 240The name of the device node and instance of it. 241.It Sy NAMESPACE 242The numerical value of the namespace which can be used as part of other 243.Nm 244operations. 245.It Sy DISK 246The name of the disk device that corresponds to the namespace, if any. 247.El 248.It Xo 249.Nm 250.Cm identify 251.Ar ctl[/ns] Ns [,...] 252.Xc 253Print detailed information about the specified controllers and/or 254namespaces. 255The information returned differs depending on whether a controller or 256a namespace is specified. 257For an explanation of the data printed by this command refer to the 258description of the 259.Qq IDENTIFY 260admin command in the NVMe specification. 261.It Xo 262.Nm 263.Cm get-logpage 264.Ar ctl[/ns] Ns [,...] 265.Ar logpage 266.Xc 267Print the specified log page of the specified controllers and/or namespaces. 268Most log pages are only available on a per-controller basis. 269Known log pages are: 270.Bl -tag -width "firmware" 271.It error 272Error Information 273.It health 274SMART/Health Information. 275A controller may support this log page on a per-namespace basis. 276.It firmware 277Firmware Slot Information 278.El 279.Pp 280For an explanation of the contents of the log pages refer to the 281description of the 282.Qq GET LOGPAGE 283admin command in the NVMe specification. 284.It Xo 285.Nm 286.Cm get-features 287.Ar ctl[/ns] Ns [,...] 288.Op Ar feature-list 289.Xc 290Prints information about the specified features, or all features if 291none are given, of the specified controllers and/or namespaces. 292Feature names are case-insensitive, and they can be shortened as long 293as they remain unique. 294Some features also have alternative short names to which the same 295rules apply. 296The following features are supported: 297.Pp 298.TS 299tab(:); 300l l l. 301FULL NAME:SHORT NAME:CONTROLLER/NAMESPACE 302Arbitration::controller 303Power Management::controller 304LBA Range Type:range:namespace 305Temperature Threshold::controller 306Error Recovery::controller 307Volatile Write Cache:cache:controller 308Number of Queues:queues:controller 309Interrupt Coalescing:coalescing:controller 310Interrupt Vector Configuration:vector:controller 311Write Atomicity:atomicity:controller 312Asynchronous Event Configuration:event:controller 313Autonomous Power State Transition::controller 314Software Progress Marker:progress:controller 315.TE 316.Pp 317For an explanation of the individual features refer to the description 318of the 319.Qq SET FEATURES 320admin command in the NVMe specification. 321.It Xo 322.Nm 323.Cm format 324.Ar ctl[/ns] 325.Op Ar lba-format 326.Xc 327Formats the specified namespace or all namespaces of the specified 328controller. 329This command implies a 330.Nm 331.Cm detach 332and subsequent 333.Nm 334.Cm attach 335of the specified namespace(s), which will cause a changed LBA format 336to be detected. 337If no LBA format is specified the LBA format currently used by the 338namespace will be used. 339When formatting all namespaces without specifying a LBA format the LBA 340format of namespace 1 will be used. 341A list of LBA formats supported by a namespace can be queried with the 342.Nm 343.Cm identify 344command. 345.Pp 346Note that not all devices support formatting individual or all 347namespaces, or support formatting at all. 348.Pp 349LBA formats using a non-zero metadata size are not supported by 350.Nm 351or 352.Xr nvme 4D . 353.Pp 354The list of supported LBA formats on a namespace can be retrieved 355with the 356.Nm 357.Cm identify 358command. 359.It Xo 360.Nm 361.Cm secure-erase 362.Op Fl c 363.Ar ctl[/ns] 364.Xc 365Erases the specified namespace or all namespaces of the controller. 366The flag 367.Fl c 368will cause a cryptographic erase instead of a normal erase. 369This command implies a 370.Nm 371.Cm detach 372and 373.Nm 374.Cm attach 375of the specified namespace(s). 376.Pp 377Note that not all devices support erasing individual or all 378namespaces, or support erasing at all. 379.It Xo 380.Nm 381.Cm detach 382.Ar ctl[/ns] 383.Xc 384Temporarily detaches the 385.Xr blkdev 4D 386instance from the specified namespace or all namespaces of the controller. 387This will prevent I/O access to the affected namespace(s). 388Detach will only succeed if the affected namespace(s) are not 389currently opened. 390The detached state will not persist across reboots or reloads of the 391.Xr nvme 4D 392driver. 393.Pp 394It is not an error to detach a namespace that is already detached, any such 395request will be silently ignored. 396.It Xo 397.Nm 398.Cm attach 399.Ar ctl[/ns] 400.Xc 401Attaches the 402.Xr blkdev 4D 403instance to the specified namespace or all namespaces of the controller. 404This will make I/O accesses to the namespace(s) possible again after a 405previous 406.Nm 407.Cm detach 408command. 409.Pp 410It is not an error to attach a namespace that is already attached, any such 411request will be silently ignored. 412.It Xo 413.Nm 414.Cm list-firmware 415.Ar ctl 416.Xc 417List currently active firmware slot, the next active firmware slot, and the 418current contents of all firmware slots of an NVMe controller. 419This is a synonym for the 420.Nm 421.Cm get-logpage 422.Ar ctl 423.Cm firmware 424command. 425.It Xo 426.Nm 427.Cm load-firmware 428.Ar ctl 429.Ar firmware-file 430.Op Ar offset 431.Xc 432Loads 433.Ar firmware-file 434into the controller's upload memory at 435.Ar offset , 436the default is 0. A vendor may require multiple files to be loaded 437at different offsets before the firmware is committed to a 438.Ar slot . 439.It Xo 440.Nm 441.Cm commit-firmware 442.Ar ctl 443.Ar slot 444.Xc 445Commits firmware previously loaded by the 446.Cm load-firmware 447command to 448.Ar slot . 449.It Xo 450.Nm 451.Cm activate-firmware 452.Ar ctl 453.Ar slot 454.Xc 455Activates the firmware in slot 456.Ar slot . 457The firmware image in 458.Ar slot 459is activated at the next NVM controller reset. 460.El 461.Sh EXIT STATUS 462.Ex -std 463.Sh EXAMPLES 464.Bl -tag -width "" 465.It Sy Example 1: List all NVMe controllers and namespaces 466.Bd -literal 467# nvmeadm list 468nvme1: model: INTEL SSDPEDMD800G4, serial: CVFT4134001R800CGN, FW rev: 8DV10049, NVMe v1.0 469 nvme1/1 (c1t1d0): Size = 763097 MB, Capacity = 763097 MB, Used = 763097 MB 470nvme4: model: SAMSUNG MZVPV128HDGM-00000, serial: S1XVNYAGA00640, FW rev: BXW7300Q, NVMe v1.1 471 nvme4/1 (c2t2d0): Size = 122104 MB, Capacity = 122104 MB, Used = 5127 MB 472.Ed 473.It Sy Example 2: Identify a namespace 474.Bd -literal 475# nvmeadm identify nvme4/1 476nvme4/1: Identify Namespace 477 Namespace Capabilities and Features 478 Namespace Size: 122104MB 479 Namespace Capacity: 122104MB 480 Namespace Utilization: 5127MB 481 Namespace Features 482 Thin Provisioning: unsupported 483 Number of LBA Formats: 1 484 Formatted LBA Size 485 LBA Format: 1 486 Extended Data LBA: no 487 Metadata Capabilities 488 Extended Data LBA: unsupported 489 Separate Metadata: unsupported 490 End-to-End Data Protection Capabilities 491 Protection Information Type 1: unsupported 492 Protection Information Type 2: unsupported 493 Protection Information Type 3: unsupported 494 Protection Information first: unsupported 495 Protection Information last: unsupported 496 End-to-End Data Protection Settings 497 Protection Information: disabled 498 Protection Information in Metadata: last 8 bytes 499 LBA Format 1 500 Metadata Size: 0 bytes 501 LBA Data Size: 512 bytes 502 Relative Performance: Best 503.Ed 504.It Sy Example 3: Get SMART/Health information (verbose) 505.Bd -literal 506# nvmeadm -v get-logpage nvme4/1 health 507nvme4/1: SMART/Health Information 508 Critical Warnings 509 Available Space: OK 510 Temperature: OK 511 Device Reliability: OK 512 Media: OK 513 Volatile Memory Backup: OK 514 Temperature: 37C 515 Available Spare Capacity: 100% 516 Available Spare Threshold: 10% 517 Device Life Used: 0% 518 Data Read: 0GB 519 Data Written: 64GB 520 Read Commands: 52907 521 Write Commands: 567874 522 Controller Busy: 1min 523 Power Cycles: 6 524 Power On: 141h 525 Unsafe Shutdowns: 1 526 Uncorrectable Media Errors: 0 527 Errors Logged: 1 528.Ed 529.It Sy Example 4: Get Asynchronous Event Configuration information 530.Bd -literal 531# nvmeadm get-features nvme0,nvme4 event,power 532nvme0: Get Features 533 Asynchronous Event Configuration 534 Available Space below threshold: disabled 535 Temperature above threshold: disabled 536 Device Reliability compromised: disabled 537 Media read-only: disabled 538 Power Management 539 Power State: 0 540nvme4: Get Features 541 Asynchronous Event Configuration 542 Available Space below threshold: disabled 543 Temperature above threshold: disabled 544 Device Reliability compromised: disabled 545 Media read-only: disabled 546 Volatile Memory Backup failed: disabled 547 Power Management 548 Power State: 0 549.Ed 550.It Sy Example 5: Load and activate firmware 551.Bd -literal 552# nvmeadm list-firmware nvme3 553nvme3: Firmware Slot Information 554 Active Firmware Slot: 4 555 Next Firmware Slot: 4 556 Firmware Revision for Slot 1: KNGND110 (read-only) 557 Firmware Revision for Slot 2: KNGND110 558 Firmware Revision for Slot 3: KNGND110 559 Firmware Revision for Slot 4: KNGND112 560 Firmware Revision for Slot 5: KNGND110 561 562# nvmeadm -v load-firmware nvme3 KNGND113.bin 5631740544 bytes downloaded. 564 565# nvmeadm -v commit-firmware nvme3 5 566Firmware committed to slot 5. 567 568# nvmeadm -v activate-firmware nvme3 5 569Slot 5 activated: NVM subsystem reset required - power cycle your system. 570 571# nvmeadm list-firmware nvme3 572nvme3: Firmware Slot Information 573 Active Firmware Slot: 4 574 Next Firmware Slot: 5 575 Firmware Revision for Slot 1: KNGND110 (read-only) 576 Firmware Revision for Slot 2: KNGND110 577 Firmware Revision for Slot 3: KNGND110 578 Firmware Revision for Slot 4: KNGND112 579 Firmware Revision for Slot 5: KNGND113 580.Ed 581.El 582.Sh INTERFACE STABILITY 583The command line interface of 584.Nm 585is 586.Sy Evolving . 587The output of 588.Nm 589is 590.Sy Not-an-Interface 591and may change any time. 592.Sh SEE ALSO 593.Xr nvme 4D 594.Pp 595.Lk http://www.nvmexpress.org/specifications/ "NVMe specifications" 596