'\" t .\" Title: veritysetup .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.20 .\" Date: 2024-01-05 .\" Manual: Maintenance Commands .\" Source: veritysetup 2.6.1 .\" Language: English .\" .TH "VERITYSETUP" "8" "2024-01-05" "veritysetup 2.6.1" "Maintenance Commands" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 .nh .ad l .de URL \fI\\$2\fP <\\$1>\\$3 .. .als MTO URL .if \n[.g] \{\ . mso www.tmac . am URL . ad l . . . am MTO . ad l . . . LINKSTYLE blue R < > .\} .SH "NAME" veritysetup \- manage dm\-verity (block level verification) volumes .SH "SYNOPSIS" .sp \fBveritysetup [] \fP .SH "DESCRIPTION" .sp Veritysetup is used to configure dm\-verity managed device\-mapper mappings. .sp Device\-mapper verity target provides read\-only transparent integrity checking of block devices using kernel crypto API. .sp The dm\-verity devices are always read\-only. .SH "BASIC ACTIONS" .sp Veritysetup supports these operations: .SS "FORMAT" .sp \fBformat \fP .sp Calculates and permanently stores hash verification data for data_device. Hash area can be located on the same device after data if specified by \-\-hash\-offset option. .sp Note you need to provide root hash string for device verification or activation. Root hash must be trusted. .sp The data or hash device argument can be block device or file image. If hash device path doesn\(cqt exist, it will be created as file. .sp \fB\fP can be [\-\-hash, \-\-no\-superblock, \-\-format, \-\-data\-block\-size, \-\-hash\-block\-size, \-\-data\-blocks, \-\-hash\-offset, \-\-salt, \-\-uuid, \-\-root\-hash\-file]. .sp If option \-\-root\-hash\-file is used, the root hash is stored in hex\-encoded text format in . .SS "OPEN" .sp \fBopen \fP .br \fBopen \-\-root\-hash\-file \fP .br create (\fBOBSOLETE syntax\fP) .sp Creates a mapping with backed by device and using for in\-kernel verification. .sp The is a hexadecimal string. .sp \fB\fP can be [\-\-hash\-offset, \-\-no\-superblock, \-\-ignore\-corruption or \-\-restart\-on\-corruption, \-\-panic\-on\-corruption, \-\-ignore\-zero\-blocks, \-\-check\-at\-most\-once, \-\-root\-hash\-signature, \-\-root\-hash\-file, \-\-use\-tasklets]. .sp If option \-\-root\-hash\-file is used, the root hash is read from instead of from the command line parameter. Expects hex\-encoded text, without terminating newline. .sp If option \-\-no\-superblock is used, you have to use as the same options as in initial format operation. .SS "VERIFY" .sp \fBverify \fP .br \fBverify \-\-root\-hash\-file \fP .sp Verifies data on data_device with use of hash blocks stored on hash_device. .sp This command performs userspace verification, no kernel device is created. .sp The is a hexadecimal string. .sp If option \-\-root\-hash\-file is used, the root hash is read from instead of from the command line parameter. Expects hex\-encoded text, without terminating newline. .sp \fB\fP can be [\-\-hash\-offset, \-\-no\-superblock, \-\-root\-hash\-file]. .sp If option \-\-no\-superblock is used, you have to use as the same options as in initial format operation. .SS "CLOSE" .sp \fBclose \fP .br remove (\fBOBSOLETE syntax\fP) .sp Removes existing mapping . .sp \fB\fP can be [\-\-deferred] or [\-\-cancel\-deferred]. .SS "STATUS" .sp \fBstatus \fP .sp Reports status for the active verity mapping . .SS "DUMP" .sp \fBdump \fP .sp Reports parameters of verity device from on\-disk stored superblock. .sp \fB\fP can be [\-\-hash\-offset]. .SH "OPTIONS" .sp \fB\-\-no\-superblock\fP .RS 4 Create or use dm\-verity without permanent on\-disk superblock. .RE .sp \fB\-\-format=number\fP .RS 4 Specifies the hash version type. Format type 0 is original Chrome OS version. Format type 1 is current version. .RE .sp \fB\-\-data\-block\-size=bytes\fP .RS 4 Used block size for the data device. (Note kernel supports only page\-size as maximum here.) .RE .sp \fB\-\-hash\-block\-size=bytes\fP .RS 4 Used block size for the hash device. (Note kernel supports only page\-size as maximum here.) .RE .sp \fB\-\-data\-blocks=blocks\fP .RS 4 Size of data device used in verification. If not specified, the whole device is used. .RE .sp \fB\-\-hash\-offset=bytes\fP .RS 4 Offset of hash area/superblock on hash_device. Value must be aligned to disk sector offset. .RE .sp \fB\-\-salt=hex string\fP .RS 4 Salt used for format or verification. Format is a hexadecimal string. .RE .sp \fB\-\-uuid=UUID\fP .RS 4 Use the provided UUID for format command instead of generating new one. .sp The UUID must be provided in standard UUID format, e.g. 12345678\-1234\-1234\-1234\-123456789abc. *\-\-ignore\-corruption , \-\-restart\-on\-corruption , .RE .sp \-\-panic\-on\-corruption* .RS 4 Defines what to do if data integrity problem is detected (data corruption). .sp 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 or \-\-panic\-on\-corruption the kernel is restarted (panicked) immediately. (You have to provide way how to avoid restart loops.) .sp \fBWARNING:\fP Use these options only for very specific cases. These options are available since Linux kernel version 4.1. .RE .sp \fB\-\-ignore\-zero\-blocks\fP .RS 4 Instruct kernel to not verify blocks that are expected to contain zeroes and always directly return zeroes instead. .sp \fBWARNING:\fP Use this option only in very specific cases. This option is available since Linux kernel version 4.5. .RE .sp \fB\-\-check\-at\-most\-once\fP .RS 4 Instruct kernel to verify blocks only the first time they are read from the data device, rather than every time. .sp \fBWARNING:\fP It provides a reduced level of security because only offline tampering of the data device\(cqs content will be detected, not online tampering. This option is available since Linux kernel version 4.17. .RE .sp \fB\-\-hash=hash\fP .RS 4 Hash algorithm for dm\-verity. For default see \-\-help option. .RE .sp \fB\-\-fec\-device=fec_device\fP .RS 4 Use forward error correction (FEC) to recover from corruption if hash verification fails. Use encoding data from the specified device. .sp The fec device argument can be block device or file image. For format, if fec device path doesn\(cqt exist, it will be created as file. .sp Block sizes for data and hash devices must match. Also, if the verity data_device is encrypted the fec_device should be too. .sp FEC calculation covers data, hash area, and optional foreign metadata stored on the same device with the hash tree (additional space after hash area). Size of this optional additional area protected by FEC is calculated from image sizes, so you must be sure that you use the same images for activation. .sp If the hash device is in a separate image, metadata covers the whole rest of the image after the hash area. .sp If hash and FEC device is in the image, metadata ends on the FEC area offset. .RE .sp \fB\-\-fec\-offset=bytes\fP .RS 4 This is the offset, in bytes, from the start of the FEC device to the beginning of the encoding data. .RE .sp \fB\-\-fec\-roots=num\fP .RS 4 Number of generator roots. This equals to the number of parity bytes in the encoding data. In RS(M, N) encoding, the number of roots is M\-N. M is 255 and M\-N is between 2 and 24 (including). .RE .sp \fB\-\-root\-hash\-file=FILE\fP .RS 4 Path to file with stored root hash in hex\-encoded text. .RE .sp \fB\-\-root\-hash\-signature=FILE\fP .RS 4 Path to root hash signature file used to verify the root hash (in kernel). This feature requires Linux kernel version 5.4 or more recent. .RE .sp \fB\-\-use\-tasklets\fP .RS 4 Try to use kernel tasklets in dm\-verity driver for performance reasons. This option is available since Linux kernel version 6.0. .RE .sp \fB\-\-deferred\fP .RS 4 Defers device removal in \fBclose\fP command until the last user closes it. .RE .sp \fB\-\-cancel\-deferred\fP .RS 4 Removes a previously configured deferred device removal in \fBclose\fP command. .RE .sp \fB\-\-verbose, \-v\fP .RS 4 Print more information on command execution. .RE .sp \fB\-\-debug\fP .RS 4 Run in debug mode with full diagnostic logs. Debug output lines are always prefixed by \fB#\fP. .RE .sp \fB\-\-version, \-V\fP .RS 4 Show the program version. .RE .sp \fB\-\-batch\-mode, \-q\fP .RS 4 Do not ask for confirmation. .RE .sp \fB\-\-usage\fP .RS 4 Show short option help. .RE .sp \fB\-\-help, \-?\fP .RS 4 Show help text and default parameters. .RE .SH "RETURN CODES" .sp Veritysetup returns \fB0\fP on success and a non\-zero value on error. .sp Error codes are: \fB1\fP wrong parameters, \fB2\fP no permission, \fB3\fP out of memory, \fB4\fP wrong device specified, \fB5\fP device already exists or device is busy. .SH "EXAMPLES" .sp \fBveritysetup \-\-data\-blocks=256 format \fP .sp 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). .sp \fBveritysetup format \-\-root\-hash\-file \fP .sp Calculates and stores verification data on hash_device for the whole data_device, and store the root hash as hex\-encoded text in . .sp \fBveritysetup \-\-data\-blocks=256 \-\-hash\-offset=1052672 format \fP .sp 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. .sp \fBveritysetup \-\-data\-blocks=256 \-\-hash\-offset=1052672 create test\-device \fP .sp Activates the verity device named test\-device. Options \-\-data\-blocks and \-\-hash\-offset are the same as in the format command. The was calculated in format command. .sp \fBveritysetup \-\-data\-blocks=256 \-\-hash\-offset=1052672 verify \fP .sp Verifies device without activation (in userspace). .sp \fBveritysetup \-\-data\-blocks=256 \-\-hash\-offset=1052672 \-\-root\-hash\-file verify \fP .sp Verifies device without activation (in userspace). Root hash passed via a file rather than inline. .sp \fBveritysetup \-\-fec\-device= \-\-fec\-roots=10 format \fP .sp Calculates and stores verification and encoding data for data_device. .SH "DM\-VERITY ON\-DISK SPECIFICATION" .sp The on\-disk format specification is available at .URL "https://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerity" "\fBDMVerity\fP" "" page. .SH "AUTHORS" .sp The first implementation of veritysetup was written by Chrome OS authors. .sp This version is based on verification code written by .MTO "mpatocka\(atredhat.com" "Mikulas Patocka" "" and rewritten for libcryptsetup by \c .MTO "gmazyland\(atgmail.com" "Milan Broz" "." .SH "REPORTING BUGS" .sp Report bugs at \c .MTO "cryptsetup\(atlists.linux.dev" "\fBcryptsetup mailing list\fP" or in \c .URL "https://gitlab.com/cryptsetup/cryptsetup/\-/issues/new" "\fBIssues project section\fP" "." .sp Please attach output of the failed command with \-\-debug option added. .SH "SEE ALSO" .sp .URL "https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions" "\fBCryptsetup FAQ\fP" "" .sp \fBcryptsetup\fP(8), \fBintegritysetup\fP(8) and \fBveritysetup\fP(8) .SH "CRYPTSETUP" .sp Part of \c .URL "https://gitlab.com/cryptsetup/cryptsetup/" "\fBcryptsetup project\fP" "."