Home System Tutorial LINUX Looking at the way to improve Linux system storage performance from the rapidly developing NVMe technology

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

Feb 13, 2024 pm 03:18 PM
linux linux tutorial linux system data access linux command shell script embeddedlinux Getting started with linux linux learning

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use docker desktop How to use docker desktop Apr 15, 2025 am 11:45 AM

How to use Docker Desktop? Docker Desktop is a tool for running Docker containers on local machines. The steps to use include: 1. Install Docker Desktop; 2. Start Docker Desktop; 3. Create Docker image (using Dockerfile); 4. Build Docker image (using docker build); 5. Run Docker container (using docker run).

How to view the docker process How to view the docker process Apr 15, 2025 am 11:48 AM

Docker process viewing method: 1. Docker CLI command: docker ps; 2. Systemd CLI command: systemctl status docker; 3. Docker Compose CLI command: docker-compose ps; 4. Process Explorer (Windows); 5. /proc directory (Linux).

What to do if the docker image fails What to do if the docker image fails Apr 15, 2025 am 11:21 AM

Troubleshooting steps for failed Docker image build: Check Dockerfile syntax and dependency version. Check if the build context contains the required source code and dependencies. View the build log for error details. Use the --target option to build a hierarchical phase to identify failure points. Make sure to use the latest version of Docker engine. Build the image with --t [image-name]:debug mode to debug the problem. Check disk space and make sure it is sufficient. Disable SELinux to prevent interference with the build process. Ask community platforms for help, provide Dockerfiles and build log descriptions for more specific suggestions.

What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

Can vscode be used for mac Can vscode be used for mac Apr 15, 2025 pm 07:36 PM

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

What is vscode What is vscode for? What is vscode What is vscode for? Apr 15, 2025 pm 06:45 PM

VS Code is the full name Visual Studio Code, which is a free and open source cross-platform code editor and development environment developed by Microsoft. It supports a wide range of programming languages ​​and provides syntax highlighting, code automatic completion, code snippets and smart prompts to improve development efficiency. Through a rich extension ecosystem, users can add extensions to specific needs and languages, such as debuggers, code formatting tools, and Git integrations. VS Code also includes an intuitive debugger that helps quickly find and resolve bugs in your code.

How to back up vscode settings and extensions How to back up vscode settings and extensions Apr 15, 2025 pm 05:18 PM

How to back up VS Code configurations and extensions? Manually backup the settings file: Copy the key JSON files (settings.json, keybindings.json, extensions.json) to a safe location. Take advantage of VS Code synchronization: enable synchronization with your GitHub account to automatically back up all relevant settings and extensions. Use third-party tools: Back up configurations with reliable tools and provide richer features such as version control and incremental backups.

See all articles