xref: /freebsd/sbin/nvmecontrol/nvmecontrol.8 (revision ce3b53ff)
1.\"
2.\" Copyright (c) 2020 Warner Losh <imp@FreeBSD.org>
3.\" Copyright (c) 2018-2019 Alexander Motin <mav@FreeBSD.org>
4.\" Copyright (c) 2012 Intel Corporation
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions, and the following disclaimer,
12.\"    without modification.
13.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
14.\"    substantially similar to the "NO WARRANTY" disclaimer below
15.\"    ("Disclaimer") and any redistribution must be conditioned upon
16.\"    including a substantially similar Disclaimer requirement for further
17.\"    binary redistribution.
18.\"
19.\" NO WARRANTY
20.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
23.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30.\" POSSIBILITY OF SUCH DAMAGES.
31.\"
32.\" nvmecontrol man page.
33.\"
34.\" Author: Jim Harris <jimharris@FreeBSD.org>
35.\"
36.Dd April 17, 2024
37.Dt NVMECONTROL 8
38.Os
39.Sh NAME
40.Nm nvmecontrol
41.Nd NVM Express control utility
42.Sh SYNOPSIS
43.Nm
44.Ic devlist
45.Op Fl h
46.Nm
47.Ic identify
48.Op Fl v
49.Op Fl x
50.Op Fl n Ar nsid
51.Aq Ar device-id | Ar namespace-id
52.Nm
53.Ic perftest
54.Aq Fl n Ar num_threads
55.Aq Fl o Ar read|write
56.Op Fl p
57.Aq Fl s Ar size_in_bytes
58.Aq Fl t Ar time_in_sec
59.Aq Ar namespace-id
60.Nm
61.Ic reset
62.Aq Ar device-id
63.Nm
64.Ic logpage
65.Aq Fl p Ar page_id
66.Op Fl x
67.Op Fl v Ar vendor-string
68.Op Fl b
69.Op Fl f Ar LSP
70.Op Fl i Ar LSI
71.Op Fl r
72.Aq Ar device-id | Ar namespace-id
73.Nm
74.Ic ns active
75.Aq Ar device-id
76.Nm
77.Ic ns allocated
78.Aq Ar device-id
79.Nm
80.Ic ns attach
81.Aq Fl n Ar nsid
82.Aq Fl c Ar cntid
83.Aq Ar device-id
84.Nm
85.Ic ns attached
86.Aq Fl n Ar nsid
87.Aq Ar device-id
88.Nm
89.Ic ns controllers
90.Aq Ar device-id
91.Nm
92.Ic ns create
93.Aq Fl s Ar nsze
94.Op Fl c Ar ncap
95.Op Fl f Ar lbaf
96.Op Fl m Ar mset
97.Op Fl n Ar nmic
98.Op Fl p Ar pi
99.Op Fl l Ar pil
100.Op Fl L Ar flbas
101.Op Fl d Ar dps
102.Aq Ar device-id
103.Nm
104.Ic ns delete
105.Aq Fl n Ar nsid
106.Aq Ar device-id
107.Nm
108.Ic ns detach
109.Aq Fl n Ar nsid
110.Aq Fl c Ar cntid
111.Aq Ar device-id
112.Nm
113.Ic ns identify
114.Op Fl v
115.Op Fl x
116.Aq Fl n Ar nsid
117.Aq Ar device-id
118.Nm
119.Ic nsid
120.Aq Ar device-id | Ar namespace-id
121.Nm
122.Ic resv acquire
123.Aq Fl c Ar crkey
124.Op Fl p Ar prkey
125.Aq Fl t Ar rtype
126.Aq Fl a Ar racqa
127.Aq Ar namespace-id
128.Nm
129.Ic resv register
130.Op Fl i
131.Op Fl c Ar crkey
132.Aq Fl k Ar nrkey
133.Aq Fl r Ar rrega
134.Op Fl p Ar cptpl
135.Aq Ar namespace-id
136.Nm
137.Ic resv release
138.Aq Fl c Ar crkey
139.Aq Fl t Ar rtype
140.Aq Fl a Ar rrela
141.Aq Ar namespace-id
142.Nm
143.Ic resv report
144.Op Fl e
145.Op Fl v
146.Op Fl x
147.Aq Ar namespace-id
148.Nm
149.Ic firmware
150.Op Fl s Ar slot
151.Op Fl f Ar path_to_firmware
152.Op Fl a
153.Aq Ar device-id
154.Nm
155.Ic format
156.Op Fl f Ar fmt
157.Op Fl m Ar mset
158.Op Fl p Ar pi
159.Op Fl l Ar pil
160.Op Fl E
161.Op Fl C
162.Aq Ar device-id | Ar namespace-id
163.Nm
164.Ic sanitize
165.Aq Fl a Ar sanact
166.Op Fl c Ar owpass
167.Op Fl d
168.Op Fl p Ar ovrpat
169.Op Fl r
170.Op Fl I
171.Op Fl U
172.Aq Ar device-id
173.Nm
174.Ic power
175.Op Fl l
176.Op Fl p power_state
177.Op Fl w workload_hint
178.Nm
179.Ic selftest
180.Aq Fl c Ar code
181.Aq Ar device-id | Ar namespace-id
182.Nm
183.Ic wdc cap-diag
184.Op Fl o path_template
185.Aq Ar device-id
186.Nm
187.Ic wdc drive-log
188.Op Fl o path_template
189.Aq Ar device-id
190.Nm
191.Ic wdc get-crash-dump
192.Op Fl o path_template
193.Aq Ar device-id
194.\" .Nm
195.\" .Ic wdc purge
196.\" .Aq device-id
197.\" .Nm
198.\" .Ic wdc purge-monitor
199.\" .Aq device-id
200.Nm
201.Ic admin-passthru
202.Op args
203.Aq Ar device-id
204.Nm
205.Ic io-passthru
206.Op args
207.Aq Ar namespace-id
208.Sh DESCRIPTION
209NVM Express (NVMe) is a storage protocol standard, for SSDs and other
210high-speed storage devices over PCI Express.
211.Ss devlist
212List all NVMe controllers and namespaces along with their device nodes.
213With the
214.Fl h
215argument, use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte
216and Pebibyte (based on powers of 1024) when showing the disk space.
217By default, uses Mebibyte.
218.Ss identify
219The identify commands reports information from the drive's
220.Dv IDENTIFY_CONTROLLER
221if a
222.Ar device-id
223is specified.
224It reports
225.Dv IDENTIFY_NAMESPACE
226data if a
227.Ar namespace-id
228is specified.
229When used with disk names, the
230.Dv IDENTIFY_NAMESPACE
231data is reported, unless the namespace
232.Ar nsid
233is overridden with the
234.Fl n
235flag.
236Then that namespace's data is reported, if it exists.
237The command accepts the following parameters:
238.Bl -tag -width 6n
239.It Fl n
240The namespace
241.Aq nsid
242to use instead of the namespace associated with the device.
243A
244.Ar nsid
245of
246.Dq 0
247is used to retrieve the
248.Dv IDENTIFY_CONTROLLER
249data associated with that drive.
250.El
251.Ss logpage
252The logpage command knows how to print log pages of various types.
253It also knows about vendor specific log pages from hgst/wdc, samsung and intel.
254Note that some vendors use the same log page numbers for different data.
255.Pp
256.Bl -tag -compact -width "Page 0x00"
257.It Dv Page 0x01
258Drive Error Log
259.It Dv Page 0x02
260Health/SMART Data
261.It Dv Page 0x03
262Firmware Information
263.It Dv Page 0x04
264Changed Namespace List
265.It Dv Page 0x05
266Commands Supported and Effects
267.It Dv Page 0x06
268Device Self-test
269.It Dv Page 0x80
270Reservation Notification
271.It Dv Page 0x81
272Sanitize Status
273.It Dv Page 0xc1
274Advanced SMART information (WDC/HGST)
275.It Dv Page 0xc1
276Read latency stats (Intel)
277.It Dv Page 0xc2
278Wite latency stats (Intel)
279.It Dv Page 0xc5
280Temperature stats (Intel)
281.It Dv Page 0xca
282Advanced SMART information (Intel)
283.It Dv Page 0xca
284Extended SMART information (Samsung)
285.El
286.Pp
287Specifying
288.Fl v
289.Ic help
290will list all valid vendors and pages.
291.Fl x
292will print the page as hex.
293.Fl b
294will print the binary data for the page.
295.Fl s
296will set Log Specific Field.
297.Fl i
298will set Log Specific Identifier.
299.Fl r
300will set Retain Asynchronous Event.
301.Ss ns
302Various namespace management commands.
303If namespace management is supported by device, allow list, create and delete
304namespaces, list, attach and detach controllers to namespaces.
305Each NVM device consists of one or more NVM subsystems.
306Each NVM subsystem has one or more NVM ports.
307Each NVM port is attached to one or more NVM controllers (though typically 1).
308Each NVM controller is attached to one or more namespaces.
309.Pp
310After a namespace is created, it is considered
311.Dq allocated .
312All namespaces that have not been created are unallocated.
313An allocated namespace may be active or inactive.
314An active namespace is attached to the controller and may be interacted with.
315A namespace can move from active to inactive when detached.
316An allocated namespace may be deleted to become unallocated.
317For more details on the nuances of NVM namespaces, please see section 2
318.Em Theory of Operation
319and section 3
320.Em NVM Express Architecture
321of the latest NVM standard.
322.Ss ns active
323Provide a list of active namespace identifiers for the givne NVM controller.
324.Ss ns allocated
325Provide a list of allocated namespace identifiers for the givne NVM controller.
326.Ss ns attach
327Attach an nsid to a controller.
328The primary controller is used if one is not specified.
329.Ss ns attached
330Provide a list of controllers attached to a nsid.
331If only a nvme controller argument is provided, a nsid must also be specified.
332.Ss ns controllers
333Provide a list of all controllers in the NVM subsystem.
334.Ss ns create
335Creates a new namespace.
336.Ss ns delete
337Delete a namespace.
338It must be currently inactive.
339.Ss ns detach
340Detach a namespace from a controller.
341The namespace will become inaccessible, but its contents will remain if it is
342.Em activated
343again.
344.Ss ns identify
345Print detailed information about the namespace.
346.Ss nsid
347Reports the namespace id and controller device associated with the
348.Aq Ar namespace-id
349or
350.Aq Ar device-id
351argument.
352.Ss resv acquire
353Acquire or preempt namespace reservation, using specified parameters:
354.Bl -tag -width 6n
355.It Fl a
356Acquire action:
357.Bl -tag -compact -width 6n
358.It Dv 0
359Acquire
360.It Dv 1
361Preempt
362.It Dv 2
363Preempt and abort
364.El
365.It Fl c
366Current reservation key.
367.It Fl p
368Preempt reservation key.
369.It Fl t
370Reservation type:
371.Bl -tag -compact -width 6n
372.It Dv 1
373Write Exclusive
374.It Dv 2
375Exclusive Access
376.It Dv 3
377Write Exclusive - Registrants Only
378.It Dv 4
379Exclusive Access - Registrants Only
380.It Dv 5
381Write Exclusive - All Registrants
382.It Dv 6
383Exclusive Access - All Registrants
384.El
385.El
386.Ss resv register
387Register, unregister or replace reservation key, using specified parameters:
388.Bl -tag -width 6n
389.It Fl c
390Current reservation key.
391.It Fl k
392New reservation key.
393.It Fl r
394Register action:
395.Bl -tag -compact -width 6n
396.It Dv 0
397Register
398.It Dv 1
399Unregister
400.It Dv 2
401Replace
402.El
403.It Fl i
404Ignore Existing Key
405.It Fl p
406Change Persist Through Power Loss State:
407.Bl -tag -compact -width 6n
408.It Dv 0
409No change to PTPL state
410.It Dv 2
411Set PTPL state to ‘0’.
412Reservations are released and registrants are cleared on a power on.
413.It Dv 3
414Set PTPL state to ‘1’.
415Reservations and registrants persist across a power loss.
416.El
417.El
418.Ss resv release
419Release or clear reservation, using specified parameters:
420.Bl -tag -width 6n
421.It Fl c
422Current reservation key.
423.It Fl t
424Reservation type.
425.It Fl a
426Release action:
427.Bl -tag -compact -width 6n
428.It Dv 0
429Release
430.It Dv 1
431Clean
432.El
433.El
434.Ss resv report
435Print reservation status, using specified parameters:
436.Bl -tag -width 6n
437.It Fl x
438Print reservation status in hex.
439.It Fl e
440Use Extended Data Structure.
441.El
442.Ss format
443Format either specified namespace, or all namespaces of specified controller,
444using specified parameters:
445.Bl -tag -width 8n
446.It Fl f Ar fmt
447The index
448.Ar fmt
449of the parameters to use.
450LBA Format #, as specified in the identification of the namespace using
451.Dq nvmecontrol identify
452command with a namespace specified maps this index into these parameters.
453.It Fl m Ar mset
454Metadata Setting.
455.Ar mset
456.Bl -tag -compact -width 6n
457.It Dv 0
458do not transfer metadata with LBA information
459.It Dv 1
460Transfer the metadata as part of the extended LBA information.
461.El
462.It Fl p Ar pi
463Protection Information.
464.Bl -tag -compact -width 6n
465.It Dv 0
466Protection Information not enabled.
467.It Dv 1
468Type 1 information protection enabled.
469.It Dv 2
470Type 2 information protection enabled.
471.It Dv 3
472Type 3 information protection enabled.
473.El
474.It Fl l Ar pil
475Protection Information Location.
476.Bl -tag -compact -width 6n
477.It Dv 0
478Transfer the protection metadata as the last N bytes of the transfer.
479.It Dv 1
480Transfer the protection metadata as the first N bytes of the transfer.
481.El
482.It Fl E
483Enables User Data Erase during format.
484All users data is erased and subsequent reads are indeterminate.
485The drive may implement this as a cryptographic erase or it may
486physically erase the underlying media.
487.It Fl C
488Enables Cryptographic Erase during format.
489All user data is erased  cryptographically by deleting the encryption key,
490rendering it unintelligible.
491.El
492.Pp
493When formatting specific namespace, existing values are used as defaults.
494When formatting all namespaces, all parameters should be specified.
495Some controllers may not support formatting or erasing specific or all
496namespaces.
497The
498.Xr nvme 4
499driver does not currently support metadata and protection information
500transfers.
501.Ss sanitize
502Sanitize NVM subsystem of specified controller,
503using specified parameters:
504.Bl -tag -width 6n
505.It Fl a Ar operation
506Specify the sanitize operation to perform.
507.Bl -tag -width 16n
508.It overwrite
509Perform an overwrite operation by writing a user supplied
510data pattern to the device one or more times.
511The pattern is given by the
512.Fl p
513argument.
514The number of times is given by the
515.Fl c
516argument.
517.It block
518Perform a block erase operation.
519All the device's blocks are set to a vendor defined
520value, typically zero.
521.It crypto
522Perform a cryptographic erase operation.
523The encryption keys are changed to prevent the decryption
524of the data.
525.It exitfailure
526Exits a previously failed sanitize operation.
527A failed sanitize operation can only be exited if it was
528run in the unrestricted completion mode, as provided by the
529.Fl U
530argument.
531.El
532.It Fl c Ar passes
533The number of passes when performing an
534.Sq overwrite
535operation.
536Valid values are between 1 and 16.
537The default is 1.
538.It Fl d
539No Deallocate After Sanitize.
540.It Fl I
541When performing an
542.Sq overwrite
543operation, the pattern is inverted between consecutive passes.
544.It Fl p Ar pattern
54532 bits of pattern to use when performing an
546.Sq overwrite
547operation.
548The pattern is repeated as needed to fill each block.
549.It Fl U
550Perform the sanitize in the unrestricted completion mode.
551If the operation fails, it can later be exited with the
552.Sq exitfailure
553operation.
554.It Fl r
555Run in
556.Dq report only
557mode.
558This will report status on a sanitize that is already running on the drive.
559.El
560.Ss power
561Manage the power modes of the NVMe controller.
562.Bl -tag -width 6n
563.It Fl l
564List all supported power modes.
565.It Fl p Ar mode
566Set the power mode to
567.Ar mode .
568This must be a mode listed with the
569.Dl nvmecontrol power -l
570command.
571.It Fl w Ar hint
572Set the workload hint for automatic power mode control.
573.Bl -tag -compact -width 6n
574.It 0
575No workload hint is provided.
576.It 1
577Extended idle period workload.
578The device is often idle for minutes at a time.
579A burst of write commands comes in over a period of seconds.
580Then the device returns to being idle.
581.It 2
582Heavy sequential writes.
583A huge number of sequential writes will be submitted, filling the submission queues.
584.It Other
585All other values are reserved and have no standard meaning.
586.El
587Please see the
588.Dq NVM Subsystem Workloads
589section of the relevant NVM Express Base Standard for details.
590.El
591.Ss selftest
592Start the specified device self-test:
593.Bl -tag -width 6n
594.It Fl c Ar code
595Specify the device self-test command code.
596Common codes are:
597.Bl -tag -compact -width 6n
598.It Dv 0x1
599Start a short device self-test operation
600.It Dv 0x2
601Start an extended device self-test operation
602.It Dv 0xe
603Start a vendor specific device self-test operation
604.It Dv 0xf
605Abort the device self-test operation
606.El
607.El
608.Ss wdc
609The various wdc command retrieve log data from the wdc/hgst drives.
610The
611.Fl o
612flag specifies a path template to use to output the files.
613Each file takes the path template (which defaults to nothing), appends
614the drive's serial number and the type of dump it is followed
615by .bin.
616These logs must be sent to the vendor for analysis.
617This tool only provides a way to extract them.
618.Ss passthru
619The
620.Dq admin-passthru
621and
622.Dq io-passthru
623commands send NVMe commands to
624either the administrative or the data part of the device.
625These commands are expected to be compatible with nvme-cli.
626Please see the NVM Express Base Standard for details.
627.Bl -tag -width 16n
628.It Fl o -opcode Ar opcode
629Opcode to send.
630.It Fl 2 -cdw2 Ar value
63132-bit value for CDW2.
632.It Fl 3 -cdw3 Ar value
63332-bit value for CDW3.
634.It Fl 4 -cdw10 Ar value
63532-bit value for CDW10.
636.It Fl 5 -cdw11 Ar value
63732-bit value for CDW11.
638.It Fl 6 -cdw12 Ar value
63932-bit value for CDW12.
640.It Fl 7 -cdw13 Ar value
64132-bit value for CDW13.
642.It Fl 8 -cdw14 Ar value
64332-bit value for CDW14.
644.It Fl 9 -cdw15 Ar value
64532-bit value for CDW15.
646.It Fl l -data-len
647Length of the data for I/O (bytes).
648.It Fl m -metadata-len
649Length of the metadata segment for command (bytes).
650This is ignored and not implemented in
651.Xr nvme 4 .
652.It Fl f -flags
653Nvme command flags.
654.It Fl n -namespace-id
655Namespace ID for command (Ignored).
656.It Fl p -prefill
657Value to prefill payload with.
658.It Fl b -raw-binary
659Output in binary format (otherwise a hex dump is produced).
660.It Fl d -dry-run
661Do not actually execute the command, but perform sanity checks on it.
662.It Fl r -read
663Command reads data from the device.
664.It Fl s -show-command
665Show all the command values on stdout.
666.It Fl w -write
667Command writes data to the device.
668.El
669.Pp
670Send arbitrary commands to the device.
671Can be used to extract vendor specific logs.
672Transfers to/from the device possible, but limited to
673.Dv MAXPHYS
674bytes.
675Commands either read data or write it, but not both.
676Commands needing metadata are not supported by the
677.Xr nvme 4
678drive.
679.Sh DEVICE NAMES
680Where
681.Aq Ar namespace-id
682is required, you can use either the
683.Pa nvmeXnsY
684device, or the disk device such as
685.Pa ndaZ
686or
687.Pa nvdZ .
688The leading
689.Pa /dev/
690is omitted.
691Where
692.Aq Ar device-id
693is required, you can use either the
694.Pa nvmeX
695device, or the disk device such as
696.Pa ndaZ
697or
698.Pa nvdZ .
699For commands that take an optional
700.Aq nsid
701you can use it to get information on other namespaces, or to query the
702drive itself.
703A
704.Aq nsid
705of
706.Dq 0
707means query the drive itself.
708.Sh EXAMPLES
709.Dl nvmecontrol devlist
710.Pp
711Display a list of NVMe controllers and namespaces along with their device nodes.
712.Pp
713.Dl nvmecontrol identify nvme0
714.Dl nvmecontrol identify -n 0 nvd0
715.Pp
716Display a human-readable summary of the nvme0
717.Dv IDENTIFY_CONTROLLER
718data.
719In this example, nvd0 is connected to nvme0.
720.Pp
721.Dl nvmecontrol identify -x -v nvme0ns1
722.Dl nvmecontrol identify -x -v -n 1 nvme0
723.Pp
724Display an hexadecimal dump of the nvme0
725.Dv IDENTIFY_NAMESPACE
726data for namespace 1.
727.Pp
728.Dl nvmecontrol perftest -n 32 -o read -s 512 -t 30 nvme0ns1
729.Pp
730Run a performance test on nvme0ns1 using 32 kernel threads for 30 seconds.
731Each thread will issue a single 512 byte read command.
732Results are printed to stdout when 30 seconds expires.
733.Pp
734.Dl nvmecontrol reset nvme0
735.Dl nvmecontrol reset nda4
736.Pp
737Perform a controller-level reset of the nvme0 controller.
738In this example, nda4 is wired to nvme0.
739.Pp
740.Dl nvmecontrol logpage -p 1 nvme0
741.Pp
742Display a human-readable summary of the nvme0 controller's Error Information Log.
743Log pages defined by the NVMe specification include Error Information Log (ID=1),
744SMART/Health Information Log (ID=2), and Firmware Slot Log (ID=3).
745.Pp
746.Dl nvmecontrol logpage -p 0xc1 -v wdc nvme0
747.Pp
748Display a human-readable summary of the nvme0's wdc-specific advanced
749SMART data.
750.Pp
751.Dl nvmecontrol logpage -p 1 -x nvme0
752.Pp
753Display a hexadecimal dump of the nvme0 controller's Error Information Log.
754.Pp
755.Dl nvmecontrol logpage -p 0xcb -b nvme0 > /tmp/page-cb.bin
756.Pp
757Print the contents of vendor specific page 0xcb as binary data on
758standard out.
759Redirect it to a temporary file.
760.Pp
761.Dl nvmecontrol firmware -s 2 -f /tmp/nvme_firmware nvme0
762.Pp
763Download the firmware image contained in "/tmp/nvme_firmware" to slot 2 of the
764nvme0 controller, but do not activate the image.
765.Pp
766.Dl nvmecontrol firmware -s 4 -a nvme0
767.Pp
768Activate the firmware in slot 4 of the nvme0 controller on the next reset.
769.Pp
770.Dl nvmecontrol firmware -s 7 -f /tmp/nvme_firmware -a nvme0
771.Pp
772Download the firmware image contained in "/tmp/nvme_firmware" to slot 7 of the
773nvme0 controller and activate it on the next reset.
774.Pp
775.Dl nvmecontrol power -l nvme0
776.Pp
777List all the current power modes.
778.Pp
779.Dl nvmecontrol power -p 3 nvme0
780.Pp
781Set the current power mode.
782.Pp
783.Dl nvmecontrol power nvme0
784.Pp
785Get the current power mode.
786.Pp
787.Dl nvmecontrol identify -n 0 nda0
788.Pp
789Identify the drive data associated with the
790.Pa nda0
791device.
792The corresponding
793.Pa nvmeX
794devices is used automatically.
795.Pp
796.Dl nvmecontrol identify nda0
797.Pp
798Get the namespace parameters associated with the
799.Pa nda0
800device.
801The corresponding
802.Pa nvmeXnsY
803device is used automatically.
804.Pp
805.Dl nvmecontrol format -f 2 -m 0 -p 0 -l 0 -C nvme2
806.Pp
807Format all the name spaces on nvme2 using parameters from
808.Dq LBA Format #2
809with no metadata or protection data using cryptographic erase.
810If the
811.Dq nvmecontrol identify -n 1 nvme2
812command ended with
813.Pp
814.Bl -verbatim
815LBA Format #00: Data Size:   512  Metadata Size:     0  Performance: Good
816LBA Format #01: Data Size:   512  Metadata Size:     8  Performance: Good
817LBA Format #02: Data Size:  4096  Metadata Size:     0  Performance: Good
818LBA Format #03: Data Size:  4096  Metadata Size:     8  Performance: Good
819LBA Format #04: Data Size:  4096  Metadata Size:    64  Performance: Good
820.El
821.Pp
822then this would give a 4k data format for at least namespace 1, with no
823metadata.
824.Pp
825.Sh DYNAMIC LOADING
826The directories
827.Pa /lib/nvmecontrol
828and
829.Pa /usr/local/lib/nvmecontrol
830are scanned for any .so files.
831These files are loaded.
832The members of the
833.Va top
834linker set are added to the top-level commands.
835The members of the
836.Va logpage
837linker set are added to the logpage parsers.
838.Sh SEE ALSO
839.Rs
840.%T The NVM Express Base Specification
841.%D June 10, 2019
842.%U https://nvmexpress.org/wp-content/uploads/NVM-Express-1_4-2019.06.10-Ratified.pdf
843.Re
844.Sh HISTORY
845The
846.Nm
847utility appeared in
848.Fx 9.2 .
849.Sh AUTHORS
850.An -nosplit
851.Nm
852was developed by Intel and originally written by
853.An Jim Harris Aq Mt jimharris@FreeBSD.org .
854.Pp
855This man page was written by
856.An Jim Harris Aq Mt jimharris@FreeBSD.org .
857