Getting the most out of your NVME drives
My laptops are equipped with NVMe drives, which impress me with their incredible speed. I’m delighted by the lightning-fast boot times and seamless data read and write operations without noticeable delays.
As my fascination grew, I explored the technology behind this blazing-fast storage. After a bit of research, I discovered that NVMe drives offer exceptional speed and consume less power than traditional SSD drives using SATA connections. The efficiency intrigued me, but I wanted to delve deeper into the specifics of my NVMe drives and compare them with other options. I had questions about securely erasing the drive and ensuring its integrity.
A quick internet search led me to the perfect solution—an open-source project called “nvme-cli.” This collection of tools provides comprehensive management capabilities for NVMe drives, offering me the functionality I sought and more.
You can install ‘nvme-cli’ on your Linux system easily from the command line
Install nvme-cli
You can install nvme-cli
from your distribution’s package manager. For instance, on Fedora, CentOS, or similar:
$ sudo dnf install nvme-cli
On Debian, Mint, Elementary, and similar:
$ sudo apt install nvme-cli
Getting help
After installing nvme-cli
for my distribution, I wanted to explore my drive. There’s no man page for nvme-cli
, but you can get lots of help by entering 'nvme help'
:
don@pop-os:~$ nvme help
nvme-1.16
usage: nvme <command> [<device>] [<args>]
The '<device>' may be either an NVMe character device (ex: /dev/nvme0) or an
nvme block device (ex: /dev/nvme0n1).
The sudo nvme list
command lists all NVMe devices and namespaces on your machine. I used it and found an NVMe drive at /dev/nvme0n1
. Here is the output:
don@pop-os:~$ sudo nvme list
[sudo] password for don:
Node SN Model Namespace Usage Format FW Rev
--------------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1 ASB3N553810103J14 SK hynix PC711 HFS001TDE9X073N 1 1.02 TB / 1.02 TB 512 B + 0 B HPS0
Drive information
You can get even more information about the drive and the features it supports by using the id-ctrl
subcommand:
don@pop-os:~$ sudo nvme id-ctrl /dev/nvme0n1
NVME Identify Controller:
vid : 0x1c5c
ssvid : 0x1c5c
sn : ASB3N553810103J14
mn : SK hynix PC711 HFS001TDE9X073N
fr : HPS0
rab : 3
ieee : ace42e
cmic : 0
mdts : 6
Drive health
You can read about the overall health of a drive with the smart-log
subcommand
don@pop-os:~$ sudo nvme smart-log /dev/nvme0n1
Smart Log for NVME device:nvme0n1 namespace-id:ffffffff
critical_warning : 0
temperature : 29 C (302 Kelvin)
available_spare : 100%
available_spare_threshold : 5%
percentage_used : 0%
endurance group critical warning summary: 0
data_units_read : 8,524,708
data_units_written : 5,777,269
Format your drive
Caution must be exercised when using ‘nvme-cli format’ an NVMe drive, as this action will result in the complete erasure of all data on the drive. Therefore, it is crucial to back up any essential data before proceeding with the formatting process to avoid permanent data loss
sudo nvme format /dev/nvme0nx
Securely erase your drive
When the time comes to sell or dispose of your NVMe computer, securely erasing the drive becomes a priority. As with the formatting process, it is essential to heed the same warnings here: make sure to back up any crucial data before initiating this command, as it will erase all the data on the drive
sudo nvme sanitize /dev/nvme0nx
Nvme-cli is openly licensed.