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 bare nvme id-ns form (without a space) still works as a deprecated alias and will be removed in a future major version. New scripts should use nvme id ns instead. 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 and 0xFFFFFFFF is given, then the controller returns the identify namespace structure that specifies common capabilities across namespaces for the controller. The broadcast value 0xffffffff can also be given as all or -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 revision 1.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 to normal, tabular, 'json, or binary. 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. Version 1 uses the original field naming, while version 2 (default) provides more consistent and script-friendly field names. Other versions are rejected. 🚫
  • --quiet β€” Suppress informational messages. Errors are still reported, and --quiet cancels any --verbose for 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 are force-4k, mi-probe-enabled, test-base-dir and test-sysfs-dir.
  • --timeout=<ms> β€” Set the timeout for the command in milliseconds. infinite or -1 waits 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