Veritysetup is used to configure dm-verity managed device-mapper mappings.
Device-mapper verity target provides read-only transparent integrity checking of block devices using kernel crypto API.
The dm-verity devices are always read-only.
Veritysetup supports these operations:
format <data_device> <hash_device>
Note you need to provide root hash string for device verification or activation. Root hash must be trusted.
The data or hash device argument can be block device or file image. If hash device path doesn't exist, it will be created as file.
<options> can be [--hash, --no-superblock, --format, --data-block-size, --hash-block-size, --data-blocks, --hash-offset, --salt, --uuid]
create <name> <data_device> <hash_device> <root_hash>
The <root_hash> is a hexadecimal string.
<options> can be [--hash-offset, --no-superblock, --ignore-corruption or --restart-on-corruption, --ignore-zero-blocks]
If option --no-superblock is used, you have to use as the same options as in initial format operation.
verify <data_device> <hash_device> <root_hash>
This command performs userspace verification, no kernel device is created.
The <root_hash> is a hexadecimal string.
<options> can be [--hash-offset, --no-superblock]
If option --no-superblock is used, you have to use as the same options as in initial format operation.
remove <name>
status <name>
dump <hash_device>
<options> can be [--no-superblock]
The UUID must be provided in standard UUID format, e.g. 12345678-1234-1234-1234-123456789abc.
Without these options kernel fails the IO operation with I/O error. With --ignore-corruption option the corruption is only logged. With --restart-on-corruption the kernel is restarted immediatelly. (You have to provide way how to avoid restart loops.)
WARNING: Use these options only for very specific cases. These options are available since Linux kernel version 4.1.
WARNING: Use this option only in very specific cases. This option is available since Linux kernel version 4.5.
Error codes are:
1 wrong parameters
2 no permission
3 out of memory
4 wrong device specified
5 device already exists or device is busy.
Calculates and stores verification data on hash_device for the first 256 blocks (of block-size). If hash_device does not exist, it is created (as file image).
veritysetup format <data_device> <hash_device>
Calculates and stores verification data on hash_device for the whole data_device.
veritysetup --data-blocks=256 --hash-offset=1052672 format <device> <device>
Verification data (hashes) is stored on the same device as data (starting at hash-offset). Hash-offset must be greater than number of blocks in data-area.
veritysetup --data-blocks=256 --hash-offset=1052672 create test-device <device> <device> <root_hash>
Acivatees the verity device named test-device. Options --data-blocks and --hash-offset are the same as in the format command. The <root_hash> was calculated in format command.
veritysetup --data-blocks=256 --hash-offset=1052672 verify <data_device> <hash_device> <root_hash>
Verifies device without activation (in userspace).
This version is based on verification code written by Mikulas Patocka <mpatocka@redhat.com> and rewritten for libcryptsetup by Milan Broz <gmazyland@gmail.com>.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The verity on-disk format specification available at https://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerity