dxun
Explorer
- Joined
- Jan 24, 2016
- Messages
- 52
In preparation for a new VM pool on TrueNAS 12-U8.1, I've been going through OpenZFS docs and I came across the section around NVMe low-level formatting LBA size. After a quick scan through the inventory of disks I have, I've discovered only a pair of 1 TB Intel P4510 seem to support LBA 4k format (sadly, Intel chose to hobble the Optane 900p in this regard, similarly to how they chose to handicap it with a single NVMe namespace).
Since the OpenZFS docs mention Linux commands to format the drive to 4k, I've looked into FreeBSD analouges and came across `nvmecontrol`.
So, inspecting the P4510, here is what I get:
The drive looks configured for 512 sector size and I tried to use
And it does, except now I get the dreaded
Next step I had in mind was to try and re-format the whole disk (not just the only NVMe namespace) to 4k. Looking more closely at the
What is the best way to format an NVMe SSD to 4k LBA size on TrueNAS?
Since the OpenZFS docs mention Linux commands to format the drive to 4k, I've looked into FreeBSD analouges and came across `nvmecontrol`.
So, inspecting the P4510, here is what I get:
root@storage[~]# nvmecontrol identify nvme0 | grep 'LBA Format'
root@storage[~]# nvmecontrol identify nvme0ns1 | grep 'LBA Format'
Number of LBA Formats: 2
Current LBA Format: LBA Format #00
LBA Format #00: Data Size: 512 Metadata Size: 0 Performance: Good
LBA Format #01: Data Size: 4096 Metadata Size: 0 Performance: Best
The drive looks configured for 512 sector size and I tried to use
nvmecontrol format
but the man page has kind of spartan explanations that don't really show any examples how to this. Digging deeper, the NVMe Rev 1.4 spec indicates Format NVMe command (section 5-23, pp. 234) the format bit values so doing something like this should work:root@storage[~]# nvmecontrol format -f 1 nvme0ns1
root@storage[~]# nvmecontrol identify nvme0ns1 | grep 'LBA Format'
Number of LBA Formats: 2
Current LBA Format: LBA Format #01
LBA Format #00: Data Size: 512 Metadata Size: 0 Performance: Good
LBA Format #01: Data Size: 4096 Metadata Size: 0 Performance: Best
And it does, except now I get the dreaded
Error: [Errno 5] Input/output error
when trying to Wipe Disk from TrueNAS UI. Setting the disk back to 512 LBA format makes the disk usable again.Next step I had in mind was to try and re-format the whole disk (not just the only NVMe namespace) to 4k. Looking more closely at the
nvmecontrol
docs (such as they are), there is a remark When formatting all namespaces, all parameters should be specified.
so I looked back at the NVMe spec to figure out the remaining parameters but didn't feel comfortable setting these by hand as it wasn't entirely clear what to use and I am concerned that I could throw the drive into a bad state that I'd find difficult to dig myself out with the knowledge that I have. The best I could come up with was something like nvmecontrol format -f 1 -m 0 -o 0 -l 0 nvme0
but I didn't run this.What is the best way to format an NVMe SSD to 4k LBA size on TrueNAS?