]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/nvmecontrol/nvmecontrol.8
Merge ACPICA 20191018.
[FreeBSD/FreeBSD.git] / sbin / nvmecontrol / nvmecontrol.8
1 .\"
2 .\" Copyright (c) 2018-2019 Alexander Motin <mav@FreeBSD.org>
3 .\" Copyright (c) 2012 Intel Corporation
4 .\" All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions, and the following disclaimer,
11 .\"    without modification.
12 .\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
13 .\"    substantially similar to the "NO WARRANTY" disclaimer below
14 .\"    ("Disclaimer") and any redistribution must be conditioned upon
15 .\"    including a substantially similar Disclaimer requirement for further
16 .\"    binary redistribution.
17 .\"
18 .\" NO WARRANTY
19 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 .\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
22 .\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 .\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 .\" POSSIBILITY OF SUCH DAMAGES.
30 .\"
31 .\" nvmecontrol man page.
32 .\"
33 .\" Author: Jim Harris <jimharris@FreeBSD.org>
34 .\"
35 .\" $FreeBSD$
36 .\"
37 .Dd August 5, 2019
38 .Dt NVMECONTROL 8
39 .Os
40 .Sh NAME
41 .Nm nvmecontrol
42 .Nd NVM Express control utility
43 .Sh SYNOPSIS
44 .Nm
45 .Ic devlist
46 .Nm
47 .Ic identify
48 .Op Fl v
49 .Op Fl x
50 .Aq device id
51 .Aq 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 namespace id
60 .Nm
61 .Ic reset
62 .Aq controller 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 device id
73 .Aq namespace id
74 .Nm
75 .Ic ns active
76 .Aq device id
77 .Nm
78 .Ic ns allocated
79 .Aq device id
80 .Nm
81 .Ic ns attach
82 .Aq Fl n Ar nsid
83 .Aq Fl c Ar cntid
84 .Aq device id
85 .Nm
86 .Ic ns attached
87 .Aq Fl n Ar nsid
88 .Aq device id
89 .Nm
90 .Ic ns controllers
91 .Aq device id
92 .Nm
93 .Ic ns create
94 .Aq Fl s Ar nsze
95 .Op Fl c Ar ncap
96 .Op Fl f Ar lbaf
97 .Op Fl m Ar mset
98 .Op Fl n Ar nmic
99 .Op Fl p Ar pi
100 .Op Fl l Ar pil
101 .Op Fl L Ar flbas
102 .Op Fl d Ar dps
103 .Aq device id
104 .Nm
105 .Ic ns delete
106 .Aq Fl n Ar nsid
107 .Aq device id
108 .Nm
109 .Ic ns detach
110 .Aq Fl n Ar nsid
111 .Aq Fl c Ar cntid
112 .Aq device id
113 .Nm
114 .Ic ns identify
115 .Op Fl v
116 .Op Fl x
117 .Aq Fl n Ar nsid
118 .Aq device id
119 .Nm
120 .Ic nsid
121 .Aq device id
122 .Aq namespace id
123 .Nm
124 .Ic resv acquire
125 .Aq Fl c Ar crkey
126 .Op Fl p Ar prkey
127 .Aq Fl t Ar rtype
128 .Aq Fl a Ar racqa
129 .Aq namespace id
130 .Nm
131 .Ic resv register
132 .Op Fl c Ar crkey
133 .Aq Fl k Ar nrkey
134 .Aq Fl r Ar rrega
135 .Op Fl i Ar iekey
136 .Op Fl p Ar cptpl
137 .Aq namespace id
138 .Nm
139 .Ic resv release
140 .Aq Fl c Ar crkey
141 .Aq Fl t Ar rtype
142 .Aq Fl a Ar rrela
143 .Aq namespace id
144 .Nm
145 .Ic resv report
146 .Op Fl e
147 .Op Fl v
148 .Op Fl x
149 .Aq namespace id
150 .Nm
151 .Ic firmware
152 .Op Fl s Ar slot
153 .Op Fl f Ar path_to_firmware
154 .Op Fl a
155 .Aq device id
156 .Nm
157 .Ic format
158 .Op Fl f Ar fmt
159 .Op Fl m Ar mset
160 .Op Fl o Ar pi
161 .Op Fl l Ar pil
162 .Op Fl E
163 .Op Fl C
164 .Aq device id
165 .Aq namespace id
166 .Nm
167 .Ic sanitize
168 .Aq Fl a Ar sanact
169 .Op Fl c Ar owpass
170 .Op Fl d
171 .Op Fl p Ar ovrpat
172 .Op Fl r
173 .Op Fl I
174 .Op Fl U
175 .Aq device id
176 .Nm
177 .Ic power
178 .Op Fl l
179 .Op Fl p power_state
180 .Op Fl w workload_hint
181 .Nm
182 .Ic wdc cap-diag
183 .Op Fl o path_template
184 .Aq device id
185 .Nm
186 .Ic wdc drive-log
187 .Op Fl o path_template
188 .Aq device id
189 .Nm
190 .Ic wdc get-crash-dump
191 .Op Fl o path_template
192 .Aq device id
193 .\" .Nm
194 .\" .Ic wdc purge
195 .\" .Aq device id
196 .\" .Nm
197 .\" .Ic wdc purge-monitor
198 .\" .Aq device id
199 .Sh DESCRIPTION
200 NVM Express (NVMe) is a storage protocol standard, for SSDs and other
201 high-speed storage devices over PCI Express.
202 .Pp
203 .Ss logpage
204 The logpage command knows how to print log pages of various types.
205 It also knows about vendor specific log pages from hgst/wdc and intel.
206 Note that some vendors use the same log page numbers for different data.
207 .Pp
208 .Bl -tag -compact -width "Page 0x00"
209 .It Dv Page 0x01
210 Drive Error Log
211 .It Dv Page 0x02
212 Health/SMART Data
213 .It Dv Page 0x03
214 Firmware Information
215 .It Dv Page 0x04
216 Changed Namespace List
217 .It Dv Page 0x05
218 Commands Supported and Effects
219 .It Dv Page 0x80
220 Reservation Notification
221 .It Dv Page 0x81
222 Sanitize Status
223 .It Dv Page 0xc1
224 Advanced SMART information (WDC/HGST)
225 .It Dv Page 0xc1
226 Read latency stats (Intel)
227 .It Dv Page 0xc2
228 Wite latency stats (Intel)
229 .It Dv Page 0xc5
230 Temperature stats (Intel)
231 .It Dv Page 0xca
232 Advanced SMART information (Intel)
233 .El
234 .Pp
235 Specifying
236 .Fl v
237 .Ic help
238 will list all valid vendors and pages.
239 .Fl x
240 will print the page as hex.
241 .Fl b
242 will print the binary data for the page.
243 .Fl s
244 will set Log Specific Field.
245 .Fl i
246 will set Log Specific Identifier.
247 .Fl r
248 will set Retain Asynchronous Event.
249 .Ss ns
250 Various namespace management commands.
251 If namespace management is supported by device, allow list, create and delete
252 namespaces, list, attach and detach controllers to namespaces.
253 .Ss resv acquire
254 Acquire or preempt namespace reservation, using specified parameters:
255 .Bl -tag -width 6n
256 .It Fl a
257 Acquire action:
258 .Bl -tag -compact -width 6n
259 .It Dv 0
260 Acquire
261 .It Dv 1
262 Preempt
263 .It Dv 2
264 Preempt and abort
265 .El
266 .It Fl c
267 Current reservation key.
268 .It Fl p
269 Preempt reservation key.
270 .It Fl t
271 Reservation type:
272 .Bl -tag -compact -width 6n
273 .It Dv 1
274 Write Exclusive
275 .It Dv 2
276 Exclusive Access
277 .It Dv 3
278 Write Exclusive - Registrants Only
279 .It Dv 4
280 Exclusive Access - Registrants Only
281 .It Dv 5
282 Write Exclusive - All Registrants
283 .It Dv 6
284 Exclusive Access - All Registrants
285 .El
286 .El
287 .Ss resv register
288 Register, unregister or replace reservation key, using specified parameters:
289 .Bl -tag -width 6n
290 .It Fl c
291 Current reservation key.
292 .It Fl k
293 New reservation key.
294 .It Fl r
295 Register action:
296 .Bl -tag -compact -width 6n
297 .It Dv 0
298 Register
299 .It Dv 1
300 Unregister
301 .It Dv 2
302 Replace
303 .El
304 .It Fl i
305 Ignore Existing Key
306 .It Fl p
307 Change Persist Through Power Loss State:
308 .Bl -tag -compact -width 6n
309 .It Dv 0
310 No change to PTPL state
311 .It Dv 2
312 Set PTPL state to ‘0’.
313 Reservations are released and registrants are cleared on a power on.
314 .It Dv 3
315 Set PTPL state to ‘1’.
316 Reservations and registrants persist across a power loss.
317 .El
318 .El
319 .Ss resv release
320 Release or clear reservation, using specified parameters:
321 .Bl -tag -width 6n
322 .It Fl c
323 Current reservation key.
324 .It Fl t
325 Reservation type.
326 .It Fl a
327 Release action:
328 .Bl -tag -compact -width 6n
329 .It Dv 0
330 Release
331 .It Dv 1
332 Clean
333 .El
334 .El
335 .Ss resv report
336 Print reservation status, using specified parameters:
337 .Bl -tag -width 6n
338 .It Fl x
339 Print reservation status in hex.
340 .It Fl e
341 Use Extended Data Structure.
342 .El
343 .Ss format
344 Format either specified namespace, or all namespaces of specified controller,
345 using specified parameters:
346 .Ar fmt
347 LBA Format,
348 .Ar mset
349 Metadata Settings,
350 .Ar pi
351 Protection Information,
352 .Ar pil
353 Protection Information Location.
354 When formatting specific namespace, existing values are used as defaults.
355 When formatting all namespaces, all parameters should be specified.
356 Some controllers may not support formatting or erasing specific or all
357 namespaces.
358 Option
359 .Fl E
360 enables User Data Erase during format.
361 Option
362 .Fl C
363 enables Cryptographic Erase during format.
364 .Ss sanitize
365 Sanitize NVM subsystem of specified controller,
366 using specified parameters:
367 .Bl -tag -width 6n
368 .It Fl a Ar operation
369 Specify the sanitize operation to perform.
370 .Bl -tag -width 16n
371 .It overwrite
372 Perform an overwrite operation by writing a user supplied
373 data pattern to the device one or more times.
374 The pattern is given by the
375 .Fl p
376 argument.
377 The number of times is given by the
378 .Fl c
379 argument.
380 .It block
381 Perform a block erase operation.
382 All the device's blocks are set to a vendor defined
383 value, typically zero.
384 .It crypto
385 Perform a cryptographic erase operation.
386 The encryption keys are changed to prevent the decryption
387 of the data.
388 .It exitfailure
389 Exits a previously failed sanitize operation.
390 A failed sanitize operation can only be exited if it was
391 run in the unrestricted completion mode, as provided by the
392 .Fl U
393 argument.
394 .El
395 .It Fl c Ar passes
396 The number of passes when performing an
397 .Sq overwrite
398 operation.
399 Valid values are between 1 and 16.
400 The default is 1.
401 .It Fl d
402 No Deallocate After Sanitize.
403 .It Fl I
404 When performing an
405 .Sq overwrite
406 operation, the pattern is inverted between consecutive passes.
407 .It Fl p Ar pattern
408 32 bits of pattern to use when performing an
409 .Sq overwrite
410 operation.
411 The pattern is repeated as needed to fill each block.
412 .It Fl U
413 Perform the sanitize in the unrestricted completion mode.
414 If the operation fails, it can later be exited with the
415 .Sq exitfailure
416 operation.
417 .It Fl r
418 Run in
419 .Dq report only
420 mode.
421 This will report status on a sanitize that is already running on the drive.
422 .El
423 .Ss wdc
424 The various wdc command retrieve log data from the wdc/hgst drives.
425 The
426 .Fl o
427 flag specifies a path template to use to output the files.
428 Each file takes the path template (which defaults to nothing), appends
429 the drive's serial number and the type of dump it is followed
430 by .bin.
431 These logs must be sent to the vendor for analysis.
432 This tool only provides a way to extract them.
433 .Sh EXAMPLES
434 .Dl nvmecontrol devlist
435 .Pp
436 Display a list of NVMe controllers and namespaces along with their device nodes.
437 .Pp
438 .Dl nvmecontrol identify nvme0
439 .Pp
440 Display a human-readable summary of the nvme0 IDENTIFY_CONTROLLER data.
441 .Pp
442 .Dl nvmecontrol identify -x -v nvme0ns1
443 .Pp
444 Display an hexadecimal dump of the nvme0 IDENTIFY_NAMESPACE data for namespace
445 1.
446 .Pp
447 .Dl nvmecontrol perftest -n 32 -o read -s 512 -t 30 nvme0ns1
448 .Pp
449 Run a performance test on nvme0ns1 using 32 kernel threads for 30 seconds.
450 Each thread will issue a single 512 byte read command.
451 Results are printed to stdout when 30 seconds expires.
452 .Pp
453 .Dl nvmecontrol reset nvme0
454 .Pp
455 Perform a controller-level reset of the nvme0 controller.
456 .Pp
457 .Dl nvmecontrol logpage -p 1 nvme0
458 .Pp
459 Display a human-readable summary of the nvme0 controller's Error Information Log.
460 Log pages defined by the NVMe specification include Error Information Log (ID=1),
461 SMART/Health Information Log (ID=2), and Firmware Slot Log (ID=3).
462 .Pp
463 .Dl nvmecontrol logpage -p 0xc1 -v wdc nvme0
464 .Pp
465 Display a human-readable summary of the nvme0's wdc-specific advanced
466 SMART data.
467 .Pp
468 .Dl nvmecontrol logpage -p 1 -x nvme0
469 .Pp
470 Display a hexadecimal dump of the nvme0 controller's Error Information Log.
471 .Pp
472 .Dl nvmecontrol logpage -p 0xcb -b nvme0 > /tmp/page-cb.bin
473 .Pp
474 Print the contents of vendor specific page 0xcb as binary data on
475 standard out.
476 Redirect it to a temporary file.
477 .Pp
478 .Dl nvmecontrol firmware -s 2 -f /tmp/nvme_firmware nvme0
479 .Pp
480 Download the firmware image contained in "/tmp/nvme_firmware" to slot 2 of the
481 nvme0 controller, but do not activate the image.
482 .Pp
483 .Dl nvmecontrol firmware -s 4 -a nvme0
484 .Pp
485 Activate the firmware in slot 4 of the nvme0 controller on the next reset.
486 .Pp
487 .Dl nvmecontrol firmware -s 7 -f /tmp/nvme_firmware -a nvme0
488 .Pp
489 Download the firmware image contained in "/tmp/nvme_firmware" to slot 7 of the
490 nvme0 controller and activate it on the next reset.
491 .Pp
492 .Dl nvmecontrol power -l nvme0
493 .Pp
494 List all the current power modes.
495 .Pp
496 .Dl nvmecontrol power -p 3 nvme0
497 .Pp
498 Set the current power mode.
499 .Pp
500 .Dl nvmecontrol power nvme0
501 .Pp
502 Get the current power mode.
503 .Sh DYNAMIC LOADING
504 The directories
505 .Pa /lib/nvmecontrol
506 and
507 .Pa /usr/local/lib/nvmecontrol
508 are scanned for any .so files.
509 These files are loaded.
510 The members of the
511 .Va top
512 linker set are added to the top-level commands.
513 The members of the
514 .Va logpage
515 linker set are added to the logpage parsers.
516 .Sh HISTORY
517 The
518 .Nm
519 utility appeared in
520 .Fx 9.2 .
521 .Sh AUTHORS
522 .An -nosplit
523 .Nm
524 was developed by Intel and originally written by
525 .An Jim Harris Aq Mt jimharris@FreeBSD.org .
526 .Pp
527 This man page was written by
528 .An Jim Harris Aq Mt jimharris@FreeBSD.org .