nvm_addr

NVM address (nvm_addr_*) -- Ver { major(0), minor(0), patch(1) }

Construct / convert addresses and perform vector IO

Usage:
 nvm_addr        erase dev_path 0xADDR [0xADDR...] [-h] [-v]
 nvm_addr        write dev_path 0xADDR [0xADDR...] [-h] [-v] [-i FILE]
 nvm_addr     write_wm dev_path 0xADDR [0xADDR...] [-h] [-v] [-i FILE]
 nvm_addr         read dev_path 0xADDR [0xADDR...] [-h] [-v] [-o FILE]
 nvm_addr      read_wm dev_path 0xADDR [0xADDR...] [-h] [-v] [-o FILE]
 nvm_addr     from_geo dev_path ch lun pl blk pg sec [-h] [-v]
 nvm_addr     from_hex dev_path 0xADDR [0xADDR...] [-h] [-v]
 nvm_addr      gen2dev dev_path 0xADDR [0xADDR...] [-h] [-v]
 nvm_addr      gen2lba dev_path 0xADDR [0xADDR...] [-h] [-v]
 nvm_addr      gen2off dev_path 0xADDR [0xADDR...] [-h] [-v]
 nvm_addr      dev2gen dev_path 0xVAL [0xVAL...] [-h] [-v]
 nvm_addr      lba2gen dev_path val [val...] [-h] [-v]
 nvm_addr      off2gen dev_path val [val...] [-h] [-v]

Options:
 -h       Print usage
 -v       Dump CLI state to stdout
 -i  FILE Path to input file
 -o  FILE Path to output file

See: http://lightnvm.io/liblightnvm/cli/ for usage examples

Tip

See section Environment Variables for a full list of environment variables modifying command behavior

Address Formats

The command-line parameter 0xADDR is a textual hexadecimal representation of a physical address in generic format.

Generic Format

The relative location in device geometry can be used to construct physical address in generic format, e.g. channel(2), LUN(1), plane(0), blk(10), page(200), sector(2):

nvm_addr from_geo /dev/nvme0n1 2 1 0 10 200 2
0x0201000200c8000a: {ch: 02, lun: 01, pl: 0, blk: 0010, pg: 200, sec: 2}

Device Format

A physical address in device format can be construct from the physical address in generic format:

nvm_addr gen2dev /dev/nvme0n1 0x0201000200c8000a
gen: 0x0201000200c8000a: {ch: 02, lun: 01, pl: 0, blk: 0010, pg: 200, sec: 2}
dev: 0x000000000440a642

Submitting IO

Four commands are provided for constructing read / write commands. The write-command use a synthetic payload in the form of a repeating sequence of chars A-Z.

write
Perform a write of data using a synthetic payload at the given addresses
write_wm
Perform a write of data and meta-data (out-of-bound area) using a synthetic payload at the given addresses
read
Perform a read of data at the given addresses
read_wm
Perform a read of data and meta-data (out-of-bound area) at the given addresses addresses

Note

Commands by default expects plane-hint, however, it can be disabled

Perform a command without plane-hint by setting the environment var NVM_CLI_PMODE="0":

NVM_CLI_PMODE="0" nvm_addr read /dev/nvme0n1 \
0x000000000064000a 0x000000010064000a 0x000000020064000a 0x000000030064000a
# nvm_addr_read: {pmode: SNGL}
0x000000000064000a: {ch: 00, lun: 00, pl: 0, blk: 0010, pg: 100, sec: 0}
0x000000010064000a: {ch: 00, lun: 00, pl: 0, blk: 0010, pg: 100, sec: 1}
0x000000020064000a: {ch: 00, lun: 00, pl: 0, blk: 0010, pg: 100, sec: 2}
0x000000030064000a: {ch: 00, lun: 00, pl: 0, blk: 0010, pg: 100, sec: 3}

With plane-hint enabled perform a read command consisting of eight addresses:

nvm_addr read /dev/nvme0n1 \
0x000000000064000a 0x000000010064000a 0x000000020064000a 0x000000030064000a \
0x000001000064000a 0x000001010064000a 0x000001020064000a 0x000001030064000a
# nvm_addr_read: {pmode: DUAL}
0x000000000064000a: {ch: 00, lun: 00, pl: 0, blk: 0010, pg: 100, sec: 0}
0x000000010064000a: {ch: 00, lun: 00, pl: 0, blk: 0010, pg: 100, sec: 1}
0x000000020064000a: {ch: 00, lun: 00, pl: 0, blk: 0010, pg: 100, sec: 2}
0x000000030064000a: {ch: 00, lun: 00, pl: 0, blk: 0010, pg: 100, sec: 3}
0x000001000064000a: {ch: 00, lun: 00, pl: 1, blk: 0010, pg: 100, sec: 0}
0x000001010064000a: {ch: 00, lun: 00, pl: 1, blk: 0010, pg: 100, sec: 1}
0x000001020064000a: {ch: 00, lun: 00, pl: 1, blk: 0010, pg: 100, sec: 2}
0x000001030064000a: {ch: 00, lun: 00, pl: 1, blk: 0010, pg: 100, sec: 3}

Use the -o FILE option, to dump the data read from device to file:

nvm_addr read /dev/nvme0n1 \
0x000000000064000a 0x000000010064000a 0x000000020064000a 0x000000030064000a \
0x000001000064000a 0x000001010064000a 0x000001020064000a 0x000001030064000a \
-o /tmp/nvm_dump.bin
# nvm_addr_read: {pmode: DUAL}
0x000000000064000a: {ch: 00, lun: 00, pl: 0, blk: 0010, pg: 100, sec: 0}
0x000000010064000a: {ch: 00, lun: 00, pl: 0, blk: 0010, pg: 100, sec: 1}
0x000000020064000a: {ch: 00, lun: 00, pl: 0, blk: 0010, pg: 100, sec: 2}
0x000000030064000a: {ch: 00, lun: 00, pl: 0, blk: 0010, pg: 100, sec: 3}
0x000001000064000a: {ch: 00, lun: 00, pl: 1, blk: 0010, pg: 100, sec: 0}
0x000001010064000a: {ch: 00, lun: 00, pl: 1, blk: 0010, pg: 100, sec: 1}
0x000001020064000a: {ch: 00, lun: 00, pl: 1, blk: 0010, pg: 100, sec: 2}
0x000001030064000a: {ch: 00, lun: 00, pl: 1, blk: 0010, pg: 100, sec: 3}

Which can then be inspected with for example hexdump:

hexdump /tmp/nvm_dump.bin -C -n 128
00000000  4d 4e 4f 50 51 52 53 54  55 56 57 58 59 5a 41 42  |MNOPQRSTUVWXYZAB|
00000010  43 44 45 46 47 48 49 4a  4b 4c 4d 4e 4f 50 51 52  |CDEFGHIJKLMNOPQR|
00000020  53 54 55 56 57 58 59 5a  41 42 43 44 45 46 47 48  |STUVWXYZABCDEFGH|
00000030  49 4a 4b 4c 4d 4e 4f 50  51 52 53 54 55 56 57 58  |IJKLMNOPQRSTUVWX|
00000040  59 5a 41 42 43 44 45 46  47 48 49 4a 4b 4c 4d 4e  |YZABCDEFGHIJKLMN|
00000050  4f 50 51 52 53 54 55 56  57 58 59 5a 41 42 43 44  |OPQRSTUVWXYZABCD|
00000060  45 46 47 48 49 4a 4b 4c  4d 4e 4f 50 51 52 53 54  |EFGHIJKLMNOPQRST|
00000070  55 56 57 58 59 5a 41 42  43 44 45 46 47 48 49 4a  |UVWXYZABCDEFGHIJ|
00000080