libnvme(2)

โœจ NAME โœจ

okay bestie, welcome to libnvme(2) โ€” this is the API manual, and today's main character is struct nvme_id_ns, a.k.a. the Identify Namespace data structure. she's the blueprint NVMe hands you when you ask a namespace "soโ€ฆ tell me about yourself ๐Ÿ’…".


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

here's the whole squad, exactly as they show up in the struct:

struct nvme_id_ns {
    __le64 nsze;
    __le64 ncap;
    __le64 nuse;
    __u8 nsfeat;
    __u8 nlbaf;
    __u8 flbas;
    __u8 mc;
    __u8 dpc;
    __u8 dps;
    __u8 nmic;
    __u8 rescap;
    __u8 fpi;
    __u8 dlfeat;
    __le16 nawun;
    __le16 nawupf;
    __le16 nacwu;
    __le16 nabsn;
    __le16 nabo;
    __le16 nabspf;
    __le16 noiob;
    __u8 nvmcap[16];
    __le16 npwg;
    __le16 npwa;
    __le16 npdg;
    __le16 npda;
    __le16 nows;
    __le16 mssrl;
    __le32 mcl;
    __u8 msrc;
    __u8 kpios;
    __u8 nulbaf;
    __u8 rsvd83;
    __le32 kpiodaag;
    __u8 rsvd88[4];
    __le32 anagrpid;
    __u8 rsvd96[3];
    __u8 nsattr;
    __le16 nvmsetid;
    __le16 endgid;
    __u8 nguid[16];
    __u8 eui64[8];
    struct nvme_lbaf        lbaf[64];
    __u8 vs[3712];
 };

likeโ€ฆ look at her. 3712 bytes of vendor-specific mystery at the end and everything. iconic ๐ŸŽ€


๐ŸŒธ Members ๐ŸŒธ

every single field, no skipping, let's go:

  • nsze โ€” Namespace Size ๐Ÿ’– tells you the total size of the namespace in logical blocks. the number of logical blocks is based on the formatted LBA size.
  • ncap โ€” Namespace Capacity ๐Ÿซถ the maximum number of logical blocks that may be allocated in the namespace at any point in time. number of logical blocks = based on the formatted LBA size.
  • nuse โ€” Namespace Utilization โœจ the current number of logical blocks allocated in the namespace. this one is smaller than or equal to the Namespace Capacity. and yes, the number of logical blocks is based on the formatted LBA size.
  • nsfeat โ€” Namespace Features, see enum nvme_id_nsfeat.
  • nlbaf โ€” Number of LBA Formats ๐Ÿ‘‘ defines the number of supported LBA data size and metadata size combinations supported by the namespace, plus the highest possible index to struct nvme_id_ns.lbaf.
  • flbas โ€” Formatted LBA Size, see enum nvme_id_ns_flbas.
  • mc โ€” Metadata Capabilities, see enum nvme_id_ns_mc.
  • dpc โ€” End-to-end Data Protection Capabilities, see enum nvme_id_ns_dpc.
  • dps โ€” End-to-end Data Protection Type Settings, see enum nvme_id_ns_dps.
  • nmic โ€” Namespace Multi-path I/O and Namespace Sharing Capabilities, see enum nvme_id_ns_nmic.
  • rescap โ€” Reservation Capabilities, see enum nvme_id_ns_rescap.
  • fpi โ€” Format Progress Indicator, see enum nvme_nd_ns_fpi.
  • dlfeat โ€” Deallocate Logical Block Features, see enum nvme_id_ns_dlfeat.
  • nawun โ€” Namespace Atomic Write Unit Normal ๐ŸŒˆ the namespace specific size of the write operation guaranteed to be written atomically to the NVM during normal operation.
  • nawupf โ€” Namespace Atomic Write Unit Power Fail โšก the namespace specific size of the write operation guaranteed to be written atomically to the NVM during a power fail or error condition.
  • nacwu โ€” Namespace Atomic Compare & Write Unit ๐Ÿ’… the namespace specific size of the write operation guaranteed to be written atomically to the NVM for a Compare and Write fused command.
  • nabsn โ€” Namespace Atomic Boundary Size Normal ๐Ÿ”ฅ the atomic boundary size for this namespace for the NAWUN value. this field is specified in logical blocks.
  • nabo โ€” Namespace Atomic Boundary Offset ๐Ÿ“ the LBA on this namespace where the first atomic boundary starts.
  • nabspf โ€” Namespace Atomic Boundary Size Power Fail โšก the atomic boundary size for this namespace specific to the Namespace Atomic Write Unit Power Fail value. specified in logical blocks.
  • noiob โ€” Namespace Optimal I/O Boundary ๐ŸŽฏ the optimal I/O boundary for this namespace, specified in logical blocks. the host should construct Read and Write commands that don't cross the I/O boundary to get that optimal performance, k?
  • nvmcap โ€” NVM Capacity ๐Ÿ’พ the total size of the NVM allocated to this namespace. the value is in bytes.
  • npwg โ€” Namespace Preferred Write Granularity โœ๏ธ the smallest recommended write granularity in logical blocks for this namespace. this is a 0's based value.
  • npwa โ€” Namespace Preferred Write Alignment ๐Ÿ“ the recommended write alignment in logical blocks for this namespace. this is a 0's based value.
  • npdg โ€” Namespace Preferred Deallocate Granularity ๐Ÿงน the recommended granularity in logical blocks for the Dataset Management command with the Attribute - Deallocate bit.
  • npda โ€” Namespace Preferred Deallocate Alignment ๐Ÿงฝ the recommended alignment in logical blocks for the Dataset Management command with the Attribute - Deallocate bit
  • nows โ€” Namespace Optimal Write Size โญ the size in logical blocks for optimal write performance for this namespace. this is a 0's based value.
  • mssrl โ€” Maximum Single Source Range Length ๐Ÿ“ the maximum number of logical blocks that may be specified in each valid Source Range field of a Copy command.
  • mcl โ€” Maximum Copy Length ๐Ÿ“š the maximum number of logical blocks that may be specified in a Copy command.
  • msrc โ€” Maximum Source Range Count ๐Ÿ”ข the maximum number of Source Range entries that may be used to specify source data in a Copy command. this is a 0โ€™s based value.
  • kpios โ€” Key Per I/O Status ๐Ÿ”‘ indicates namespace Key Per I/O capability status.
  • nulbaf โ€” Number of Unique Capability LBA Formats ๐ŸŽ€ defines the number of supported user data size and metadata size combinations supported by the namespace that may not share the same capabilities. LBA formats shall be allocated in order and packed sequentially. periodt.
  • rsvd83 โ€” Reserved ๐Ÿ™ˆ (nothing to see here bestie)
  • kpiodaag โ€” Key Per I/O Data Access Alignment and Granularity ๐Ÿ—๏ธ indicates the alignment and granularity in logical blocks that is required for commands that support a KPIOTAG value in the CETYPE field.
  • rsvd88 โ€” Reserved ๐Ÿ™ˆ
  • anagrpid โ€” ANA Group Identifier ๐ŸŒ indicates the ANA Group Identifier of the ANA group of which the namespace is a member.
  • rsvd96 โ€” Reserved ๐Ÿ™ˆ
  • nsattr โ€” Namespace Attributes, see enum nvme_id_ns_attr.
  • nvmsetid โ€” NVM Set Identifier ๐Ÿงฉ indicates the NVM Set with which this namespace is associated.
  • endgid โ€” Endurance Group Identifier ๐Ÿ’ช indicates the Endurance Group with which this namespace is associated.
  • nguid โ€” Namespace Globally Unique Identifier ๐Ÿ”ฎ contains a 128-bit value that is globally unique and assigned to the namespace when the namespace is created. this field remains fixed throughout the life of the namespace and is preserved across namespace and controller operations.
  • eui64 โ€” IEEE Extended Unique Identifier ๐Ÿชช contains a 64-bit IEEE Extended Unique Identifier (EUI-64) that is globally unique and assigned to the namespace when the namespace is created. this field remains fixed throughout the life of the namespace and is preserved across namespace and controller operations.
  • lbaf โ€” LBA Format, see struct nvme_lbaf.
  • vs โ€” Vendor Specific ๐Ÿคซ (the mystery zone, 3712 bytes of "ask your vendor")
lowkey note: that's the whole struct, every field accounted for, no crumbs left behind ๐Ÿ’–

and that's the page, bestie!! this was struct nvme_id_ns from the libnvme(2) API Manual, dated July 2026. go forth and identify some namespaces, you absolute legend ๐Ÿ‘‘โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from