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, seeenum 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 tostruct nvme_id_ns.lbaf.flbasโ Formatted LBA Size, seeenum nvme_id_ns_flbas.mcโ Metadata Capabilities, seeenum nvme_id_ns_mc.dpcโ End-to-end Data Protection Capabilities, seeenum nvme_id_ns_dpc.dpsโ End-to-end Data Protection Type Settings, seeenum nvme_id_ns_dps.nmicโ Namespace Multi-path I/O and Namespace Sharing Capabilities, seeenum nvme_id_ns_nmic.rescapโ Reservation Capabilities, seeenum nvme_id_ns_rescap.fpiโ Format Progress Indicator, seeenum nvme_nd_ns_fpi.dlfeatโ Deallocate Logical Block Features, seeenum 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 bitnowsโ 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, seeenum 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, seestruct 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
- ubuntu stonking: libnvme-dev 1.16.2-1build1 ยท LGPL-2.1-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms