nvme-compare man page

nvme-compare — Send an NVMe Compare command, provide results


nvme-compare <device> [--start-block=<slba> | -s <slba>]
                        [--block-count=<nlb> | -c <nlb>]
                        [--data-size=<size> | -z <size>]
                        [--metadata-size=<metasize> | -y <metasize>]
                        [--ref-tag=<reftag> | -r <reftag>]
                        [--data=<data-file> | -d <data-file>]
                        [--metadata=<meta> | -M <meta>]
                        [--prinfo=<prinfo> | -p <prinfo>]
                        [--app-tag-mask=<appmask> | -m <appmask>]
                        [--app-tag=<apptag> | -a <apptag>]
                        [--limited-retry | -l]
                        [--force-unit-access | -f]
                        [--dir-type=<type> | -T <type>]
                        [--dir-spec=<spec> | -S <spec>]
                        [--dsm=<dsm> | -D <dsm>]
                        [--show-command | -v]
                        [--dry-run | -w]
                        [--latency | -t]


The Compare command reads the logical blocks specified by the command from the medium and compares the data read to a comparison data buffer transferred as part of the command. If the data read from the controller and the comparison data buffer are equivalent with no miscompares, then the command completes successfully. If there is any miscompare, the command completes with an error of Compare Failure. If metadata is provided, then a comparison is also performed for the metadata.


-s <slba>, --start-block=<slba>

64-bit address of the first block to access.

-c <nlb>, --block-count=<nlb>

Number of blocks to be accessed (zero-based).

-z <size>, --data-size=<size>

Size of data to be compared in bytes.

-y <metasize>, --metadata-size=<metasize>

Size of metadata to be trasnferred in bytes.

-r <reftag>, --ref-tag=<regtag>

Reference Tag for Protection Information

-d <data-file>, --data=<data-file>

Data file.

-M <meta>, --metadata=<meta>

Metadata file.

-p <prinfo>, --prinfo=<prinfo>

Protection Information and check field.


Bit Description
3 PRACT: Protection Information Action. When set to 1, PI is stripped/inserted on read/write when the block format’s metadata size is 8. When set to 0, metadata is passes.
2:0 PRCHK: Protection Information Check:
2 Set to 1 enables checking the guard tag
1 Set to 1 enables checking the application tag
0 Set to 1 enables checking the reference tag
-m <appmask>, --app-tag-mask=<appmask>

App Tag Mask for Protection Information

-a <apptag>, --app-tag=<apptag>

App Tag for Protection Information

-l, --limited-retry

Number of limited attempts to media.

-f, --force-unit-access

FUA option to guarantee that data is stored to media.

-T <type>, --dir-type=<type>

Optional directive type. The nvme-cli only enforces the value be in the defined range for the directive type, though the NVMe specifcation (1.3a) defines only one directive, 01h, for write stream idenfiers.

-S <spec>, --dir-spec=<spec>

Optional field for directive specifics. When used with write streams, this value is defined to be the write stream identifier. The nvme-cli will not validate the stream requested is within the controller’s capabilities.

-D <dsm>, --dsm=<dsm>

The optional data set management attributes for this command. The argument for this is the lower 16 bits of the DSM field in a write command; the upper 16 bits of the field come from the directive specific field, if used. This may be used to set attributes for the LBAs being written, like access frequency, type, latency, among other things, as well as yet to be defined types. Please consult the NVMe specification for detailed breakdown of how to use this field.

-v, --show-cmd

Print out the command to be sent.

-w, --dry-run

Do not actually send the command. If want to use --dry-run option, --show-cmd option must be set. Otherwise --dry-run optionn will be ignored.

-t, --latency

Print out the latency the IOCTL took (in us).


No examples yet.


Part of the nvme-user suite

Referenced By


06/05/2018 NVMe Manual