nvme-cli 3.x Bundles libnvme: Here's Why That Matters
You might have noticed that nvme-cli 3.x no longer requires you to install libnvme separately. Instead, it bundles the library directly. That's a deliberate design choice, and it's worth understanding why.
Intro
If you've ever worked with NVMe drives on Linux, you've probably used nvme-cli. It's the go-to command line tool for managing NVMe storage. The shift to bundling libnvme in version 3.x is interesting because it breaks from the typical "dependency hell" pattern many Linux tools follow. Instead of requiring you to hunt down a library version that matches, the tool just ships with everything it needs.
This is a practical move that simplifies installation, especially for users who aren't building from source daily or dealing with distro-specific package versions. It also means the tool stays more self-contained and predictable.
What It Does
nvme-cli is a CLI utility for interacting with NVMe drives. It handles everything from listing devices (nvme list) to running diagnostic tests, formatting drives, setting power states, and managing firmware. Think of it as smartctl or hdparm but specifically for NVMe.
Under the hood, it uses libnvme, a shared library that provides the low level NVMe command interface. Previously, libnvme was a separate dependency you had to install. Now, in version 3.x, it's built into the repository and compiled as part of the tool.
Why It's Cool
The bundling approach solves a few real headaches:
- No version mismatches. You don't need to worry about your system's
libnvmebeing too old or too new for thenvme-clirelease you want. - Simpler builds. If you're compiling from source, you just run
makeand everything works. No hunting for a matching library version. - Portability. You can build a static binary and run it on any Linux system without caring about what libraries are installed.
It's not just about convenience. The NVMe ecosystem moves fast. New features and fixes land in libnvme regularly. By bundling, nvme-cli ensures you always get the exact library version it was tested with. No surprises.
How to Try It
If you're on a modern distro, you can likely install it from your package manager:
# Debian/Ubuntu
sudo apt install nvme-cli
# Fedora/RHEL
sudo dnf install nvme-cli
# Arch
sudo pacman -S nvme-cli
To build from source with the bundled libnvme:
git clone https://github.com/linux-nvme/nvme-cli.git
cd nvme-cli
meson setup build
meson compile -C build
sudo meson install -C build
That's it. No extra dependencies to track down. The build will pull in libnvme sources from a git submodule and compile them for you.
Final Thoughts
I like this approach because it removes friction. In a world where containerization and dependency management are constant concerns, a tool that bundles its own core library feels refreshingly pragmatic. It's not reinventing the wheel — it's just making sure the wheel fits.
If you've ever been frustrated by mismatched library versions, you'll appreciate why nvme-cli went this route. For developers working with NVMe storage, this means less time debugging dependency issues and more time actually managing drives.
Found this interesting? We share cool open source projects like this. Follow us @githubprojects for more.