site  contact  subhomenews

Fix for two NVME drives

June 23, 2020 — BarryK

I recently purchased a M.2-to-PCIE adapter card:

And a 500GB NVME M.2 drive:

There are heatsinks available especially for these M.2 cards, however, I purchased two small stick-on heatsinks:

Here it is, put together, ready for insertion in the PC:


I want a fast partition, for some jobs that take a long time, such as the '2createpackages' script in WoofQ and a OpenEmbedded compile.

For the first time, have a PC with two NVME M.2 SSDs, and it has exposed a fault in EasyOS. This Lenovo IdeaCentre PC came with a 256GB NVME M.2 SSD. It has two PCI-E slots, one of them full-length.

The initrd in EasyOS has static /dev nodes. It is only at switch_root to the main filesystem that devtmpfs is mounted on /dev. With devtmpfs, the kernel will create the device nodes as required, in response to hardware it finds.

In the initrd, /dev has pre-created device nodes. This is fine, as long as nodes exist for all of the types of hardware that are likely to be found. Or rather, it has been fine up until now...

What I have discovered is the Linux NVME driver developers have broken with tradition, and device names no longer can be guaranteed to have fixed major and minor device numbers. To give an example of a normal drive partition:

# ls -l /dev/sda1
brw-rw---- 1 root disk 8, 1 Jun 24 2020 /dev/sda1

The major and minor numbers for partition "sda1" are 8 and 1. That remains always the same.

However, as this fixed mapping does not work for NVME, static node assignments may differ after devtmps is loaded. I discovered, for example that what is /dev/nvme1n1p4 after devtmpfs loaded, the initrd mapped the same major/minor numbers to /dev/nvme0n1p6.

So, for anyone trying to use EasyOS on a PC with more than one NVME drive, expect trouble.

It is time, finally, the very "old school" hanging onto static /dev nodes in the initrd has got to go. Now, devtmpfs is mounted at the start of the 'init' script in the initrd. This fix will of course be in the next release of Easy. 

Tags: easy