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