nvme管理工具

nvme-cli

NVM-Express user space tooling for Linux.

To install, run:

make && make install

If not sure how to use, find the top-level documentation with:

man nvme

Or find a short summary with:

nvme help

Distro Support

Alpine Linux

nvme-cli is tested on Alpine Linux 3.3. Install it using:

# apk update && apk add nvme-cli nvme-cli-doc

if you just use the device you’re after, it will work flawless.

# nvme smart-log /dev/nvme0
Smart Log for NVME device:/dev/nvme0 namespace-id:ffffffff
critical_warning                    : 0
temperature                         : 49 C
available_spare                     : 100%

Arch Linux

Install from AUR, e.g.:

$ yay -S nvme-cli-git

Fedora

nvme-cli is available in Fedora 23 and up. Install it with your favorite
package manager. For example:

$ sudo dnf install nvme-cli

FreeBSD

nvme-cli is available in the FreeBSD Ports Collection. A prebuilt binary
package can be installed with:

# pkg install nvme-cli

Gentoo

nvme-cli is available and tested in portage:

$ emerge -av nvme-cli

Nix(OS)

The attribute is named nvme-cli and can e.g. be installed with:

$ nix-env -f '<nixpkgs>' -iA nvme-cli

openSUSE Tumbleweed

nvme-cli is available in openSUSE Tumbleweed. You can install it using zypper.
For example:

$ sudo zypper install nvme-cli

Ubuntu

nvme-cli is supported in the Universe package sources for Xenial for
many architectures. For a complete list try running:

rmadison nvme-cli
 nvme-cli | 0.3-1 | xenial/universe | source, amd64, arm64, armhf, i386, powerpc, ppc64el, s390x

A Debian based package for nvme-cli is currently maintained as a
Ubuntu PPA. Right now there is support for Trusty, Vivid and Wiley. To
install nvme-cli using this approach please perform the following
steps:

  1. Add the sbates PPA to your sources. One way to do this is to run
sudo add-apt-repository ppa:sbates
  1. Perform an update of your repository list:
sudo apt-get update
  1. Get nvme-cli!
sudo apt-get install nvme-cli
  1. Test the code.
sudo nvme list

In the case of no NVMe devices you will see

No NVMe devices detected.

otherwise you will see information about each NVMe device installed
in the system.

Other Distros

TBD

Developers

You may wish to add a new command or possibly an entirely new plug-in
for some special extension outside the spec.

This project provides macros that help generate the code for you. If
you’re interested in how that works, it is very similar to how trace
events are created by Linux kernel’s ‘ftrace’ component.

Add command to existing built-in

The first thing to do is define a new command entry in the command
list. This is declared in nvme-builtin.h. Simply append a new “ENTRY” into
the list. The ENTRY normally takes three arguments: the “name” of the
subcommand (this is what the user will type at the command line to invoke
your command), a short help description of what your command does, and the
name of the function callback that you’re going to write. Additionally,
You can declare an alias name of subcommand with fourth argument, if needed.

After the ENTRY is defined, you need to implement the callback. It takes
four arguments: argc, argv, the command structure associated with the
callback, and the plug-in structure that contains that command. The
prototype looks like this:

int f(int argc, char **argv, struct command *cmd, struct plugin *plugin);

The argc and argv are adjusted from the command line arguments to start
after the sub-command. So if the command line is “nvme foo --option=bar”,
the argc is 1 and argv starts at “–option”.

You can then define argument parsing for your sub-command’s specific
options then do some command specific action in your callback.

Add a new plugin

The nvme-cli provides macros to make define a new plug-in simpler. You
can certainly do all this by hand if you want, but it should be easier
to get going using the macros. To start, first create a header file
to define your plugin. This is where you will give your plugin a name,
description, and define all the sub-commands your plugin implements.

There is a very important order on how to define the plugin. The following
is a basic example on how to start this:

File: foo-plugin.h

#undef CMD_INC_FILE
#define CMD_INC_FILE foo-plugin

#if !defined(FOO) || defined(CMD_HEADER_MULTI_READ)
#define FOO

#include "cmd.h"

PLUGIN(NAME("foo", "Foo plugin"),
	COMMAND_LIST(
		ENTRY("bar", "foo bar", bar)
		ENTRY("baz", "foo baz", baz)
		ENTRY("qux", "foo quz", qux)
	)
);

#endif

#include "define_cmd.h"

In order to have the compiler generate the plugin through the xmacro
expansion, you need to include this header in your source file, with
pre-defining macro directive to create the commands.

To get started from the above example, we just need to define “CREATE_CMD”
and include the header:

File: foo-plugin.c

#define CREATE_CMD
#include "foo-plugin.h"

After that, you just need to implement the functions you defined in each
ENTRY, then append the object file name to the Makefile’s “OBJS”.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: PCIe NVMe是一种高速的存储接口协议,主要用于连接计算机的存储设备,如固态硬盘(SSD)。它是一种基于PCI Express(PCIe)总线的协议,通过使用非易失性内存(NVM)来实现快速的数据传输。 PCIe NVMe通过使用高级主机控制器接口(AHCI)的替代品,提供了更快的数据传输速度和更低的延迟。相比于传统的SATA接口,PCIe NVMe的传输速度可以大幅度提升,大大提高了计算机的响应速度和整体性能。 在PCIe NVMe管理方面,需要考虑几个方面。首先是驱动程序的安装和管理。每个NVMe设备都需要安装相应的驱动程序才能正常工作,因此在管理中要确保驱动程序的正确安装和更新。 其次是固件的管理。NVMe设备通常具有固件,这是设备的操作系统。更新固件可以修复错误、改进性能并添加新功能。因此,在管理中需要定期检查固件的可用性,并按照厂商提供的指示进行更新。 此外,还需要针对NVMe设备进行性能监控和故障排除。通过监控设备的性能参数,可以及时发现和解决性能下降的问题。另外,对于设备故障,可以使用错误日志和诊断工具来帮助定位和解决问题。 最后,在PCIe NVMe管理中还需要考虑数据安全性。由于PCIe NVMe设备是直接连接到计算机总线上,因此需要采取措施来保护设备数据的安全。例如,通过使用加密功能和访问控制策略来防止未经授权的访问。 综上所述,PCIe NVMe的管理涉及驱动程序的安装和更新、固件的管理、性能监控和故障排除以及数据安全等方面。通过有效的管理,可以确保NVMe设备的正常运行和高性能工作。 ### 回答2: PCIe NVMe是一种新型的存储接口技术,旨在提高计算设备的存储性能和响应速度。PCIe(Peripheral Component Interconnect Express)是计算机硬件领域广泛使用的高速总线标准,而NVMe(Non-Volatile Memory Express)则是一种用于闪存驱动器的通信协议。 PCIe NVMe管理主要涉及存储设备的配置、监控和优化等。首先,它允许操作系统检测和配置PCIe NVMe设备,包括识别存储容量、读取写入速度等信息。通过管理软件,用户可以对这些设备进行分区、格式化和设定缓存策略等操作,以满足应用的需求。 其次,PCIe NVMe管理还包括监控存储设备的运行状态。通过监控软件,用户可以实时监测设备的温度、功耗、读写速度等参数,并对异常情况进行警报和处理。这有助于提前预防硬件故障和数据丢失,保证系统的稳定运行。 最后,PCIe NVMe管理还涉及优化存储性能和数据安全。通过管理软件,用户可以定期进行设备的固件升级,以修复漏洞和提升性能。此外,用户还可以设置RAID(冗余磁盘阵列)和TRIM(回收闪存中已删除数据)等功能,以提高数据安全性和设备的使用寿命。 综上所述,PCIe NVMe管理是一项重要的技术,它通过配置、监控和优化存储设备,提高了计算设备的存储性能和响应速度,同时保证了数据的安全性和可靠性。 ### 回答3: PCIE NVMe是一种存储介质的管理协议,它在电脑硬件中的发展具有重要意义。 首先,PCIE是指Peripheral Component Interconnect Express的缩写,是一种高速串行接口标准,用于连接计算机系统的扩展卡。而NVMe指的是Non-Volatile Memory Express,是一种与存储介质相关的管理协议。 PCIE NVMe的管理主要涉及两个方面:一是存储设备的配置和管理,二是数据传输和访问控制。 在存储设备的配置和管理方面,PCIE NVMe通过固件来管理存储设备的一些基本设置,如I/O队列数量、命名空间数量和电源管理等。通过这些设置,可以根据系统需求来优化存储设备的性能和能耗。 在数据传输和访问控制方面,PCIE NVMe通过NVMe驱动程序与操作系统进行通信,实现数据的读写和传输。它通过命令和队列来管理数据的传输流程,从而提高传输效率和数据访问的并发性。此外,PCIE NVMe还支持多队列和多核心处理,可以更好地利用多核心处理器的计算能力。 此外,PCIE NVMe还提供了一些高级功能,如错误检测和修复、多路径访问和故障转移等。它能够检测和纠正存储设备中的错误,提供冗余访问路径来保证数据的可靠传输,以及在设备故障时实现无缝切换。 总之,PCIE NVMe作为一种存储介质的管理协议,能够优化存储设备的性能和能耗,并提供高效的数据传输和访问控制。它在现代计算机系统中的应用越来越广泛,对于提高系统的响应速度和数据处理能力具有重要意义。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值