目次

FreeBSDのnvmecontrolコマンドを色々試してみる

FreeBSDでNVMeデバイスを操作するnvmecontrolコマンドは、2020-10-17現在ドキュメントが不完全な状態で、

試した環境

コマンド

devlist

NVMeデバイス一覧を表示。デバイスだけではなく名前空間も表示されるようだ。

# nvmecontrol devlist
 nvme0: SAMSUNG MZQLB960HAJR-00007
    nvme0ns1 (915715MB)
 nvme1: SAMSUNG MZQLB960HAJR-00007
    nvme1ns1 (915715MB)

identify

指定NVMeデバイスの詳細表示。

NVMeデバイスを指定した場合はIDENTIFY_CONTROLLERの、名前空間を指定した場合はIDENTIFY_NAMESPACEのデータを人間が読める形で表示する。

-xオプションで各データの先頭1024バイトの16進ダンプを表示、-vを付けると4096バイト(全ダンプ?)になる。

# nvmecontrol identify nvme1
Controller Capabilities/Features
================================
Vendor ID:                   144d
Subsystem Vendor ID:         144d
Serial Number:               S437NY0KC00562
Model Number:                SAMSUNG MZQLB960HAJR-00007
Firmware Version:            EDA5202Q
Recommended Arb Burst:       2
IEEE OUI Identifier:         38 25 00
Multi-Path I/O Capabilities: Not Supported
Max Data Transfer Size:      2097152 bytes
Controller ID:               0x0004
Version:                     1.2.0

Admin Command Set Attributes
============================
Security Send/Receive:       Supported
Format NVM:                  Supported
Firmware Activate/Download:  Supported
Namespace Managment:         Supported
Device Self-test:            Not Supported
Directives:                  Not Supported
NVMe-MI Send/Receive:        Not Supported
Virtualization Management:   Not Supported
Doorbell Buffer Config:      Not Supported
Get LBA Status:              Not Supported
Sanitize:                    Not Supported
Abort Command Limit:         8
Async Event Request Limit:   4
Number of Firmware Slots:    3
Firmware Slot 1 Read-Only:   Yes
Per-Namespace SMART Log:     Yes
Error Log Page Entries:      64
Number of Power States:      1
Total NVM Capacity:          960197124096 bytes
Unallocated NVM Capacity:    0 bytes

NVM Command Set Attributes
==========================
Submission Queue Entry Size
  Max:                       64
  Min:                       64
Completion Queue Entry Size
  Max:                       16
  Min:                       16
Number of Namespaces:        1
Compare Command:             Supported
Write Uncorrectable Command: Supported
Dataset Management Command:  Supported
Write Zeroes Command:        Supported
Save Features:               Supported
Reservations:                Not Supported
Timestamp feature:           Not Supported
Verify feature:              Not Supported
Fused Operation Support:     Not Supported
Format NVM Attributes:       Crypto Erase, Per-NS Erase, Per-NS Format
Volatile Write Cache:        Not Present
# nvmecontrol identify -v nvme1
Controller Capabilities/Features
================================
Vendor ID:                   144d
Subsystem Vendor ID:         144d
Serial Number:               S437NY0KC00562
Model Number:                SAMSUNG MZQLB960HAJR-00007
Firmware Version:            EDA5202Q
Recommended Arb Burst:       2
IEEE OUI Identifier:         38 25 00
Multi-Path I/O Capabilities: Not Supported
Max Data Transfer Size:      2097152 bytes
Controller ID:               0x0004
Version:                     1.2.0

Admin Command Set Attributes
============================
Security Send/Receive:       Supported
Format NVM:                  Supported
Firmware Activate/Download:  Supported
Namespace Managment:         Supported
Device Self-test:            Not Supported
Directives:                  Not Supported
NVMe-MI Send/Receive:        Not Supported
Virtualization Management:   Not Supported
Doorbell Buffer Config:      Not Supported
Get LBA Status:              Not Supported
Sanitize:                    Not Supported
Abort Command Limit:         8
Async Event Request Limit:   4
Number of Firmware Slots:    3
Firmware Slot 1 Read-Only:   Yes
Per-Namespace SMART Log:     Yes
Error Log Page Entries:      64
Number of Power States:      1
Total NVM Capacity:          960197124096 bytes
Unallocated NVM Capacity:    0 bytes

NVM Command Set Attributes
==========================
Submission Queue Entry Size
  Max:                       64
  Min:                       64
Completion Queue Entry Size
  Max:                       16
  Min:                       16
Number of Namespaces:        1
Compare Command:             Supported
Write Uncorrectable Command: Supported
Dataset Management Command:  Supported
Write Zeroes Command:        Supported
Save Features:               Supported
Reservations:                Not Supported
Timestamp feature:           Not Supported
Verify feature:              Not Supported
Fused Operation Support:     Not Supported
Format NVM Attributes:       Crypto Erase, Per-NS Erase, Per-NS Format
Volatile Write Cache:        Not Present

名前空間を指定したパターン。

# nvmecontrol identify nvme1ns1
パスワード:
Size:                        234423126 blocks
Capacity:                    234423126 blocks
Utilization:                 49172754 blocks
Thin Provisioning:           Not Supported
Number of LBA Formats:       2
Current LBA Format:          LBA Format #01
Data Protection Caps:        Not Supported
Data Protection Settings:    Not Enabled
Multi-Path I/O Capabilities: Not Supported
Reservation Capabilities:    Not Supported
Format Progress Indicator:   0% remains
Deallocate Logical Block:    Read Not Reported
Optimal I/O Boundary:        0 blocks
NVM Capacity:                960197124096 bytes
Globally Unique Identifier:  343337304bc005620025385900000001
IEEE EUI64:                  0000000000000000
LBA Format #00: Data Size:   512  Metadata Size:     0  Performance: Best
LBA Format #01: Data Size:  4096  Metadata Size:     0  Performance: Best

ns

NVMe namespaceに関する操作。

ns active

NVMeデバイスの有効な名前空間を一覧表示する。

# nvmecontrol ns active nvme1
Active namespaces:
         1

ns controllers

NVMシステム内のコントローラを一覧表示する。

# nvmecontrol ns controllers nvme1
NVM subsystem includes 1 controller(s):
  0x0004

ns delete

指定のNVMe namespaceを削除する。

-nには名前空間ID (nvmecontrol nsidで取得した数値)を指定する。

# nvmecontrol ns delete -n 1 nvme1
namespace 1 deleted

ns identify

指定コントローラ、名前空間IDの名前空間の詳細を表示する。nvmecontrol identifyに名前空間デバイスを指定したものと等価。

# nvmecontrol ns identify -n 1 nvme1

nsid

指定名前空間デバイスからコントローラと名前空間IDを取得する。

# nvmecontrol nsid nvme1ns1
nvme1   1