NVME-ID-NS(1)
nvme-id-ns(1) β the NVMe Manual era π
okay bestie, welcome to your new fave page from the NVMe Manual β it's nvme-id-ns, and she is literally the moment β¨
β¨ NAME β¨
nvme-id-ns β Send NVMe Identify Namespace, return result and structure π
π¦ SYNOPSIS π¦
nvme [<global-options>] id ns <device>
[--vendor-specific | -V]
[--raw-binary | -b]
[--namespace-id=<nsid> | -n <nsid>]
[--force]
π DESCRIPTION π
so for the NVMe device you hand her, she sends an identify namespace command and then gives you back the result and the returned structure. no cap π«Ά
The <device> parameter is mandatory β you can't skip her, she's the main character. And it can be either:
- the NVMe character device (ex:
/dev/nvme0), or - a namespace block device (ex:
/dev/nvme0n1).
If you give her the character device, the --namespace-id option is mandatory, otherwise she'll just use the ns-id of the namespace for the block device you opened. For block devices, the ns-id she uses can be overridden with that same option. iykyk π
On success, the structure may be returned in one of several ways depending on the option flags β the structure might be parsed by the program, or the raw buffer may be printed to stdout. pick your vibe πΈ
heads up bestie: the barenvme id-nsform (without a space) still works as a deprecated alias and will be removed in a future major version. New scripts should usenvme id nsinstead. fr fr, update your scripts, it's giving "moved on" energy π
π OPTIONS π
-n <nsid>,--namespace-id=<nsid>β Retrieve the identify namespace structure for the given nsid. This is required for the character devices, or overrides the block nsid if given. If the controller supports namespace management capability and0xFFFFFFFFis given, then the controller returns the identify namespace structure that specifies common capabilities across namespaces for the controller. The broadcast value0xffffffffcan also be given asallor-1. icon behavior honestly π--forceβ Request controller return the identify namespace structure even if the namespace is not attached to the controller. This is valid only for controllers at or newer than revision1.2. Controllers at revision lower than this may interpret the command incorrectly. π«£ so like, watch out β older controllers might fumble it.-b,--raw-binaryβ Print the raw buffer to stdout. Structure is not parsed by program. This overrides the vendor specific and human readable options. raw and unfiltered, periodt π-V,--vendor-specificβ In addition to parsing known fields, this option will dump the vendor specific region of the structure in hex with ascii interpretation. cute little hex + ascii moment β¨
π GLOBAL OPTIONS π
these ones live at the top-level nvme command and are available to this subcommand, so you can absolutely use them here π«Ά
--dry-runβ Print the command that would be executed, but do not actually execute it. manifesting without the commitment π§--no-ioctl-probingβ Disable probing for 64-bit IOCTL support.--no-retriesβ Disable retry logic on transient errors.-o <fmt>,--output-format=<fmt>β Set the reporting format tonormal,tabular,'json, orbinary. Only one output format may be used at a time. pick one, bestie, you can't have all four πΈ--output-format-version=<version>β Select the output format version. Version1uses the original field naming, while version2(default) provides more consistent and script-friendly field names. Other versions are rejected. π«--quietβ Suppress informational messages. Errors are still reported, and--quietcancels any--verbosefor the library log level. she's quiet but she's still telling you when things go wrong π--set-options=<key=value>[,<key=value>...]β Set libnvme library options for this invocation. Supported keys areforce-4k,mi-probe-enabled,test-base-dirandtest-sysfs-dir.--timeout=<ms>β Set the timeout for the command in milliseconds.infiniteor-1waits without a time limit (0xffffffff). no clock, no stress β-v,--verboseβ Increase the level of detail in the output. May be specified multiple times to further increase verbosity. stack her up π₯
These options can also be set as machine-wide defaults in nvme-cli.conf(5). A command-line flag always overrides the file. β¨
π EXAMPLES π
- Has the program interpret the returned buffer and display the known fields in a human readable format:
# nvme id ns /dev/nvme0n1
- If using the character device or overriding namespace id:
# nvme id ns /dev/nvme0 -n 1
# nvme id ns /dev/nvme0n1 -n 1
# nvme id ns /dev/nvme0 --namespace-id=1
- In addition to showing the known fields, have the program to display the vendor unique field:
# nvme id ns /dev/nvme0n1 --vendor-specific
# nvme id ns /dev/nvme0n1 -V
The above will dump the 'vs' buffer in hex since it doesn't know how to interpret it. π
- Have the program return the raw structure in binary:
# nvme id ns /dev/nvme0n1 --raw-binary > id_ns.raw
# nvme id ns /dev/nvme0n1 -b > id_ns.raw
warning bestie: it is probably a bad idea to not redirect stdout when using this mode. π like, actually redirect it. pls.
- Alternatively you may want to send the data to another program that can parse the raw buffer.
# nvme id ns /dev/nvme0n1 --raw-binary | nvme_parse_id_ns
The parse program in the above example can be a program that shows the structure in a way you like. The following program is such an example that will parse it and can accept the output through a pipe, '|', as shown in the above example, or you can 'cat' a saved output buffer to it. π§
/* File: nvme_parse_id_ns.c */
#include <linux/nvme.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv)
{
unsigned char buf[sizeof(struct nvme_id_ns)];
struct nvme_id_ns *ns = (struct nvme_id_ns *)buf;
if (read(STDIN_FILENO, buf, sizeof(buf)))
return 1;
printf("nsze : %#llx\n", ns->nsze);
printf("ncap : %#llx\n", ns->ncap);
return 0;
}
π NVME π
Part of the nvme-user suite π
and that's the whole page, bestie β slay π β¨
sign-off vibes π: this gem is from the NVMe crew, dated 10/30/2026, and she goes by the name NVME-ID-NS(1). go forth and identify those namespaces, ily π«Άπ
π¦ where this page comes from
- arch rolling: nvme-cli 3.2-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms