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