1NVME-ID-CTRL(1)                   NVMe Manual                  NVME-ID-CTRL(1)
2
3
4

NAME

6       nvme-id-ctrl - Send NVMe Identify Controller, return result and
7       structure
8

SYNOPSIS

10       nvme id-ctrl <device> [-v | --vendor-specific] [-b | --raw-binary]
11                               [-o <fmt> | --output-format=<fmt>]
12

DESCRIPTION

14       For the NVMe device given, sends an identify controller command and
15       provides the result and returned structure.
16
17       The <device> parameter is mandatory and may be either the NVMe
18       character device (ex: /dev/nvme0), or a namespace block device (ex:
19       /dev/nvme0n1).
20
21       On success, the structure may be returned in one of several ways
22       depending on the option flags; the structure may be parsed by the
23       program or the raw buffer may be printed to stdout.
24

OPTIONS

26       -b, --raw-binary
27           Print the raw buffer to stdout. Structure is not parsed by program.
28           This overrides the vendor specific and human readable options.
29
30       -v, --vendor-specific
31           In addition to parsing known fields, this option will dump the
32           vendor specific region of the structure in hex with ascii
33           interpretation.
34
35       -H, --human-readable
36           This option will parse and format many of the bit fields into
37           human-readable formats.
38
39       -o <format>, --output-format=<format>
40           Set the reporting format to normal, json, or binary. Only one
41           output format can be used at a time.
42

EXAMPLES

44       •   Has the program interpret the returned buffer and display the known
45           fields in a human readable format:
46
47               # nvme id-ctrl /dev/nvme0
48
49       •   In addition to showing the known fields, has the program to display
50           the vendor unique field:
51
52               # nvme id-ctrl /dev/nvme0 --vendor-specific
53               # nvme id-ctrl /dev/nvme0 -v
54
55           The above will dump the vs buffer in hex since it doesn’t know how
56           to interpret it.
57
58       •   Have the program return the raw structure in binary:
59
60               # nvme id-ctrl /dev/nvme0 --raw-binary > id_ctrl.raw
61               # nvme id-ctrl /dev/nvme0 -b > id_ctrl.raw
62
63           It is probably a bad idea to not redirect stdout when using this
64           mode.
65
66       •   Alternatively you may want to send the data to another program that
67           can parse the raw buffer.
68
69               # nvme id-ctrl /dev/nvme0 --raw-binary | nvme_parse_id_ctrl
70
71           The parse program in the above example can be a program that shows
72           the structure in a way you like. The following program is such an
73           example that will parse it and can accept the output through a
74           pipe, '|', as shown in the above example, or you can 'cat' a saved
75           output buffer to it.
76
77           /* File: nvme_parse_id_ctrl.c */
78
79           #include <linux/nvme.h>
80           #include <stdio.h>
81           #include <unistd.h>
82
83           int main(int argc, char **argv)
84           {
85                   unsigned char buf[sizeof(struct nvme_id_ctrl)];
86                   struct nvme_id_ctrl *ctrl = (struct nvme_id_ctrl *)buf;
87
88                   if (read(STDIN_FILENO, buf, sizeof(buf)))
89                           return 1;
90
91                   printf("vid   : %#x\n", ctrl->vid);
92                   printf("ssvid : %#x\n", ctrl->ssvid);
93                   return 0;
94           }
95

NVME

97       Part of the nvme-user suite
98
99
100
101NVMe                              04/11/2022                   NVME-ID-CTRL(1)
Impressum