📜  nvme cli (1)

📅  最后修改于: 2023-12-03 14:44:50.374000             🧑  作者: Mango

NVMe CLI

NVMe CLI is a command-line interface for interacting with NVMe (Non-Volatile Memory Express) devices. With NVMe CLI, programmers and IT professionals can easily perform various operations on NVMe devices, such as formatting, partitioning, reading and writing to the device, querying device information, and so on.

Features

NVMe CLI provides various features, including:

  • Device discovery: NVMe CLI can discover all NVMe devices attached to the system and display relevant device information.

  • Device formatting: NVMe CLI can format an NVMe device, which includes initializing the device, creating partitions on the device, and formatting each partition.

  • I/O operations: NVMe CLI can read and write data to NVMe devices, with various options for specifying the read and write operations.

  • Device management: NVMe CLI can manage NVMe devices, including creating and deleting partitions, setting power state modes, and querying NVMe device information.

Usage

Using NVMe CLI is simple, as it is a command-line interface. The following example shows how to discover all available NVMe devices on the system:

$ nvme list
Node             SN                   Model                Namespace Usage                      Format           FW Rev  
---------------- -------------------- -------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1     Z123456789          ABC NVMe SSD            1      465.76 GB / 500.11 GB     512   B +  0 B   XYZ

From the output, you can see that there is one NVMe device (/dev/nvme0n1) with a model name of "ABC NVMe SSD". To format this device and create a partition on it, you can execute the following command:

$ nvme format /dev/nvme0n1 --namespace-id=1 --lba-format=3

This command will format the device and create a partition with namespace ID 1 and Logical Block Address (LBA) format 3.

If you want to read some data from the partition, you can execute the following command:

$ nvme read /dev/nvme0n1 --namespace-id=1 --count=1 --data-size=512 --offset=0

This command will read one block of data (512 bytes) from partition 1, starting at offset 0.

Conclusion

NVMe CLI is a powerful command-line interface for interacting with NVMe devices. With its rich set of features, programmers and IT professionals can easily manage NVMe devices, perform I/O operations, and discover device information.