Home > System Tutorial > Linux > body text

Looking at the way to improve Linux system storage performance from the rapidly developing NVMe technology

WBOY
Release: 2024-02-13 15:18:24
forward
412 people have browsed it

With the rapid development of big data, cloud computing, artificial intelligence and other applications, the demand for storage performance is getting higher and higher. The early SATA interface and AHCI protocol can no longer meet this demand. In recent years, NVMe technology based on the PCIe bus has gradually become the new favorite in the storage industry, with advantages such as high speed, low latency, and high concurrency. This article will explore how to use NVMe technology to improve storage performance in Linux systems.

Looking at the way to improve Linux system storage performance from the rapidly developing NVMe technology

My laptop has an NVMe drive and so does my desktop. And they're fast. I love how quickly my computers boot up and how quickly they read and write data. There is almost no lag.

It didn’t take long for me to become curious about the technology driving this ultra-fast storage, so I did some research. I learned that NVMe drives consume less power while providing much faster data access than even SATA SSD drives. This is interesting, but I'd like to know more about my specific NVMe drives, and I'd like to know how they differ from other drives. Can I safely erase a drive? How can I check its integrity?

With these questions I searched on the Internet and found an open source project with a series of tools for managing NVMe drives. It's called nvme-cli.

Install nvme-cli

You can install it from your distribution’s package manager

nvme-cli

. For example, on Fedora, CentOS or similar systems:

$ sudo dnf install nvme-cli
Copy after login

On Debian, Mint, Elementary and similar systems:

$ sudo apt install nvme-cli
Copy after login

Exploring NVMe Drives

After installing nvme-cli, I want to explore my drives. nvme-cli does not have a man page, but you can get a lot of help by typing nvme help:

$ nvme help
nvme-1.14
usage: nvme  [] []
The '' may be either an NVMe character device (ex: /dev/nvme0) or an
nvme block device (ex: /dev/nvme0n1).
The following are all implemented sub-commands:
 list List all NVMe devices and namespaces on machine
 list-subsys List nvme subsystems
 id-ctrl Send NVMe Identify Controller
 id-ns Send NVMe Identify Namespace, display structure
 id-ns-granularity Send NVMe Identify Namespace Granularity List, display structure
 list-ns Send NVMe Identify List, display structure
 list-ctrl Send NVMe Identify Controller List, display structure
 nvm-id-ctrl Send NVMe Identify Controller NVM Command Set, display structure
 primary-ctrl-caps Send NVMe Identify Primary Controller Capabilities
[...]
Copy after login

List all NVMe drives

sudo nvme list command lists all NVMe devices and namespaces on your machine. I used it to find an NVMe drive at /dev/nvme0n1. The following is the command output:

$ sudo nvme list
Node SN Model Namespace Usage Format FW Rev
--------------------- -------------------- ---------------------------------------- -------

-- -------------------------- ---------------- --------


/dev/nvme0n1    S42GMY9M141281 SAMSUNG MZVLB256HAHQ-000L7 1

214.68 GB / 256.06 GB 512  B + 0 B 0L2QEXD7
Copy after login

I have a drive named nvme0n1. It lists the serial number, brand, capacity, firmware version, and more.

You can get more information about the drive and the features it supports by using the id-ctrl subcommand:

$ sudo nvme id-ctrl /dev/nvme0n1
NVME Identify Controller:
vid : 0x144d
ssvid : 0x144d
sn : S42GMY9M141281
mn : SAMSUNG MZVLB256HAHQ-000L7
fr : 0L2QEXD7
rab : 2
ieee : 002538
cmic : 0
mdts : 9
cntlid : 0x4
ver : 0x10200
rtd3r : 0x186a0
rtd3e : 0x7a1200
[...]
Copy after login

Drive Health

You can understand the overall health of the hard drive through the smart-log subcommand:

$ sudo nvme smart-log /dev/nvme0n1
Smart Log for NVME device:nvme0n1 namespace-id:ffffffff
critical_warning : 0
temperature : 21 C
available_spare : 100%
available_spare_threshold : 10%
percentage_used : 2%
endurance group critical warning summary: 0
data_units_read : 5,749,452
data_units_written : 10,602,948
host_read_commands : 77,809,121
host_write_commands : 153,405,213
controller_busy_time : 756
power_cycles : 1,719
power_on_hours : 1,311
unsafe_shutdowns : 129
media_errors : 0
num_err_log_entries : 1,243
Warning Temperature Time : 0
Critical Composite Temperature Time : 0
Temperature Sensor 1 : 21 C
Temperature Sensor 2 : 22 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
Copy after login

This gives you the current temperature of the drive, usage time to date, number of unsafe shutdowns, and more.

Format an NVMe drive

You can format an NVMe drive with nvme-cli, but be careful. This will delete all data on the drive! If you have important data on your hard drive, you must back it up before doing so, otherwise you will lose your data. The subcommand is format:

$ sudo nvme format /dev/nvme0nX
Copy after login

(Just to be safe, I replaced the actual location of the drive with X to prevent copy-paste errors. Change the X to 1 or the actual location listed in the nvme list results.)

Securely Erase NVMe Drives

When you're preparing to sell or dispose of your NVMe computer, you may want to securely erase the drive. The warnings here are the same as during the formatting process. You must back up important data first, because this command will delete this data!

$ sudo nvme sanitize /dev/nvme0nX
Copy after login

Try nvme-cli

nvme-cli commands are released under the GPLv2 license. It is a powerful command with many useful options for controlling and managing data efficiently.

This article introduces solutions and methods for using NVMe technology to improve storage performance in Linux systems, including using the nvme-cli tool for performance testing, configuration and management operations. Through detailed experimental analysis, it was verified that NVMe technology has a significant effect on improving the storage performance of Linux systems. In the future, driven by the rapid development of NVMe technology, we can see that Linux system storage performance will be improved in more and more application scenarios, providing better performance guarantees for applications such as big data and artificial intelligence.

The above is the detailed content of Looking at the way to improve Linux system storage performance from the rapidly developing NVMe technology. For more information, please follow other related articles on the PHP Chinese website!

source:lxlinux.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!