3 :manmanual: Maintenance Commands
4 :mansource: integritysetup {release-version}
5 :man-linkstyle: pass:[blue R < >]
9 integritysetup - manage dm-integrity (block level integrity) volumes
13 *integritysetup <action> [<options>] <action args>*
17 Integritysetup is used to configure dm-integrity managed device-mapper
20 Device-mapper integrity target provides read-write transparent integrity
21 checking of block devices. The dm-integrity target emulates an additional
22 data integrity field per-sector. You can use this additional field
23 directly with integritysetup utility, or indirectly (for authenticated
24 encryption) through cryptsetup.
28 Integritysetup supports these operations:
33 Formats <device> (calculates space and dm-integrity superblock and wipes
36 *<options>* can be [--data-device, --batch-mode, --no-wipe,
37 --journal-size, --interleave-sectors, --tag-size, --integrity,
38 --integrity-key-size, --integrity-key-file, --sector-size,
39 --progress-frequency, --progress-json].
42 *open <device> <name>* +
43 create <name> <device> (*OBSOLETE syntax*)
45 Open a mapping with <name> backed by device <device>.
47 *<options>* can be [--data-device, --batch-mode, --journal-watermark,
48 --journal-commit-time, --buffer-sectors, --integrity,
49 --integrity-key-size, --integrity-key-file, --integrity-no-journal,
50 --integrity-recalculate,
51 --integrity-recalculate-reset,--integrity-recovery-mode,
56 remove <name> (*OBSOLETE syntax*)
58 Removes existing mapping <name>.
60 *<options>* can be [--deferred] or [--cancel-deferred]
65 Reports status for the active integrity mapping <name>.
70 Reports parameters from on-disk stored superblock.
75 Resizes an active mapping <name>.
77 If --size (in 512-bytes sectors) or --device-size are not specified, the
78 size is computed from the underlying device. After resize, the
79 *recalculating* flag is set. If --wipe flag is set and the size of the
80 device is increased, the newly added section will be wiped.
82 Increasing the size of integrity volumes is available since the Linux
83 kernel version 5.7, shrinking should work on older kernels too.
85 *<options>* can be [--size, --device-size, --wipe].
88 *--progress-frequency <seconds>*::
89 Print separate line every <seconds> with wipe progress.
92 Prints wipe progress data in json format suitable mostly for machine
93 processing. It prints separate line every half second (or based on
94 --progress-frequency value). The JSON output looks as follows during
95 wipe progress (except it's compact single line):
99 "device":"/dev/sda" // backing device or file
100 "device_bytes":"8192", // bytes wiped so far
101 "device_size":"44040192", // total bytes to wipe
102 "speed":"126877696", // calculated speed in bytes per second (based on progress so far)
103 "eta_ms":"2520012" // estimated time to finish wipe in milliseconds
104 "time_ms":"5561235" // total time spent wiping device in milliseconds
108 Note on numbers in JSON output: Due to JSON parsers limitations all
109 numbers are represented in a string format due to need of full 64bit
113 Do not wipe the device after format. A device that is not initially
114 wiped will contain invalid checksums.
117 Wipe the newly allocated area after resize to bigger size. If this
118 flag is not set, checksums will be calculated for the data previously
119 stored in the newly allocated area.
121 *--journal-size, -j BYTES*::
124 *--interleave-sectors SECTORS*::
125 The number of interleaved sectors.
127 *--integrity-recalculate*::
128 Automatically recalculate integrity tags in kernel on activation. The
129 device can be used during automatic integrity recalculation but
130 becomes fully integrity protected only after the background operation
131 is finished. This option is available since the Linux kernel version
134 *--integrity-recalculate-reset*::
135 Restart recalculation from the beginning of the device. It can be used
136 to change the integrity checksum function. Note it does not change the
137 tag length. This option is available since the Linux kernel version
140 *--journal-watermark PERCENT*::
141 Journal watermark in percents. When the size of the journal exceeds
142 this watermark, the journal flush will be started.
144 *--journal-commit-time MS*::
145 Commit time in milliseconds. When this time passes (and no explicit
146 flush operation was issued), the journal is written.
148 *--tag-size, -t BYTES*::
149 Size of the integrity tag per-sector (here the integrity function will
150 store authentication tag).
152 *NOTE:* The size can be smaller that output size of the hash function,
153 in that case only part of the hash will be stored.
155 *--data-device <data_device>*::
156 Specify a separate data device that contains existing data. The
157 <device> then will contain calculated integrity tags and journal for
158 data on <data_device>.
160 *NOTE:* To not wipe the data device after initial format, also specify
161 --no-wipe option and activate with --integrity-recalculate to
162 automatically recalculate integrity tags.
164 *--sector-size, -s BYTES*::
165 Sector size (power of two: 512, 1024, 2048, 4096).
167 *--buffer-sectors SECTORS*::
168 The number of sectors in one buffer.
170 The tag area is accessed using buffers, the large buffer size means that
171 the I/O size will be larger, but there could be less I/Os issued.
173 *--integrity, -I ALGORITHM*::
174 Use internal integrity calculation (standalone mode). The integrity
175 algorithm can be CRC (crc32c/crc32), non-cryptographic hash function
176 (xxhash64) or hash function (sha1, sha256).
178 For HMAC (hmac-sha256) you have also to specify an integrity key and its
181 *--integrity-key-size BYTES*::
182 The size of the data integrity key. Maximum is 4096 bytes.
184 *--integrity-key-file FILE*::
185 The file with the integrity key.
187 *--integrity-no-journal, -D*::
188 Disable journal for integrity device.
190 *--integrity-bitmap-mode. -B*::
191 Use alternate bitmap mode (available since Linux kernel 5.2) where
192 dm-integrity uses bitmap instead of a journal. If a bit in the bitmap
193 is 1, the corresponding region's data and integrity tags are not
194 synchronized - if the machine crashes, the unsynchronized regions will
195 be recalculated. The bitmap mode is faster than the journal mode,
196 because we don't have to write the data twice, but it is also less
197 reliable, because if data corruption happens when the machine crashes,
198 it may not be detected.
200 *--bitmap-sectors-per-bit SECTORS*::
201 Number of 512-byte sectors per bitmap bit, the value must be power of
204 *--bitmap-flush-time MS*::
205 Bitmap flush time in milliseconds.
208 In case of a crash, it is possible that the data and integrity tag
209 doesn't match if the journal is disabled.
211 *--integrity-recovery-mode. -R*::
212 Recovery mode (no journal, no tag checking).
214 *NOTE:* The following options are intended for testing purposes only.:
215 Using journal encryption does not make sense without encryption the
216 data, these options are internally used in authenticated disk
217 encryption with *cryptsetup(8)*.
219 *--journal-integrity ALGORITHM*::
220 Integrity algorithm for journal area. See --integrity option for
221 detailed specification.
223 *--journal-integrity-key-size BYTES*::
224 The size of the journal integrity key. Maximum is 4096 bytes.
226 *--journal-integrity-key-file FILE*::
227 The file with the integrity key.
229 *--journal-crypt ALGORITHM*::
230 Encryption algorithm for journal data area. You can use a block cipher
231 here such as cbc-aes or a stream cipher, for example, chacha20 or
234 *--journal-crypt-key-size BYTES*::
235 The size of the journal encryption key. Maximum is 4096 bytes.
237 *--journal-crypt-key-file FILE*::
238 The file with the journal encryption key.
241 Allow the use of discard (TRIM) requests for the device. This option
242 is available since the Linux kernel version 5.7.
245 Defers device removal in *close* command until the last user closes
248 *--cancel-deferred*::
249 Removes a previously configured deferred device removal in *close*
253 Print more information on command execution.
256 Run in debug mode with full diagnostic logs. Debug output lines are
257 always prefixed by *#*.
260 Show the program version.
263 Do not ask for confirmation.
266 Show short option help.
269 Show help text and default parameters.
271 == LEGACY COMPATIBILITY OPTIONS
274 Do not use these options until you need compatibility with specific
277 *--integrity-legacy-padding*::
278 Use inefficient legacy padding.
280 *--integrity-legacy-hmac*::
281 Use old flawed HMAC calculation (also does not protect superblock).
283 *--integrity-legacy-recalculate*::
284 Allow insecure recalculating of volumes with HMAC keys (recalculation
285 offset in superblock is not protected).
289 Integritysetup returns *0* on success and a non-zero value on error.
291 Error codes are: *1* wrong parameters, *2* no permission, *3* out of memory,
292 *4* wrong device specified, *5* device already exists or device is busy.
295 The dm-integrity target is available since Linux kernel version 4.12.
297 Format and activation of an integrity device always require superuser
298 privilege because the superblock is calculated and handled in
299 dm-integrity kernel target.
303 Format the device with default standalone mode (CRC32C):
305 *integritysetup format <device>*
307 Open the device with default parameters:
309 *integritysetup open <device> test*
311 Format the device in standalone mode for use with HMAC(SHA256):
313 *integritysetup format <device> --tag-size 32 --integrity hmac-sha256
314 --integrity-key-file <keyfile> --integrity-key-size <key_bytes>*
316 Open (activate) the device with HMAC(SHA256) and HMAC key in file:
318 *integritysetup open <device> test --integrity hmac-sha256
319 --integrity-key-file <keyfile> --integrity-key-size <key_bytes>*
321 Dump dm-integrity superblock information:
323 *integritysetup dump <device>*
325 == DM-INTEGRITY ON-DISK FORMAT
327 The on-disk format specification available at
328 https://gitlab.com/cryptsetup/cryptsetup/wikis/DMIntegrity[*DMIntegrity*] page.
332 The integritysetup tool is written by mailto:gmazyland@gmail.com[Milan Broz].
334 include::man/common_footer.adoc[]