To understand the little things in life: https://whatsdathing.blogspot.com/
The following are concise instructions on how to format NVMe drives in Linux.
First, identify the format required:
nvme id-ns /dev/nvme1n1 | grep LBA
LBA Format 0 : Metadata Size: 0 bytes - Data Size: 512 bytes - Relative Performance: 0x1 Better
nvme id-ns /dev/nvme1n1 | grep LBA
LBA Format 0 : Metadata Size: 0 bytes - Data Size: 512 bytes - Relative Performance: 0x1 Better
LBA Format 1 : Metadata Size: 8 bytes - Data Size: 512 bytes - Relative Performance: 0x3 Degraded
LBA Format 2 : Metadata Size: 0 bytes - Data Size: 4096 bytes - Relative Performance: 0 Best (in use)
LBA Format 3 : Metadata Size: 8 bytes - Data Size: 4096 bytes - Relative Performance: 0x2 Good
Explanation
- Each format has an id: 0, 1, 2, 3 in this example.
- There are two data sector sizes - 512 bytes and 4K. Typically the 4K formats provide the best performance and endurance.
- Metadata - some drives provide the capability to add a few bytes for additional metadata for each sector. This is typically used for T10/DIF CRC.
Format
nvme format /dev/nvme1n1 -l 0
where l represents the LBA format id as listed in nvme id-ns.