1.\" 2.\" Copyright (c) 2018 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 December 7, 2018 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.Aq device id 70.Aq namespace id 71.Nm 72.Ic firmware 73.Op Fl s Ar slot 74.Op Fl f Ar path_to_firmware 75.Op Fl a 76.Aq device id 77.Nm 78.Ic format 79.Op Fl f Ar fmt 80.Op Fl m Ar mset 81.Op Fl o Ar pi 82.Op Fl l Ar pil 83.Op Fl E 84.Op Fl C 85.Aq device id 86.Aq namespace id 87.Nm 88.Ic power 89.Op Fl l 90.Op Fl p power_state 91.Op Fl w workload_hint 92.Nm 93.Ic wdc cap-diag 94.Op Fl o path_template 95.Aq device id 96.Nm 97.Ic wdc drive-log 98.Op Fl o path_template 99.Aq device id 100.Nm 101.Ic wdc get-crash-dump 102.Op Fl o path_template 103.Aq device id 104.\" .Nm 105.\" .Ic wdc purge 106.\" .Aq device id 107.\" .Nm 108.\" .Ic wdc purge-monitor 109.\" .Aq device id 110.Sh DESCRIPTION 111NVM Express (NVMe) is a storage protocol standard, for SSDs and other 112high-speed storage devices over PCI Express. 113.Pp 114.Ss logpage 115The logpage command knows how to print log pages of various types. 116It also knows about vendor specific log pages from hgst/wdc and intel. 117Note that some vendors use the same log page numbers for different data. 118.Pp 119.Bl -tag -compact -width "Page 0x00" 120.It Dv Page 0x01 121Drive Error Log 122.It Dv Page 0x02 123Health/SMART Data 124.It Dv Page 0x03 125Firmware Information 126.It Dv Page 0xc1 127Advanced SMART information (WDC/HGST) 128.It Dv Page 0xc1 129Read latency stats (Intel) 130.It Dv Page 0xc2 131Wite latency stats (Intel) 132.It Dv Page 0xc5 133Temperature stats (Intel) 134.It Dv Page 0xca 135Advanced SMART information (Intel) 136.El 137.Pp 138Specifying 139.Fl p 140.Ic help 141will list all valid vendors and pages. 142.Fl x 143will print the page as hex. 144.Fl b 145will print the binary data for the page. 146.Ss format 147Format either specified namespace, or all namespaces of specified controller, 148using specified parameters: 149.Ar fmt 150LBA Format, 151.Ar mset 152Metadata Settings, 153.Ar pi 154Protection Information, 155.Ar pil 156Protection Information Location. 157When formatting specific namespace, existing values are used as defaults. 158When formatting all namespaces, all parameters should be specified. 159Some controllers may not support formatting or erasing specific or all 160namespaces. 161Option 162.Fl E 163enables User Data Erase during format. 164Option 165.Fl C 166enables Cryptographic Erase during format. 167.Ss wdc 168The various wdc command retrieve log data from the wdc/hgst drives. 169The 170.Fl o 171flag specifies a path template to use to output the files. 172Each file takes the path template (which defaults to nothing), appends 173the drive's serial number and the type of dump it is followed 174by .bin. 175These logs must be sent to the vendor for analysis. 176This tool only provides a way to extract them. 177.Sh EXAMPLES 178.Dl nvmecontrol devlist 179.Pp 180Display a list of NVMe controllers and namespaces along with their device nodes. 181.Pp 182.Dl nvmecontrol identify nvme0 183.Pp 184Display a human-readable summary of the nvme0 IDENTIFY_CONTROLLER data. 185.Pp 186.Dl nvmecontrol identify -x -v nvme0ns1 187.Pp 188Display an hexadecimal dump of the nvme0 IDENTIFY_NAMESPACE data for namespace 1891. 190.Pp 191.Dl nvmecontrol perftest -n 32 -o read -s 512 -t 30 nvme0ns1 192.Pp 193Run a performance test on nvme0ns1 using 32 kernel threads for 30 seconds. 194Each thread will issue a single 512 byte read command. 195Results are printed to stdout when 30 seconds expires. 196.Pp 197.Dl nvmecontrol reset nvme0 198.Pp 199Perform a controller-level reset of the nvme0 controller. 200.Pp 201.Dl nvmecontrol logpage -p 1 nvme0 202.Pp 203Display a human-readable summary of the nvme0 controller's Error Information Log. 204Log pages defined by the NVMe specification include Error Information Log (ID=1), 205SMART/Health Information Log (ID=2), and Firmware Slot Log (ID=3). 206.Pp 207.Dl nvmecontrol logpage -p 0xc1 -v wdc nvme0 208.Pp 209Display a human-readable summary of the nvme0's wdc-specific advanced 210SMART data. 211.Pp 212.Dl nvmecontrol logpage -p 1 -x nvme0 213.Pp 214Display a hexadecimal dump of the nvme0 controller's Error Information Log. 215.Pp 216.Dl nvmecontrol logpage -p 0xcb -b nvme0 > /tmp/page-cb.bin 217.Pp 218Print the contents of vendor specific page 0xcb as binary data on 219standard out. 220Redirect it to a temporary file. 221.Pp 222.Dl nvmecontrol firmware -s 2 -f /tmp/nvme_firmware nvme0 223.Pp 224Download the firmware image contained in "/tmp/nvme_firmware" to slot 2 of the 225nvme0 controller, but do not activate the image. 226.Pp 227.Dl nvmecontrol firmware -s 4 -a nvme0 228.Pp 229Activate the firmware in slot 4 of the nvme0 controller on the next reset. 230.Pp 231.Dl nvmecontrol firmware -s 7 -f /tmp/nvme_firmware -a nvme0 232.Pp 233Download the firmware image contained in "/tmp/nvme_firmware" to slot 7 of the 234nvme0 controller and activate it on the next reset. 235.Pp 236.Dl nvmecontrol power -l nvme0 237.Pp 238List all the current power modes. 239.Pp 240.Dl nvmecontrol power -p 3 nvme0 241.Pp 242Set the current power mode. 243.Pp 244.Dl nvmecontrol power nvme0 245.Pp 246Get the current power mode. 247.Sh DYNAMIC LOADING 248The directories 249.Pa /lib/nvmecontrol 250and 251.Pa /usr/local/lib/nvmecontrol 252are scanned for any .so files. 253These files are loaded. 254The members of the 255.Va top 256linker set are added to the top-level commands. 257The members of the 258.Va logpage 259linker set are added to the logpage parsers. 260.Sh HISTORY 261The 262.Nm 263utility appeared in 264.Fx 9.2 . 265.Sh AUTHORS 266.An -nosplit 267.Nm 268was developed by Intel and originally written by 269.An Jim Harris Aq Mt jimharris@FreeBSD.org . 270.Pp 271This man page was written by 272.An Jim Harris Aq Mt jimharris@FreeBSD.org . 273