Sample Header Ad - 728x90

Behavior of the nvme tool with respect to protection information?

4 votes
0 answers
650 views
Environment: Debian Bullseye, up to date at the time of writing, nvme-cli 1.12 I am totally new to NVMe and currently try to configure an NVMe SSD correctly. As far as I can tell, I don't need metadata, but **I would like to use the T10-PI protection information.** I have got two questions regarding this subject: **First, I'd like to know how to find out whether that protection has been enabled for a certain device or namespace at all.** I know that I can enable or disable the T10-PI when formatting the device or namespace, but I can't figure out how to get its current status. I have read a good part of the manual pages of the various nvme commands, and also have tried to make sense of the NVMe specification to a certain level, but to no avail. I just seem to be unable to spot it. I am having that problem only with that specific setting; with other settings that are of interest to me, it didn't take too long to find out how to read their current status or value. **Second, I am not sure how to enable that protection.** Theoretically, and from reading man nvme-format, it is clear. I just have to add the -i parameter to the format command to have something like that: nvme format /dev/nvme0 -l 3 -i 1 The disk in question provides 6 LBA modes, mode 3 being the one I want: 4096 bytes per sector, no metadata; hence the -l 3 parameter. -i 1 turns on the T10-PI. When I issue the command above, it gets executed without error message. Afterwards, smartctl -x /dev/nvme0 shows that the current LBA size is now 4096; nvme id-ns /dev/nvme0n1 confirms that mode 3 is in use as expected. So far, so good. But the following is very suspicious: root@gaia ~/scripts # nvme list Node SN Model Namespace Usage Format FW Rev ---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- -------- /dev/nvme0n1 PHFT640100G7800CGN INTEL SSDPEDMD800G4 1 800.17 GB / 800.17 GB 4 KiB + 0 B 8DV10171 Under Format, it shows 4 KiB + 0 B. Why? As far as I have understood, the T10-PI needs at least 8 bytes of metadata per LBA. Therefore, I am unsure what actually happens. Does nvme format /dev/nvme0 -l 3 -i 1 just leave the PI disabled (because there is no metadata, and therefore no space for it)? Or is the PI enabled, but nvme list shows only the "real" metadata size (not including the "implicit" bytes which are needed for the PI)? Do I need to use -l 4 instead of -l 3 with nvme format? -l 4 means 4096 bytes LBA size + 8 bytes metadata. If I need to use -l 4, why does nvme format -l 3 -i 1 not throw an error due to wrong command line parameters (we can't turn on T10-PI if we don't have metadata)?
Asked by Binarus (3901 rep)
Oct 30, 2022, 09:14 PM
Last activity: Jan 16, 2025, 01:05 PM