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 to 0 if 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 in data. 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_field for that πŸ‘‘
  • otherwise, -1, with errno set. yeah… that's the sad path 😭
fr fr, if you get the -1 just go look at errno. the answer is always in errno, 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