nvme_ns_mgmt_create(2)
π nvme_ns_mgmt_create β from the libnvme API manual, section 2 π
okay so bestie, picture this: you wanna make a whole new namespace but likeβ¦ not attach it to anything yet. Just let it β¨existβ¨. That's literally this function. It's in nvme_ns_mgmt_create(2), from the libnvme API manual, and it's giving main character energy fr fr.
πΈ NAME πΈ
nvme_ns_mgmt_create β create a non attached namespace π¦
β¨ SYNOPSIS β¨
int nvme_ns_mgmt_create (int fd , struct nvme_id_ns *ns , __u32 *nsid ,
__u32 timeout , __u8 csi , struct nvme_ns_mgmt_host_sw_specified *data
);
likeβ¦ six arguments. she's high maintenance but she's worth it π
π ARGUMENTS π
fdβ the file descriptor of your nvme device. your lil doorway in, yk?nsβ namespace identification that defines the ns creation parameters. this is where you tell it what kinda namespace you want πnsidβ on success, this gets set to the namespace id that was created. so like, you pass in a pointer, it fills it in, iconic behavior β¨timeoutβ override the default timeout to this value, in milliseconds. and listen: set it to0if you want the system default. no cap.csiβ Command Set Identifier. that's it, that's the whole description π«Άdataβ Host Software Specified Fields that defines the ns creation parameters. so the parameters live indata. we been knew.
π DESCRIPTION π
so when the creation actually goes through, the namespace exists in the subsystemβ¦ but it's not attached to any controller. it's just vibing there. unattached. single and ready to mingle β¨π¦
and then, when you're ready to commit (iykyk), you use the nvme_ns_attach_ctrls to assign the namespace to one or more controllers. periodt. that's the whole arc.
π RETURN π
- The nvme command status, if a response was received β check
enum nvme_status_fieldfor that π - otherwise,
-1, witherrnoset. yeahβ¦ that's the sad path π
fr fr, if you get the-1just go look aterrno. the answer is always inerrno, bestie.
mwah π that's the whole page. this lil slice of the libnvme API manual is dated July 2026, and it lives in the nvme_ns_mgmt_create(2) corner of the world. go create something, go attach it, go slay. ππ
π
π¦ 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