Experiments with dm-integrity and T10-PI on Linux

It might not be that rare. Kioxia, Western Digital, and Seagate have all published literature about T10-PI.

The various enterprise Intel Optanes I collected also support it—usually 512-byte or 4-kibibyte sectors plus 8 to 128 metadata bytes for T10-PI and other application-specific uses. Interestingly, it didn’t matter whether I formatted the NVMe namespaces with or without support for metadata; I got the same total capacity after tallying up the LBAs. It’s as if the underlying device already reserved storage for exclusive use by metadata. :smiley:

This may be the key difference between dm-integrity and real T10-PI. Even though it bills itself as emulating T10-PI, there is one important thing it cannot do: catch errors between issuing the write command and the physical device media. The idea is that in-transit errors may cause bad data to be committed to a sector and T10-PI can be utilized by the drive itself to prevent that before you’ve lost your only good copy of the data. But I have not found a way to verify that T10-supporting drives actually do the check.

In any case, yesterday, I started testing how well-supported T10-PI was in a Linux environment. I created an emulated NVMe device using QEMU backed by an image on the host file system, formatted it as FAT in the guest (to keep it simple), and kept the image open in a hex editor running on the host to observe live changes.

My immediate findings were that:

  1. Any writes to the block device in the guest resulted in T10-PI being written as well. (They were written at the end of the image after all the data.)
  2. If I edited the contents of a file in the host, the check sums would be invalidated, causing I/O errors in the guest. Reverting the changes immediately remedied the errors.
  3. Filling the image with random bytes and then starting the guest could cause the NVMe device to be detected, but inoperable (e.g., no formatting, writing, or even reporting the device size).
  4. In some cases, extensive corruption while the guest was running caused the operating system to simply crash.

So, it seems that T10-PI works in Linux and is doing its job. :smiley: Assuming a T10-supporting SSD is a drop-in replacement for the emulated one I used for testing, my current takeaway is that with T10-PI support in the hardware, all of the overhead and headaches of using dm-integrity goes away. You could put RAID directly on top of the physical disks.

3 Likes