


Looking at the way to improve Linux system storage performance from the rapidly developing NVMe technology
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.
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
On Debian, Mint, Elementary and similar systems:
$ sudo apt install nvme-cli
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 [...]
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
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 [...]
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
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
(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
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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).

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).

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.

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)

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.

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.

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 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.
