1.\" $NetBSD: nvmectl.8,v 1.6 2020/09/27 18:17:35 jdolecek Exp $ 2.\" 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: head/sbin/nvmecontrol/nvmecontrol.8 314230 2017-02-25 00:09:16Z imp $ 36.\" 37.Dd September 27, 2020 38.Dt NVMECTL 8 39.Os 40.Sh NAME 41.Nm nvmectl 42.Nd NVM Express control utility 43.Sh SYNOPSIS 44.Nm 45.Ic devlist 46.Nm 47.Ic identify 48.Op Fl x Op Fl v 49.Ar device_id 50.\".Nm 51.\".Ic perftest 52.\".Op Fl p 53.\".Aq Fl n Ar num_threads 54.\".Aq Fl o Ar read|write 55.\".Aq Fl s Ar size_in_bytes 56.\".Aq Fl t Ar time_in_sec 57.\".Aq namespace_id 58.\".Nm 59.\".Ic reset 60.\".Aq controller_id 61.Nm 62.Ic logpage 63.Op Fl x 64.Op Fl p Ar page_id 65.Op Fl v Ar vendor-string 66.Op Fl b 67.Ar device_id Ns | Ns Ar namespace_id 68.\".Nm 69.\".Ic firmware 70.\".Op Fl a 71.\".Op Fl s Ar slot 72.\".Op Fl f Ar path_to_firmware 73.\".Aq device id 74.Nm 75.Ic power 76.Op Fl l 77.Op Fl s 78.Op Fl p Ar power_state 79.Op Fl w Ar workload_hint 80.Ar device_id 81.Nm 82.Ic wdc cap-diag 83.Op Fl o path_template 84.Ar device_id 85.Sh DESCRIPTION 86NVM Express (NVMe) is a storage protocol standard, for SSDs and other 87high-speed storage devices over PCI Express. 88.Ss power 89The power command controls the supported power states. 90.Fl l 91will list supported power states. 92.Fl p 93will set the power state to specified value. 94.Fl w 95will set workload value. 96With 97.Fl s , 98the specified power state and workload value is saved, 99so it persists any autonomous transitions and resets. 100Support for saving the values is optional, and depends on the controller. 101.Ss logpage 102The logpage command knows how to print log pages of various types. 103It also knows about vendor specific log pages from hgst/wdc and intel. 104Page 0xc1 for hgst/wdc contains the advanced smart information about 105the drive. 106Page 0xc1 is read latency stats for intel. 107Page 0xc2 is write latency stats for intel. 108Page 0xc5 is temperature stats for intel. 109Page 0xca is advanced smart information for intel. 110.Pp 111Specifying 112.Fl p 113.Ic help 114will list all valid vendors and pages. 115.Fl x 116will print the page as hex. 117.Fl b 118will print the binary data for the page. 119.Ss wdc 120The various wdc commands retrieve log data from the wdc/hgst drives. 121The 122.Fl o 123flag specifies a path template to use to output the files. 124Each file takes the path template (which defaults to nothing), appends 125the drive's serial number and the type of dump it is followed 126by 127.Pa .bin . 128These logs must be sent to the vendor for analysis. 129This tool only provides a way to extract them. 130.Sh EXAMPLES 131.Dl nvmectl devlist 132.Pp 133Display a list of NVMe controllers and namespaces along with their device nodes. 134.Pp 135.Dl nvmectl identify nvme0 136.Pp 137Display a human-readable summary of the nvme0 IDENTIFY_CONTROLLER data. 138.Pp 139.Dl nvmectl identify -x -v nvme0ns1 140.Pp 141Display an hexadecimal dump of the nvme0 142.Dv IDENTIFY_NAMESPACE 143data for namespace 1. 144.\".Pp 145.\".Dl nvmectl perftest -n 32 -o read -s 512 -t 30 nvme0ns1 146.\".Pp 147.\"Run a performance test on nvme0ns1 using 32 kernel threads for 30 seconds. 148.\"Each thread will issue a single 512 byte read command. 149.\"Results are printed to stdout when 30 seconds expires. 150.\".Pp 151.\".Dl nvmectl reset nvme0 152.\".Pp 153.\"Perform a controller-level reset of the nvme0 controller. 154.Pp 155.Dl nvmectl logpage -p 1 nvme0 156.Pp 157Display a human-readable summary of the nvme0 controller's Error Information Log. 158Log pages defined by the NVMe specification include Error Information Log (ID=1), 159SMART/Health Information Log (ID=2), and Firmware Slot Log (ID=3). 160.Pp 161.Dl nvmectl logpage -p 0xc1 -v wdc nvme0 162.Pp 163Display a human-readable summary of the nvme0's wdc-specific advanced 164SMART data. 165.Pp 166.Dl nvmectl logpage -p 1 -x nvme0 167.Pp 168Display a hexadecimal dump of the nvme0 controller's Error Information Log. 169.Pp 170.Dl nvmectl logpage -p 0xcb -b nvme0 > /tmp/page-cb.bin 171.Pp 172Print the contents of vendor specific page 0xcb as binary data on 173standard out. 174Redirect it to a temporary file. 175.\".Pp 176.\".Dl nvmectl firmware -s 2 -f /tmp/nvme_firmware nvme0 177.\".Pp 178.\"Download the firmware image contained in "/tmp/nvme_firmware" to slot 2 of the 179.\"nvme0 controller, but do not activate the image. 180.\".Pp 181.\".Dl nvmectl firmware -s 4 -a nvme0 182.\".Pp 183.\"Activate the firmware in slot 4 of the nvme0 controller on the next reset. 184.\".Pp 185.\".Dl nvmectl firmware -s 7 -f /tmp/nvme_firmware -a nvme0 186.\".Pp 187.\"Download the firmware image contained in "/tmp/nvme_firmware" to slot 7 of the 188.\"nvme0 controller and activate it on the next reset. 189.Pp 190.Dl nvmectl power -l nvme0 191.Pp 192List all the current power modes. 193.Pp 194.Dl nvmectl power -p 3 nvme0 195.Pp 196Set the current power mode. 197.Pp 198.Dl nvmectl power nvme0 199.Pp 200Get the current power mode. 201.Sh HISTORY 202The nvmecontrol utility appeared in 203.Fx 9.2 . 204.Sh AUTHORS 205.An -nosplit 206nvmecontrol was developed by Intel and originally written by 207.An Jim Harris Aq Mt jimharris@FreeBSD.org . 208.Pp 209This man page was written by 210.An Jim Harris Aq Mt jimharris@FreeBSD.org . 211