NVMe namespace notes:

 Just a bunch of notes for my future self, as I am sure I will forget, and for anyone else who may benefit. 

What is a namespace?  Think of it just like a partition on a normal hard drive.  Except the partitioning of the drive is done at the hard drive level not at the operating system level.  Thus the operating system sees the name spaces as unique hard drives.  IE if one had a 1tb NVMe, and setup four 256gb name spaces, Windows would think there was four 256gb NVMe drives in the system.  

FROM LINUX (PartedMagic was used):

nvme list <--show what nvme name spaces are present and the model of the drive

nvme id-ctrl /dev/nvme0 | grep mcap <--shows" tnvmcap (total NVM capacity) and unvmcap (unallocated NVM capacity) attributes.

nvme id-ctrl /dev/nvme0 | grep cntlid <--show the controller(s) ID's

 

DELETE NAMENSPACES

nvme detach-ns /dev/nvme0 –n 1 –c 0 <-- detaches the namespace "1" from the controller "0" 

    sometimes using the flag --controllers=0 is necessary

nvme delete-ns /dev/nvme0 -n 1 <--deletes the namespace "1" from the controller "0"

nvme ns-rescan /dev/nvme0 <--rescans the drive "0"

 

CREATE NAMESPACES

nvme create-ns /dev/nvme0 -s 26214387 -c 26214387 -b 4096  <--creates a 100gb name space, formatted to 4k

nvme ns-rescan /dev/nvme0 <--rescan
 

nvme attach-ns /dev/nvme0 -n 1 -c 0x1  <--attach the namespace to the controller
 

nvme ns-rescan /dev/nvme0  <--rescan


Ignore this stuff....just notes to me...

nvme detach-ns /dev/nvme0 -n 1 -c 6

    detaches namespace 1 from nvme0 from controller 6

nvme delete-ns -n 1 /dev/nvme0

    deletes namespace1 from nvme0

nvme create-ns /dev/nvme0 -s 15,000,000,000 -b 512

    creates a namespace of 7.86tb w/ 512 sector size

nvme attach-ns /dev/nvme0 -n 1 -c 6

    attaches namespace 1 to controller 6 on nvme0

size:

size in mb...IE 7.68tb =7,680,000,000,000

take that number dived by 4096 or 512, if there is a remainder, subtract the remainder from the original size, and divide again.

7,680,000,000,000/512=15,000,000,000


No comments:

Post a Comment