virtualization:proxmox_ve_6_2_how_to_use_nvme

Proxmox VE 6.2でnvmeコマンドを使う

NVMeデバイスの管理コマンドnvmeをProxmox VE 6.2で使う方法と、コマンドの使用例。

PVEのみならず、debianやLinux全般での話題になるのかなと。

aptでnvme-cliパッケージを入れる

# apt install nvme-cli

nvme listでNVMeデバイスの一覧が表示できる

# nvme list
Node          SN               Model                         Namespace Usage                      Format           FW Rev  
------------- ---------------- ----------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1  18171E6Cxxxx     Micron_9200_MTFDHAL1T6TCU     1           1.60  TB /   1.60  TB      4 KiB +  0 B   101008P0
/dev/nvme1n1  S437NY0KC0yyyy   SAMSUNG MZQLB960HAJR-00007    1         207.29  GB / 960.20  GB      4 KiB +  0 B   EDA5202Q
/dev/nvme2n1  S36WNX0K41zzzz   SAMSUNG MZQLW1T9HMJP-00003    1           0.00   B /   1.92  TB    512   B +  0 B   CXV8501Q

nvme id-nsで名前空間の詳細情報を表示できる。

-Hオプションで可読文字列の出力となるものの、それでも分かりやすいとは言えない…。

# nvme id-ns /dev/nvme0n1 -H
NVME Identify Namespace 1:
nsze    : 0x1749a956
ncap    : 0x1749a956
nuse    : 0x1749a956
nsfeat  : 0
  [2:2] : 0     Deallocated or Unwritten Logical Block error Not Supported
  [1:1] : 0     Namespace uses AWUN, AWUPF, and ACWU
  [0:0] : 0     Thin Provisioning Not Supported

nlbaf   : 3
flbas   : 0x1
  [4:4] : 0     Metadata Transferred in Separate Contiguous Buffer
  [3:0] : 0x1   Current LBA Format Selected

mc      : 0
  [1:1] : 0     Metadata Pointer Not Supported
  [0:0] : 0     Metadata as Part of Extended Data LBA Not Supported

dpc     : 0
  [4:4] : 0     Protection Information Transferred as Last 8 Bytes of Metadata Not Supported
  [3:3] : 0     Protection Information Transferred as First 8 Bytes of Metadata Not Supported
  [2:2] : 0     Protection Information Type 3 Not Supported
  [1:1] : 0     Protection Information Type 2 Not Supported
  [0:0] : 0     Protection Information Type 1 Not Supported

dps     : 0
  [3:3] : 0     Protection Information is Transferred as Last 8 Bytes of Metadata
  [2:0] : 0     Protection Information Disabled

nmic    : 0x1
  [0:0] : 0x1   Namespace Multipath Capable

rescap  : 0
  [6:6] : 0     Exclusive Access - All Registrants Not Supported
  [5:5] : 0     Write Exclusive - All Registrants Not Supported
  [4:4] : 0     Exclusive Access - Registrants Only Not Supported
  [3:3] : 0     Write Exclusive - Registrants Only Not Supported
  [2:2] : 0     Exclusive Access Not Supported
  [1:1] : 0     Write Exclusive Not Supported
  [0:0] : 0     Persist Through Power Loss Not Supported

fpi     : 0
  [7:7] : 0     Format Progress Indicator Not Supported

dlfeat  : 0
  [4:4] : 0     Guard Field of Deallocated Logical Blocks is set to 0xFFFF
  [3:3] : 0     Deallocate Bit in the Write Zeroes Command is Not Supported
  [2:0] : 0     Bytes Read From a Deallocated Logical Block and its Metadata are Not Reported

nawun   : 0
nawupf  : 0
nacwu   : 0
nabsn   : 0
nabo    : 0
nabspf  : 0
noiob   : 0
nvmcap  : 1600321314816
nsattr  : 0
nvmsetid: 0
anagrpid: 0
endgid  : 0
nguid   : 000000000000000075a000c3a96c1e01
eui64   : 75a000c3a96c1e01
LBA Format  0 : Metadata Size: 0   bytes - Data Size: 512 bytes - Relative Performance: 0x2 Good 
LBA Format  1 : Metadata Size: 0   bytes - Data Size: 4096 bytes - Relative Performance: 0 Best (in use)
LBA Format  2 : Metadata Size: 0   bytes - Data Size: 512 bytes - Relative Performance: 0x2 Good 
LBA Format  3 : Metadata Size: 0   bytes - Data Size: 4096 bytes - Relative Performance: 0 Best

nvme formatで名前空間のフォーマットができる。

-nオプションで名前空間の番号を指定するが、よほどお高いNVMeデバイスじゃないかぎり1しか指定できない。

# nvme format /dev/nvme0 -n 1

-lオプションでLBAフォーマット(セクタサイズ)を指定する。値はnvme id-nsで表示されるLBA Formatから選択する。指定しなければ、名前空間の現在のLBAフォーマットが引き継がれる。

# nvme format /dev/nvme0 -n 1 -l 1

nvme format-sオプションを付けると、いわゆるSecure Eraseとなる。指定する値は下記の通り。

-sの値 意味
0 セキュアイレースを行わない。-s未指定時の挙動。
1 User Data Eraseを行う。いわゆるSecure Erase。コントローラによってはCryptographic Eraseとなる場合がある。
2 Cryptographic Erase (暗号的消去)を行う。
# nvme format /dev/nvme0 -n 1 -s 1

通常のフォーマットと比べ、セキュアイレースは少々時間がかかる(数分単位)ので、留意されたし。

nvme sanitizeでデバイス全体のデータを完全に消去する。

# nvme sanitize /dev/nvme0

-aオプションでサニタイズモードを指定できる。詳細は割愛するが、Block Erase, Crypto Erase, Overwriteを組み合わせられるようだ。

サニタイズの実行は数時間レベルの時間を要すらしい。またOverwriteはNANDフラッシュの寿命にもかかわってくるため、デバイスが対応してたとしても非推奨とのこと。

  • virtualization/proxmox_ve_6_2_how_to_use_nvme.txt
  • 最終更新: 2021-01-11 21:00
  • by Decomo