If you have installed an NVMe drive in your mini PC or home lab server running VMware ESXi that maybe you had used for something else, you may see the NVMe drive shows 0 size. Why is this and how do you fix it?
When I saw this issue
Just a quick background of when I saw this issue. I had a Kingston 1 TB NVMe drive that I have used on my home lab bench for quite some time for various testing, etc. I noticed that when I put it in my mini PC I wanted to do some testing with, I saw an issue where when I went to create a datastore in VMware vSphere, it saw the drive ok, but the VMFS datastore size was showing as 0, and there was no way to increase the size.
Here is a screenshot of what I saw in my environment when selecting the drive.
After selecting the drive that I wanted to use, the next screen, I chose VMFS 6.
And for the issue. Under the partition configuration there was nothing available in the dropdown. Also, the slider bar, even though it looks active, you can’t move it over to increase the size of the datastore.
What caused the issue?
I am not 100% sure, but I had recently tested with the NVMe drive in a RAID configuration on the MS-A1 that I have been using in a lot of testing recently over the past week or so. After creating the array with the NVMe disk, and then destroying the array created. I assumed the NVMe drive was ok to use immediately following the RAID array creation.
Let’s look at the resolution to the NVMe drive showing the 0 size. It is actually pretty simple actually, but not necessarily intuitive or obvious.
Resolution for the NVMe drive showing 0 size
As is the case with many issues that we may need to solve in the datacenter or in the home lab, I had to resort to the command line to resolve the issue.
To find your NVMe disk identifier you need to run the command:
esxcli storage core path list
Copy the identifier that is listed for the Device.
Now that you have the device identifier for the NVMe drive that is showing up as a 0 size, we need to initialize the disk with a GPT (GUID Partition Table) partition table.
partedUtil mklabel /vmfs/devices/disks/t10.NVMe____KINGSTON_O
M8PGP41024Q2DA0________________8595183038B72600 gpt
Now, after we run the command to initialize the disk with the GPT partition table, if we go back through the wizard, the NVMe disk will show the proper size:
Wrapping up
When you have a home lab and you are testing and trying so many things each day and week, storage can get into a weird state when you use the same NVMe drive for various systems and hypervisors, etc. I had deleted the partition table from the NVMe drive with some RAID testing and then the NVMe drive shows 0 size. I had to recreate this on the NVMe disk to get it to a point where VMware could properly format the drive and detect the size of the datastore possible with the NVMe drive.