NVMe Namespaces - Little Known Cool Features of (most) NVMe and User-Programmable Endurance

Would i be able to use NVMe namespaces to separate my PC’s OSes?

Currently i’m dual booting Linux and Windows - those are installed on partitions of the same SSD.

I guess, the mobo would need to be able to handle namespaces, in order to dual boot those instead of partitions.

Would a usual AMD B550 mobo be able to do this?

What i’m trying to figure out is, whether i can dual boot AND virtualize Windows. Not simultaneously, of course, but i’d like to do maintenance and install Steam updates inside a VM while i’m using my Linux daily driver. This way i could maintain an up-to-date gaming OS, and play more because i’m not demotivated by waiting for updates to install.

Regarding namespaces/nvme-cli I noticed some issue(/feature) with NVME drives attached to Broadcom 9500-16i trimode HBA. The nvme drive is presented to the OS as a scsi device and nvme-cli refuses to work with the nvme drive. Not sure if you can send some raw command directly to the drive, but for this I don’t have enough knowledge.
Not sure if the new Adaptec HBA 1200 has the same issue. Has anyone the Adaptec/Microsemi HBA 1200 in use?

I don’t have any issue with the Micron 7400 Pro M.2 connected via M.2 slot (7400 also supports namespaces, and different block sizes).

Excuse me, how can I know which controller the namespace is activated by?
I activated the namespace with a controller number other than cntlid.

Hmm, and it seems like some of the NVMe that support name spaces support only one (1).

From an interesting explanation I can only find live on a archived site:

The nn attribute indicates the maximum number of namespaces your disk supports. The device nvme0 is a U.2 drive that supports 32 namespaces and nvme1 is my M.2 boot device that only supports a single namespace.

root@smc-server thorst]# nvme id-ctrl /dev/nvme0 | grep nn
nn        : 32
[root@smc-server thorst]# nvme id-ctrl /dev/nvme1 | grep nn
nn        : 1

– [NVMe Namespaces · Drew Thorstensen]( NVMe Namespaces)

There’s a list on that page of 2020 era enterprise drives that support 16-128 namespaces.

Looks like your PM983 only supports 1 namespace; I get similar nn =1 looking at a Samsung 970 Evo Plus. I’ll check some newer NVMe drives when I get a chance.

For samsung there is the samsung dc toolkit that “may” let you create more namespaces.

Similarly toshiba enterrprise drives need some special commands to control namespace resize but its possible on drives like the xg5 as ive done it.

One other interesting thing about this output, is it looks like this drive supports multiple sector sizes. From some nvme-cli info I found, which includes an explanation on how to use ‘nvme format’ to change from say 512B to 4096B]() :

nvme id-ns /dev/nvme0n1

NVME Identify Namespace 1:
… (truncated).
lbaf 0 : ms:0 lbads:9 rp:0x2 (in use)
lbaf 1 : ms:0 lbads:12 rp:0

This drive is currently using 512B formatting and 4096B formatting is supported.

The full discussion, as well as reformatting details are here:

Conversely, looking at the same on a Samsung 980 Pro, I just see:

$ sudo nvme id-ns /dev/nvme1n1
NVME Identify Namespace 1:

lbaf 0 : ms:0 lbads:9 rp:0 (in use)

… so no extra format support there.

Anyway, while looking around at this stuff, and trying to find info – and coming to the realization that the non-enterprise NVMe drives I have are not going to let me play with setting up namespaces to create “drives” to use with ZFS – I put together this table, and list of sources, detailing some drive namespace compatibility:

`

Model Form Factor Supported namespaces Reference
WD Blue SN570 1 1
WD WDS500G2X0C (SN700) 1 1
WD Ultrastar SN640 U.2 128 3
WD Ultrastar SN840 U.2 128 3
HGST SN260 128 1
Intel Optane 900P 1 1
Intel Optane P1600X 1 2
Intel Optane P4801X 1 2
Intel Optane 5800X (fw. > L0310200) 128 2,4
Intel P4500 1 7
Intel P4510 / P4610 U.2 128 (non-Opal SKUs, maybe fw dependent) 3,6,7
Intel P4610 128 1
Intel P5500 (Dell firmware) 128 1
Intel D7-P5510 (SSDPF2KX076TZ) U.2 128 4
Kingston DC1500M U.2 64 8
Kioxia CM6 U.2 64 3
Kioxia CD6 U.2 16 3
Micron 7400 (MTFDKBG3T8TDZ) M.2 22110 128 4
Micron 9200 U.2 1 1
Micron 9300 U.2 32 1,3
Samsung 970 EVO Plus M.2 1 1
Samsung 980 Pro M.2 1 4
Samsung PM983 1 (maybe fw dependent, upgrade in DC Toolkit?) 4
Samsung PM9A3 U.2 32 1
Samsung PM1725a AIC (depends on fw?) 5
Samsung PM1733/PM1735 U.2 / AIC 64 3
SK Hynix PC601 HFS512GD9TNG-L2A0A 1 1

1 NVMe SSD namespaces support table | TrueNAS Community
2 Which Intel® Optane™ Data Center Drives Support Multiple...
3 https://web.archive.org/web/20221124073644/https://www.drewthorst.com/posts/nvme/namespaces/readme/
4 nvme-cli test
5 List of NVMe drives that support namespaces or other ways to divide one up | ServeTheHome Forums
6 https://web.archive.org/web/20210117005416/https://www.intel.com/content/www/us/en/support/articles/000038017/memory-and-storage/data-center-ssds.html#blade-product-list-show-content
7 How can I create multiple namespaces on DC P4510 o... - Page 2 - Solidigm - 9918
8 https://www.kingston.com/datasheets/sedc1500m_en.pdf

Here’s something about UEFI support for namespaces, although it talks about “management” of namespaces, not about UEFI support for bootable devices in multiple namespaces:
AMI Enables NVMe Namespace Management in Aptio® V UEFI BIOS Firmware

HTH

3 Likes

I’ll go ahead and add here that the Intel D7-P5510 (SSDPF2KX076TZ 7.68TB NVMe U.2 15mm) drives which I have a few of do support namespaces

# nvme id-ctrl /dev/nvme0 | grep nn
nn        : 128

The Optane P5800X (400GB) drives I have also support 128 namespaces

# nvme id-ctrl /dev/nvme2 | grep nn
nn        : 128
1 Like

Thanks for the extra input – I went ahead and edited the post above, adding your info (and converting the table I had to markdown, so it can be better copied/amended/etc…)

The micron 7400 m.2 22110 nvme ssd also supports 128 namespaces:

root@zephir:~# nvme id-ctrl /dev/nvme3 | grep -E “(^mn |^nn )”
mn : Micron_7400_MTFDKBG3T8TDZ
nn : 128
root@zephir:~#

2 Likes

note to future users, devices like Sabrent’s EC-SNVE (realtek rtl-9210) (https://www.amazon.com/Sabrent-Type-C-Tool-Free-Enclosure-EC-SNVE/dp/B08RVC6F9Y/) do NOT support nvme-cli. atleast not on all the systems i tried it on. don’t buy for that reason, it does read/write to a samsung 980Pro tho so it isn’t total junk.

2 Likes

Amazing, here, it says:
The PM9A3 is available in E1.S, U.2 and M.2 form factors

but, here, the only parts listed are U.2.

But, searching around, i can indeed find M.2 22110 PM9A3

Is an M.2 variant OK, or did it have problems and get deprecated/pulled? Given the dearth of PCIe 4.0 U.2 cables, a M.2 PCIe 4.0 NVMe drive might be a good solution – but not if it has other flaws (like overheating/throttling/less feature support, like namespaces or Opal/etc.)

Is there a place for comprehensive actual technical (non-marketing) information for hardware these days, or do manufacturers just make web sites with glossy pictures and dare you to engineer a solution with just guesswork and trial and error?

I highly recommend avoiding Samsung’s so called ”data center” drives.

I used to have the opposite opinion, since there are earlier models cheap on eBay with 99% of the life left in the flash. But Samsung’s firmware is hot garbage and I found out firsthand they like to get stuck in some bad state with “ERRORMOD” as the firmware version, and only showing a 1GB partition. Of course if you ask for firmware to try and reload it, Samsung will just tell you to fuck off. “Support” will only be from whoever sold it to you, which is basically going to be non-existent.

Their newer PM9A3 model is still full of the same issues, though the unofficial Samsung magician might work for at least updating sometimes.

See: PM9A3 Firmware / ERRORMOD related to fw version | ServeTheHome Forums

If you still want to play chicken with Samsung’s firmware, have backups and hardware redundancy like I fortunately did.

TL:DR Stay away.

1 Like

Well, to be fair, when researchers engage in a snark fest because hacking a drive’s firmware can bypass the Opal implementation – and recommend that responsible drive manufactures should sign their code and defend against rogue firmware mods, it’s not surprising that firmware gets tight and only comes from controlled channels and can only be flashed by official apps:

So, do you recommend the U.2 Intel P5510? What connection/cabling solution have you found to get PCIe 4.0 speed out of it (and the Optane P55800X)?

Great list!

Based on its datasheet the U.2 Kingston DC1500M supports namespaces (and PLP):

I was eyeing it before discovering from your list that M.2 Micron 7400 Pro also can do namespaces (and PLP as well, based on its datasheet), which can spare me from buying adapters and cables for U.2.

1 Like

Can’t find its idle power consumption figures. Do you have them by any chance?

Sorry, no I don’t have them. I only see in the documentation that they mention 8.25 W power consumption during sequential read/write. for the m.2 drives.

Update:
ps 0 : mp:8.25W operational enlat:0 exlat:0 rrt:0 rrl:0
rwt:0 rwl:0 idle_power:3.10W active_power:-
ps 1 : mp:7.50W operational enlat:10 exlat:10 rrt:0 rrl:0
rwt:0 rwl:0 idle_power:3.10W active_power:-
ps 2 : mp:7.50W operational enlat:10 exlat:10 rrt:0 rrl:0
rwt:0 rwl:0 idle_power:3.10W active_power:-
ps 3 : mp:7.50W operational enlat:10 exlat:10 rrt:0 rrl:0
rwt:0 rwl:0 idle_power:3.10W active_power:-
ps 4 : mp:5.50W operational enlat:10 exlat:10 rrt:0 rrl:0
rwt:0 rwl:0 idle_power:3.10W active_power:-

… you can also use multiple nvme name spaces it’s like a partition but it’s a hardware partition so you can get a couple of cheap two terabyte nvme drives and let’s say make 512 gigs or a terabyte of the nvme one name space and use a mirror of those for your metadata and then use the rest of the nvme for you know a raid z mirror for your virtual machine storage or your docker container storage or whatever you want to do…"
TrueNAS: Full Setup Guide for Setting Up Portainer, Containers and Tailscale #Ultimatehomeserver - YouTube

Has anyone actually done this? That is, create namespaces on an NVMe drive to use as “available disks” to use in ZFS pools – like, make namespace devices to be cache, log, or special metadata devices, and/or devices for a data vDev?

Is there any limiting factor when doing this? Like do all NVMe that support namespaces have whatever is needed under the hood (queues, caches, ability to flush writes, etc.) under the hood for ZFS devices to work as well in this circumstance as if on a total drive?

I’d imagine an OS kernel supporting ZFS would typically typically support NVMe/namespaces/etc. – so compatibility isn’t an issue for a data drive, but what about boot devices?

Can a namespace device be used for an EFI partition? Would that depend upon if the UEFI of your machine supported NVMe namespaces, or would just any UEFI which can find a EFI partition on an NVMe drive be able to find it on a namespaced NVMe drive (because that’s part of the spec, or whatever).

What about Windows? Does Windows see NVMe namespaces as separate devices? If so, just as data drives, or could a NVMe namespace be used as the Windows install/boot device?

How about compatibility with SED, self-encryption drive, functionality (e.g., Opal, Enterprise, IEEE 1667). I think the SED specs include some number (16 maybe) “Locking Ranges” that can be defined on a drive to encrypt, so that ranges of the disk space can be hardware encrypted, rather than the whole disk (and different users can have different access to those ranges).

Do NVMe namespaces perhaps work compatibly with SED locking ranges, where you can just define the encryption to go along with the namespace divisions?

Thanks for any thoughts, pointers to things to research.

I have been playing around with NVME namespaces over the past couple of days in TrueNAS CORE.

root@freenas[~]# nvmecontrol ns create -s 8192000 -c 8192000 -n 0 -L 0 -d 0 nvme1
namespace 1 created
root@freenas[~]# nvmecontrol ns create -s 8192000 -c 8192000 -n 1 -L 0 -d 0 nvme1
namespace 2 created
root@freenas[~]# nvmecontrol ns create -s 8192000 -c 8192000 -n 1 -L 0 -d 0 nvme1
namespace 3 created
root@freenas[~]# nvmecontrol ns create -s 8192000 -c 8192000 -n 1 -L 0 -d 0 nvme1
namespace 4 created
root@freenas[~]# nvmecontrol ns attach -n 2 nvme1
namespace 2 attached
root@freenas[~]# nvmecontrol ns attach -n 3 nvme1
namespace 3 attached
root@freenas[~]# nvmecontrol ns attach -n 4 nvme1

This worked yesterday, and I was able to use all 4 namespaces but now I am only seeing 2 of the 4 namespaces in the TrueNAS UI, and I am seeing this in the Kernel

May 30 10:48:24 freenas.fusco.me nvme3: RESERVATION REPORT sqid:3 cid:127 nsid:1
May 30 10:48:24 freenas.fusco.me nvme3: INVALID OPCODE (00/01) sqid:3 cid:127 cdw0:0
May 30 10:48:24 freenas.fusco.me nvme0: RESERVATION REPORT sqid:4 cid:127 nsid:1
May 30 10:48:24 freenas.fusco.me nvme0: INVALID OPCODE (00/01) sqid:4 cid:127 cdw0:0

@wendell or Anyone have some suggestions?

I can see all 4 namespaces in nvmecontrol

root@freenas[~]# nvmecontrol devlist
 nvme1: SAMSUNG MZWLL1T6HEHP-00003
    nvme1ns1 (4000MB)
    nvme1ns2 (4000MB)
    nvme1ns3 (4000MB)
    nvme1ns4 (4000MB)

(don’t ask me why 8192000= 4 Gig, I have no idea, I was just plugging numbers…)

EDIT it’s because 512 bytes per sector x 8192000 :slight_smile:

Devices show up in geom. Notice how the LUN ID is different by the identity is the same. What I can’t explain is why it worked at all yesterday. Now only one shows up in the UI.

Geom name: nvd1
Providers:

  1. Name: nvd1
    Mediasize: 4195328000 (3.9G)
    Sectorsize: 512
    Mode: r0w0e0
    descr: SAMSUNG MZWLL1T6HEHP-00003
    lunid: 334844304bb012480025385800000001
    ident: S3HDNX0KB01248
    rotationrate: 0
    fwsectors: 0
    fwheads: 0

Geom name: nvd2
Providers:

  1. Name: nvd2
    Mediasize: 4195328000 (3.9G)
    Sectorsize: 512
    Mode: r0w0e0
    descr: SAMSUNG MZWLL1T6HEHP-00003
    lunid: 334844304bb012480025385800000002
    ident: S3HDNX0KB01248
    rotationrate: 0
    fwsectors: 0
    fwheads: 0

Do namespaces work over M.2 / U.2 NVMe to USB enclosures?