作者

QQ群:852283276
微信:arm80x86
微信公众号:青儿创客基地
B站:主页 https://space.bilibili.com/208826118

参考

Intel ISDCT, SanDisk SCLI和NVMe-CLI三款SSD工具基本操作简介
nvme-cli常用指令
nvme-cli官网

显示系统内的NVMe SSD

采用list命令,

root@zynqmp:~# nvme list
Node             SN                   Model                                    Namespace Usage                      Format           FW Rev
---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1     S3EVNX0K101880M      Samsung SSD 960 PRO 1TB                  1           4.54  GB /   1.02  TB    512   B +  0 B   2B6QCXP7
/dev/nvme1n1     S3EVNX0K101840H      Samsung SSD 960 PRO 1TB                  1           4.54  GB /   1.02  TB    512   B +  0 B   2B6QCXP7
/dev/nvme2n1     S3EVNX0K101883A      Samsung SSD 960 PRO 1TB                  1           4.54  GB /   1.02  TB    512   B +  0 B   2B6QCXP7
/dev/nvme3n1     S3EVNX0K101887V      Samsung SSD 960 PRO 1TB                  1         377.06  MB /   1.02  TB    512   B +  0 B   2B6QCXP7

读写NVMe

nvme-cli提供接口可直接读写扇区,这里以扇区大小为512,-c指定block个数,从0开始,即0表示一个block。

root@zynqmp:~# nvme write /dev/nvme0n1 -s 0 -c 1 -z 0x400 -d ./start.sh -tlatency: write: 325680 us
write: Success
root@zynqmp:~#
root@zynqmp:~#
root@zynqmp:~# nvme read /dev/nvme0n1 -s 0 -c 1 -z 0x400 -d ./a.bin -tlatency: read: 331882 us
read: Success
root@zynqmp:~# hexdump -C a.bin
00000000  23 21 2f 62 69 6e 2f 73  68 0a 0a 6d 6f 64 70 72  |#!/bin/sh..modpr|
00000010  6f 62 65 20 70 63 69 65  5f 65 70 20 70 63 69 65  |obe pcie_ep pcie|
00000020  5f 65 70 5f 76 69 64 3d  30 78 31 30 62 35 20 70  |_ep_vid=0x10b5 p|
00000030  63 69 65 5f 65 70 5f 64  69 64 3d 30 78 38 37 32  |cie_ep_did=0x872|
00000040  34 0a 6d 6f 64 70 72 6f  62 65 20 6e 76 6d 65 64  |4.modprobe nvmed|
00000050  0a 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000400

在T2080平台上测试,最大操作2MB的读写,否则报错,

root@t2080rdb:~# nvme write /dev/nvme0n1 -s 0 -c 2047 -z 0x100000 -d ./start.sh -tlatency: write: 527 us
write: Success
root@t2080rdb:~#
root@t2080rdb:~#
root@t2080rdb:~# nvme write /dev/nvme0n1 -s 0 -c 4095 -z 0x200000 -d ./start.sh -t     latency: write: 995 us
write: Success
root@t2080rdb:~#
root@t2080rdb:~#
root@t2080rdb:~# nvme write /dev/nvme0n1 -s 0 -c 8191 -z 0x400000 -d ./start.sh -t     latency: write: 2574 us
write:INVALID_FIELD: A reserved coded value or an unsupported value in a defined field(2002)

实际比对数据,发现0x100000长度才能保证读写正确,

root@t2080rdb:~# nvmeqe_benchmark -w /dev/nvme0n1 -s 0x100000 -l 0x100000 -t 1
speed: 200.00MB/s, cost times: 5ms
root@t2080rdb:~#
root@t2080rdb:~# nvmeqe_benchmark -r /dev/nvme0n1 -s 0x100000 -l 0x100000 -t 1
read:
hello nvmeqe_benchmark...
speed: 166.67MB/s, cost times: 6ms

显示磁盘信息

identify命令,

root@zynqmp:~# nvme id-ctrl /dev/nvme0
NVME Identify Controller:
vid       : 0x144d
ssvid     : 0x144d
sn        : S3EVNX0K101880M
mn        : Samsung SSD 960 PRO 1TB
fr        : 2B6QCXP7
rab       : 2
ieee      : 002538
cmic      : 0
mdts      : 9
cntlid    : 2
ver       : 10200
rtd3r     : 186a0
rtd3e     : 4c4b40
oaes      : 0
ctratt    : 0
rrls      : 0
oacs      : 0x7
acl       : 7
aerl      : 3
frmw      : 0x16
lpa       : 0x3
elpe      : 63
npss      : 4
avscc     : 0x1
apsta     : 0x1
wctemp    : 346
cctemp    : 349
mtfa      : 0
hmpre     : 0
hmmin     : 0
tnvmcap   : 1024209543168
unvmcap   : 0
rpmbs     : 0
edstt     : 0
dsto      : 0
fwug      : 0
kas       : 0
hctma     : 0
mntmt     : 0
mxtmt     : 0
sanicap   : 0
hmminds   : 0
hmmaxd    : 0
nsetidmax : 0
anatt     : 0
anacap    : 0
anagrpmax : 0
nanagrpid : 0
sqes      : 0x66
cqes      : 0x44
maxcmd    : 0
nn        : 1
oncs      : 0x1f
fuses     : 0
fna       : 0x5
vwc       : 0x1
awun      : 255
awupf     : 0
nvscc     : 1
nwpc      : 0
acwu      : 0
sgls      : 0
mnan      : 0
subnqn    :
ioccsz    : 0
iorcsz    : 0
icdoff    : 0
ctrattr   : 0
msdbd     : 0
ps    0 : mp:6.90W operational enlat:0 exlat:0 rrt:0 rrl:0rwt:0 rwl:0 idle_power:- active_power:-
ps    1 : mp:5.50W operational enlat:0 exlat:0 rrt:1 rrl:1rwt:1 rwl:1 idle_power:- active_power:-
ps    2 : mp:5.10W operational enlat:0 exlat:0 rrt:2 rrl:2rwt:2 rwl:2 idle_power:- active_power:-
ps    3 : mp:0.0500W non-operational enlat:210 exlat:1200 rrt:3 rrl:3rwt:3 rwl:3 idle_power:- active_power:-
ps    4 : mp:0.0080W non-operational enlat:2000 exlat:6000 rrt:4 rrl:4rwt:4 rwl:4 idle_power:- active_power:-

显示namespace信息

identify命令,

root@zynqmp:~# nvme id-ns /dev/nvme0n1
NVME Identify Namespace 1:
nsze    : 0x773bd2b0
ncap    : 0x773bd2b0
nuse    : 0x873430
nsfeat  : 0
nlbaf   : 0
flbas   : 0
mc      : 0
dpc     : 0
dps     : 0
nmic    : 0
rescap  : 0
fpi     : 0x80
dlfeat  : 0
nawun   : 0
nawupf  : 0
nacwu   : 0
nabsn   : 0
nabo    : 0
nabspf  : 0
noiob   : 0
nvmcap  : 1024209543168
nsattr  : 0
nvmsetid: 0
anagrpid: 0
endgid  : 0
nguid   : 00000000000000000000000000000000
eui64   : 0025385181b14235
lbaf  0 : ms:0   lbads:9  rp:0 (in use)

查看寿命

nvme smart-log /dev/nvme*n1读取smart信息,其中percentage used表示寿命百分比,0表示全新,100表示寿命耗尽。

help

root@zynqmp:~# nvme help
nvme-1.8.1
usage: nvme <command> [<device>] [<args>]The '<device>' 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 machinelist-subsys           List nvme subsystemsid-ctrl               Send NVMe Identify Controllerid-ns                 Send NVMe Identify Namespace, display structurelist-ns               Send NVMe Identify List, display structurens-descs              Send NVMe Namespace Descriptor List, display structureid-nvmset             Send NVMe Identify NVM Set List, display structurecreate-ns             Creates a namespace with the provided parametersdelete-ns             Deletes a namespace from the controllerattach-ns             Attaches a namespace to requested controller(s)detach-ns             Detaches a namespace from requested controller(s)list-ctrl             Send NVMe Identify Controller List, display structureget-ns-id             Retrieve the namespace ID of opened block deviceget-log               Generic NVMe get log, returns log in raw formattelemetry-log         Retrieve FW Telemetry log write to filefw-log                Retrieve FW Log, show itchanged-ns-list-log   Retrieve Changed Namespace List, show itsmart-log             Retrieve SMART Log, show itana-log               Retrieve ANA Log, show iterror-log             Retrieve Error Log, show iteffects-log           Retrieve Command Effects Log, show itendurance-log         Retrieve Endurance Group Log, show itget-feature           Get feature and show the resulting valuedevice-self-test      Perform the necessary tests to observe the performanceself-test-log         Retrieve the SELF-TEST Log, show itset-feature           Set a feature and show the resulting valueset-property          Set a property and show the resulting valueget-property          Get a property and show the resulting valueformat                Format namespace with new block formatfw-commit             Verify and commit firmware to a specific slot (fw-activate in old version < 1.2)fw-download           Download new firmwareadmin-passthru        Submit an arbitrary admin command, return resultsio-passthru           Submit an arbitrary IO command, return resultssecurity-send         Submit a Security Send command, return resultssecurity-recv         Submit a Security Receive command, return resultsresv-acquire          Submit a Reservation Acquire, return resultsresv-register         Submit a Reservation Register, return resultsresv-release          Submit a Reservation Release, return resultsresv-report           Submit a Reservation Report, return resultsdsm                   Submit a Data Set Management command, return resultsflush                 Submit a Flush command, return resultscompare               Submit a Compare command, return resultsread                  Submit a read command, return resultswrite                 Submit a write command, return resultswrite-zeroes          Submit a write zeroes command, return resultswrite-uncor           Submit a write uncorrectable command, return resultssanitize              Submit a sanitize commandsanitize-log          Retrieve sanitize log, show itreset                 Resets the controllersubsystem-reset       Resets the subsystemns-rescan             Rescans the NVME namespacesshow-regs             Shows the controller registers or properties. Requires character devicediscover              Discover NVMeoF subsystemsconnect-all           Discover and Connect to NVMeoF subsystemsconnect               Connect to NVMeoF subsystemdisconnect            Disconnect from NVMeoF subsystemdisconnect-all        Disconnect from all connected NVMeoF subsystemsgen-hostnqn           Generate NVMeoF host NQNdir-receive           Submit a Directive Receive command, return resultsdir-send              Submit a Directive Send command, return resultsvirt-mgmt             Manage Flexible Resources between Primary and Secondary Controller version               Shows the program versionhelp                  Display this helpSee 'nvme help <command>' for more information on a specific commandThe following are all installed plugin extensions:intel           Intel vendor specific extensionslnvm            LightNVM specific extensionsmemblaze        Memblaze vendor specific extensionswdc             Western Digital vendor specific extensionshuawei          Huawei vendor specific extensionsnetapp          NetApp vendor specific extensionstoshiba         Toshiba NVME pluginmicron          Micron vendor specific extensionsseagate         Seagate vendor specific extensionsSee 'nvme <plugin> help' for more information on a plugin

nvme-cli使用相关推荐

  1. hdparm nvme cli tool

    hdparm 常用指令: nvme 常用指令 4K 对齐指令 使用nvme cli 对盘进行OP nvme format nvme format -s 1 /dev/xxxx nvme FW upda ...

  2. NVME CLI -- nvme 命令查看NVME设备内部状态

    文章目录 NVME 和 AHCI 性能比较 NVME-CLI nvme工具使用 1. 安装 2. 命令综述 3. 基本命令演示 4. NVME 固件设备升级 近期在做一些rocksdb on 新硬件的 ...

  3. nvme metadata end to end 简介和测试

    单独对于Metadata的测试只是校验Metadata的写入和读出是否正常就可以了,在格式化成metadata的格式后,不会对lba的数据传输产生影响;metadata的写入读出也都正确.前者可以通过 ...

  4. PBlaze5 520 系列特性——双重自检

    上次我们介绍了Memblaze最新推出的低功耗系列<PBlaze5 520 NVMe SSD --NVMe-MI接口的带外管理>,这是从PBlaze5 520系列最新增加的功能,并向大家介 ...

  5. 基于Golang的CLI 命令行程序开发

    基于Golang的CLI 命令行程序开发 [阅读时间:约15分钟] 一. CLI 命令行程序概述 二. 系统环境&项目介绍&开发准备 1.系统环境 2.项目介绍 3.开发准备 三.具体 ...

  6. cli vue 卸载,vue Cli 环境删除与重装教程 - 版本文档

    vue-cli 卸载,版本选择,安装 · 检测(图文教程:vue Cli 环境删除与重装) 重要说明: vue-cli 3.0+版本,使用的不是vue-cli,而是@vue/cli: 如果用以上的安装 ...

  7. ng命令汇总:Angular CLI 使用教程指南参考

    Angular CLI 使用教程指南参考 Angular CLI 现在虽然可以正常使用但仍然处于测试阶段. Angular CLI 依赖 Node 4 和 NPM 3 或更高版本. 安装 要安装Ang ...

  8. KVell 单机k/v引擎:用最少的CPU 来调度Nvme的极致性能

    文章目录 前言 KVell背景 业界引擎使用Nvme的问题 CPU 会是 LSM-kv 存储的瓶颈 CPU 也会是 Btree-kv 存储的瓶颈 KVell 设计亮点 及 总体架构实现 KVell 设 ...

  9. 磁盘I:O 性能指标 以及 如何通过 fio 对nvme ssd,optane ssd, pmem 性能摸底

    文章目录 1. 磁盘I/O性能指标 1.1 性能指标 1.2 I/O 观测 1.2.1 磁盘I/O 观测 1.2.2 进程I/O观测 2. Fio 性能测试 2.1 环境准备 2.2 测试维度选择 2 ...

  10. Angular CLI在线安装和离线安装

    Angular CLI 安装方式 默认已经安装了 Node.js 和 npm 包管理器. 1. 在线安装 可以使用外网的情况下,可以使用在线安装的方式. 要使用 npm 命令全局安装 CLI,请打开终 ...

最新文章

  1. LeetCode简单题之合并两个链表
  2. 文巾解题 278. 第一个错误的版本
  3. 斯特林公式(Stirling's approximation)
  4. jupter中没有显示conda中的环境
  5. C++中相对路径与绝对路径以及斜杠与反斜杠的区别 及 处理代码
  6. html怎么给变量添加样式,通过CSS变量修改样式
  7. jpa 多字段like_Spring Date jpa 多个like匹配查询基础问题?
  8. HBase与关系数据库
  9. RabbitMQ学习之ConntectionFactory与Conntection的认知
  10. 苹果自动驾驶测试车近距离实拍,头顶新添传感器和硬件
  11. Daily Scrum10 11.14
  12. 《对比Excel,轻松学习Python数据分析》读书笔记------Pandas入门
  13. Win10系统 Python解释器:anaconda的安装
  14. 阿里云香港地域云服务器、轻量和虚拟活动报价
  15. Kafka——Kafka的日志存储(5)
  16. 副业项目:抖音车载U盘赚钱项目
  17. flag{e2f34a3a-9972-4ba5-bdeb-ff7d524d87cb} preg_match implode
  18. 如何解决“Component ‘MSCOMCTLOCX‘ or one of its dependencies .....“
  19. 软件测试自学英语计划,软件测试计划,software testing plan,音标,读音,翻译,英文例句,英语词典...
  20. 【C51开发应用】基于C51单片机开发的循迹灭火机器人

热门文章

  1. Java总结(14) 静态导入 可变长参数
  2. uiautomatorviewer 启动界面抓取时报错 Error taking device screenshot: EOF
  3. 十四. 项目人力资源管理
  4. [转]unity之龙骨动画的使用
  5. 只有i帧的pts,dts,如何求取中间的b帧和p帧的长度和解码时间
  6. 云会展新业态会成就谁?
  7. lasermaker教学视频观看地址合集
  8. 【学习笔记】High-level Semantic Feature Detection: A New Perspective for Pedestrian Detection/CSP
  9. JSDoc入门使用指南 -- 手摸手教你用JSDoc(超好用的js文档生成工具)
  10. CSCI 2500 — Computer Organization