Amazon Ad

Featured Post

Sunday, December 23, 2018

How to format an NVMe drive

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 
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.

1 comment:

Anonymous said...

helped me format CORSAIR Force Series MP510 to lba sector size 4096

sudo nvme format /dev/nvme0n1 -l 1

ubuntu@ubuntu:~$ sudo smartctl -a /dev/nvme0
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-5.0.0-23-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number: Force MP510
Serial Number: 20068239000128955280
Firmware Version: ECFM22.5
PCI Vendor/Subsystem ID: 0x1987
IEEE OUI Identifier: 0x6479a7
Total NVM Capacity: 1,920,383,410,176 [1.92 TB]
Unallocated NVM Capacity: 0
Controller ID: 1
Number of Namespaces: 1
Namespace 1 Size/Capacity: 1,920,383,410,176 [1.92 TB]
Namespace 1 Formatted LBA Size: 4096
Local Time is: Fri Mar 20 23:02:50 2020 UTC
Firmware Updates (0x12): 1 Slot, no Reset required
Optional Admin Commands (0x0017): Security Format Frmw_DL *Other*
Optional NVM Commands (0x005d): Comp DS_Mngmt Wr_Zero Sav/Sel_Feat *Other*
Maximum Data Transfer Size: 512 Pages
Warning Comp. Temp. Threshold: 75 Celsius
Critical Comp. Temp. Threshold: 80 Celsius

Supported Power States
St Op Max Active Idle RL RT WL WT Ent_Lat Ex_Lat
0 + 11.52W - - 0 0 0 0 0 0
1 + 8.09W - - 1 1 1 1 0 0
2 + 6.37W - - 2 2 2 2 0 0
3 - 0.0490W - - 3 3 3 3 2000 2000
4 - 0.0018W - - 4 4 4 4 25000 25000

Supported LBA Sizes (NSID 0x1)
Id Fmt Data Metadt Rel_Perf
0 - 512 0 2
1 + 4096 0 1