How to use the command nvme (with examples)

How to use the command nvme (with examples)

The nvme command is a user space utility for managing NVMe storage devices. NVMe (Non-Volatile Memory Express) is a communication standard designed for SSDs (Solid State Drives) connected through PCI Express (PCIe) bus. The nvme command allows users to interact with and manage NVMe devices by providing various operations and information about the devices.

Use case 1: List all nvme devices

Code:

sudo nvme list

Motivation: Listing all NVMe devices can be useful when you need to identify the connected NVMe devices on your system. This information can be helpful for configuring storage devices or troubleshooting any issues related to NVMe devices.

Explanation:

  • sudo: This is the command used to execute a command as a superuser or root.
  • nvme: The nvme command followed by the list subcommand is used to list all the available NVMe devices.

Example Output:

Node             SN                   Model                                    Namespace Usage                      Format           FW Rev  
---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1     CVP737530710001WGN  Samsung SSD 980 PRO 250GB                 1         250.06  GB / 250.06  GB    512   B +  0 B   2B2QGXA7
/dev/nvme1n1     N/A                  KINGSTON SA2000M8500G                     1         500.11  GB / 500.11  GB    512   B +  0 B   S5Z42107

In this example, the output shows two NVMe devices /dev/nvme0n1 and /dev/nvme1n1. It displays the device’s model, serial number, namespace, usage, format, and firmware revision.

Use case 2: Show device information

Code:

sudo nvme smart-log <device>

Motivation: Showing device information with the smart-log subcommand can be helpful when you want to retrieve detailed information about a specific NVMe device. This information includes the health status, temperature, error logs, power cycles, and various other parameters that can aid in monitoring and troubleshooting the device.

Explanation:

  • sudo: This is the command used to execute a command as a superuser or root.
  • nvme: The nvme command followed by the smart-log subcommand is used to retrieve the SMART (Self-Monitoring, Analysis, and Reporting Technology) log of an NVMe device.
  • <device>: This argument specifies the NVMe device for which you want to retrieve the SMART log. You need to provide the NVMe device’s path, such as /dev/nvme0n1.

Example Output:

smart log for /dev/nvme0n1 namespace 1
critical_warning                    : 0
temperature                         : 38 C
available_spare                     : 100%
available_spare_threshold           : 10%
percentage_used                     : 3%
data_units_read                     : 370,734,101
data_units_written                  : 219,636,057
host_read_commands                  : 1,593,452,681
host_write_commands                 : 704,718,801
controller_busy_time                : 1,436
power_cycles                        : 46
power_on_hours                      : 118
unsafe_shutdowns                    : 11
media_errors                        : 0
num_err_log_entries                 : 771
warn_temp_time                      : 0
critical_comp_warn                  : 0
temperature_temp                    : 40 C
thermal_management_t1_trans_count   : 0
thermal_management_t2_trans_count   : 0
thermal_management_t1_total_time    : 0
thermal_management_t2_total_time    : 0

In this example, the output displays the SMART log of the /dev/nvme0n1 NVMe device. It provides details such as critical warning status, temperature, available spare, data units read and written, host read and write commands, power cycles, power-on hours, unsafe shutdowns, media errors, number of error log entries, and more. This information helps in monitoring the health and usage of the NVMe device.

Related Posts

How to use the command "hg push" (with examples)

How to use the command "hg push" (with examples)

The “hg push” command is used to push changes from the local repository to a specified destination.

Read More
How to use the command 'man' (with examples)

How to use the command 'man' (with examples)

The ‘man’ command is used to format and display the manual pages on a Linux or Unix system.

Read More
How to use the command 'mocp' (with examples)

How to use the command 'mocp' (with examples)

Music on Console (MOC) is an audio player that allows users to play audio files from the terminal.

Read More