INTEGRITYSETUP(8)

๐Ÿ’– INTEGRITYSETUP(8) ๐Ÿ’– โ€” the integritysetup girlies' guide

okay so bestie, welcome to the Maintenance Commands section of the manual, and specifically to integritysetup โ€” the utility for configuring and managing dm-integrity devices. yes this is the whole page. yes it's long. no we are not skipping anything. grab a strawberry ๐Ÿ“ and let's go.


๐ŸŒธ NAME ๐ŸŒธ

integritysetup โ€” a whole utility for configuring and managing dm-integrity devices. that's it. that's the name section. slay.


โœจ SYNOPSIS โœจ

integritysetup <action> [<options>] <action args>

literally that's the shape of it. action, then options, then the action's args. periodt.


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so integritysetup is a utility for configuring and managing kernel dm-integrity devices. ๐Ÿ’…

the kernel device-mapper dm-integrity target emulates an additional data integrity tag per disk sector and provides transparent data integrity protection of block devices. the way that works is genuinely iconic โ€” extra tag per sector, no cap.

you can configure these additional integrity tags directly with integritysetup, or indirectly (for authenticated encryption) through LUKS2 and cryptsetup(8). and here's the glow-up moment: unlike dm-verity, dm-integrity devices support both read and write operations. the kernel performs data integrity checking transparently using a selected checksum or cryptographic hash algorithm. ๐Ÿคฏ

integrity devices can be activated during boot through integritytab(5), which is part of systemd(1). so boot-time activation is just built in. iconic.


๐Ÿ‘‘ BASIC ACTIONS ๐Ÿ‘‘

integritysetup supports these operations:

๐ŸŽ€ FORMAT

format <device>

Formats <device> (calculates space and dm-integrity superblock and wipes the device). like, it wipes it. fully.

<options> can be [--data-device, --batch-mode, --no-wipe, --journal-size, --interleave-sectors, --tag-size, --integrity, --integrity-key-size, --integrity-key-file, --sector-size, --progress-frequency, --progress-json].

๐ŸŽ€ OPEN

open <device> <name>
create <name> <device> (OBSOLETE syntax)

Open a mapping with <name> backed by device <device>.

โš ๏ธ if the integrity algorithm of the device is non-default, then the algorithm should be specified with the --integrity option. This will not be detected from the device. so tell it, bestie, it's not psychic.

<options> can be [--data-device, --batch-mode, --journal-watermark, --journal-commit-time, --buffer-sectors, --integrity, --integrity-key-size, --integrity-key-file, --integrity-no-journal, --integrity-recalculate, --integrity-recalculate-reset,--integrity-recovery-mode, --allow-discards, --allow-discards-keyed].

๐ŸŽ€ CLOSE

close <name>
remove <name> (OBSOLETE syntax)

Removes existing mapping <name>. bye bestie ๐Ÿซถ

<options> can be [--deferred] or [--cancel-deferred].

๐ŸŽ€ STATUS

status <name>

Reports status for the active integrity mapping <name>. the vibe check, basically. ๐ŸŒˆ

๐ŸŽ€ DUMP

dump <device>

Report parameters from the on-disk stored superblock. receipts from the disk itself. ๐Ÿ’…

๐ŸŽ€ RESIZE

resize <name>

Resizes an active mapping <name>.

if --size (in 512-byte sectors) or --device-size is not specified, the size is computed from the underlying device. After resize, the recalculating flag is set. If --wipe flag is set and the size of the device is increased, the newly added section will be wiped. ๐Ÿงš

Increasing the size of integrity volumes has been possible since the Linux kernel version 5.7; shrinking should work on older kernels, too. so growing is the new trick, shrinking is retro-compatible. ๐Ÿ’œ

<options> can be [--size, --device-size, --wipe].


๐Ÿ’… OPTIONS ๐Ÿ’…

this is the big one. every single one. no skipping.

  • --allow-discards โ€” Allow the use of discard (TRIM) requests for the device. This option is available since the Linux kernel version 5.7.
  • --allow-discards-keyed โ€” Enable secure keyed discard (TRIM) for the device. This option can only be specified if a keyed algorithm (like HMAC) is used. Once keyed discards are enabled, they are always used, even with the --allow-discard option.

This option is available since Linux kernel version 7.3.

  • --batch-mode, -q โ€” Do not ask for confirmation. no "are you sure" pop-ups, we're just going. ๐Ÿ™ˆ
  • --bitmap-flush-time ms โ€” Bitmap flush time in milliseconds.
โš ๏ธ WARNING: In case of a crash, it is possible that the data and integrity tag don't match if the journal is disabled. so like. heads up.
  • --bitmap-sectors-per-bit sectors โ€” The number of 512-byte sectors per bitmap bit must be a power of two.
  • --buffer-sectors sectors โ€” The number of sectors in one buffer.

The tag area is accessed using buffers; the large buffer size means the I/O size will be larger, but there could be less I/Os issued.

  • --cancel-deferred โ€” Removes a previously configured deferred device removal in the close command.
  • --data-device <data_device> โ€” Specify a separate data device that contains existing data. The <device> will then contain calculated integrity tags and a journal for data on <data_device>.

To not wipe the data device after initial format, also specify --no-wipe option and activate with --integrity-recalculate to recalculate integrity tags automatically.

  • --debug โ€” Run in debug mode with full diagnostic logs. Debug output lines are always prefixed by #.
  • --deferred โ€” Defers device removal in the close command until the last user closes it.
  • --help, -? โ€” Show help text and default parameters.
  • --integrity, -I algorithm โ€” Use internal integrity calculation (standalone mode). The integrity algorithm can be CRC (crc32c/crc32), a non-cryptographic hash function (xxhash64) or a hash function (sha1, sha256).

For HMAC (hmac-sha256), you must specify an integrity key and its size. ๐Ÿ”‘

  • --integrity-bitmap-mode, -B โ€” Use alternate bitmap mode (available since Linux kernel 5.2), where dm-integrity uses a bitmap instead of a journal. If a bit in the bitmap is 1, the corresponding region's data and integrity tags are not synchronized โ€” if the machine crashes, the unsynchronized regions will be recalculated. The bitmap mode is faster than the journal mode because we don't have to write the data twice. However, it is also less reliable because if data corruption happens when the machine crashes, it may not be detected. โšก fast but spicy.
  • --integrity-inline โ€” Store integrity tags in hardware sector integrity fields. The device must support sectors with additional protection information (PI, also known as DIF โ€” data integrity field) of the requested size. Another storage subsystem must not use the additional field (the device must present a "nop" profile in the kernel). Note that some devices must be reformatted at a low level to support this option; for NVMe devices, see nvme(1) id-ns LBA profiles.

No journal or bitmap is used in this mode. The device should operate with native speed (without any overhead). ๐ŸŽ๏ธ

This option is available since the Linux kernel version 6.11.

  • --integrity-key-file file โ€” The file with the integrity key.
  • --integrity-key-size bytes โ€” The size of the data integrity key. Maximum is 4096 bytes.
  • --integrity-no-journal, -D โ€” Disable the journal for the integrity device.
  • --integrity-recalculate โ€” Automatically recalculate integrity tags in the kernel on activation. The device can be used during automatic integrity recalculation, but becomes fully integrity protected only after the background operation is finished.

The primary intended use case is to skip initialization (wiping) of the data device after the initial format (see --no-wipe option). This parameter can be used for activation, then the kernel will recalculate integrity tags in the background. The integrity superblock contains a device offset that indicates the boundary to which the integrity tags are already updated. You can check this offset with the dump command. ๐Ÿ‘€

  • --integrity-recalculate-reset โ€” Restart recalculation from the beginning of the device. It can be used to change the integrity checksum function. Note, it does not change the tag length. This option is available since the Linux kernel version 5.13.
  • --integrity-recovery-mode, -R โ€” Recovery mode (no journal, no tag checking).
  • --interleave-sectors sectors โ€” The number of interleaved sectors.
  • --journal-commit-time ms โ€” Commit time in milliseconds. The journal is written when this time passes (and no explicit flush operation was issued).
  • --journal-crypt algorithm โ€” Encryption algorithm for the journal data area. You can use a block cipher here, such as cbc-aes or a stream cipher, for example, chacha20 or ctr-aes.
โš ๏ธ The journal encryption options are only intended for testing. Using journal encryption does not make sense without encryption of the data. so like, don't be weird about it.
  • --journal-crypt-key-file file โ€” The file with the journal encryption key.
  • --journal-crypt-key-size bytes โ€” The size of the journal encryption key. Maximum is 4096 bytes.
  • --journal-integrity algorithm โ€” Integrity algorithm for the journal area. See --integrity option for detailed specification.
  • --journal-integrity-key-file file โ€” The file with the integrity key.
  • --journal-integrity-key-size bytes โ€” The size of the journal integrity key. Maximum is 4096 bytes.
  • --journal-size, -j bytes โ€” Size of the journal.
  • --journal-watermark percent โ€” Journal watermark in percent. When the journal size exceeds this watermark, the journal flush will be started. ๐Ÿ’ง
  • --no-wipe โ€” Do not wipe the device after formatting. A device that is not initially wiped will contain invalid checksums. so like, you asked for it.
  • --progress-frequency seconds โ€” Print a separate line every <seconds> with wipe progress.
  • --progress-json โ€” Prints wipe progress data in JSON format, which is suitable mostly for machine processing. It prints a separate line every half second (or based on --progress-frequency value). The JSON output looks as follows during wipe progress (except it's a compact single line):
{
  "device":"/dev/sda",      // backing device or file
  "device_bytes":"8192",    // bytes wiped so far
  "device_size":"44040192", // total bytes to wipe
  "speed":"126877696",      // calculated speed in bytes per second (based on progress so far)
  "eta_ms":"2520012",       // estimated time to finish wipe in milliseconds
  "time_ms":"5561235"       // total time spent wiping device in milliseconds
}
๐Ÿ“ Note on numbers in JSON output: Due to JSON parsers' limitations, all numbers are represented in a string format due to the need for full 64-bit unsigned integers. yes, strings. it's giving "64-bit problems". ๐Ÿ˜ญ
  • --sector-size, -s bytes โ€” Sector size (power of two: 512, 1024, 2048, 4096).
  • --tag-size, -t bytes โ€” Size of the integrity tag per-sector (here, the integrity function will store the authentication tag).

The size can be smaller than the output size of the hash function; in that case, only part of the hash will be stored.

  • --usage โ€” Show short option help.
  • --verbose, -v โ€” Print more information on command execution.
  • --version, -V โ€” Show the program version.
  • --wipe โ€” Wipe the newly allocated area after resizing to a bigger size. If this flag is not set, checksums will be calculated for previously stored data in the newly allocated area. ๐Ÿงผ

๐Ÿšจ LEGACY COMPATIBILITY OPTIONS ๐Ÿšจ

ok bestie listen. Do not use these options until you need compatibility with a specific old kernel. Like, genuinely. They're here for the old-kernel girlies and nobody else. ๐Ÿ™ˆ

  • --integrity-legacy-padding โ€” uses the inefficient legacy padding. it's giving โœจinefficientโœจ for a reason, don't @ me.
  • --integrity-legacy-hmac โ€” uses the old flawed HMAC calculation. and spoiler alert: it also does not protect the superblock. ๐Ÿ’€
  • --integrity-legacy-recalculate โ€” allows insecure recalculating of volumes with HMAC keys. the tea here is that the recalculation offset in the superblock is not protected. be so careful bestie.

๐ŸŒˆ RETURN CODES ๐ŸŒˆ

integritysetup returns 0 on success and a non-zero value on error. periodt.

The error codes are, no cap:

  • 1 โ€” wrong parameters ๐Ÿ™ƒ
  • 2 โ€” no permission ๐Ÿ”’
  • 3 โ€” out of memory ๐Ÿ˜ญ
  • 4 โ€” wrong device specified ๐Ÿšซ
  • 5 โ€” device already exists or device is busy ๐Ÿ˜ค

๐Ÿ“ NOTES ๐Ÿ“

Formatting and activating an integrity device always require superuser privilege, because the superblock gets calculated and handled in the dm-integrity kernel target. so yeah, you're gonna need the big-girl permissions for this one. ๐Ÿ‘‘


โœจ EXAMPLES โœจ

Format the device with default standalone mode (CRC32C):

integritysetup format <device>

Open the device with default parameters:

integritysetup open <device> test

Format the device in standalone mode for use with HMAC(SHA256):

integritysetup format <device> --tag-size 32 --integrity hmac-sha256
--integrity-key-file <keyfile> --integrity-key-size <key_bytes>

Open (activate) the device with HMAC(SHA256) and HMAC key in file:

integritysetup open <device> test --integrity hmac-sha256
--integrity-key-file <keyfile> --integrity-key-size <key_bytes>

Dump dm-integrity superblock information:

integritysetup dump <device>

๐Ÿฆ‹ DM-INTEGRITY ON-DISK FORMAT ๐Ÿฆ‹

The on-disk format specification is available on the DMIntegrity <https://gitlab.com/cryptsetup/cryptsetup/wikis/DMIntegrity> page. go read it, it's the lore. ๐Ÿ“–


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

The integritysetup tool is written by Milan Broz <gmazyland@gmail.com>. absolute main character energy, we stan. ๐Ÿ’–


๐Ÿ› REPORTING BUGS ๐Ÿ›

Report bugs at the cryptsetup mailing list <cryptsetup@lists.linux.dev> or in the Issues project section <https://gitlab.com/cryptsetup/cryptsetup/-/issues/new>.

Please attach the output of the failed command with the --debug option added. fr fr, without the debug output we're just out here guessing and that's not the vibe. ๐Ÿ”

๐ŸŒธ SEE ALSO ๐ŸŒธ


๐Ÿ’œ CRYPTSETUP ๐Ÿ’œ

Part of the cryptsetup project <https://gitlab.com/cryptsetup/cryptsetup/>. it's a whole family, iykyk. ๐Ÿซถ


ok that's the whole page bestie, you're officially an integritysetup girlie now ๐Ÿ’… this was integritysetup 2.8.8, dated 2026-09-07, from the INTEGRITYSETUP(8) section โ€” go format something responsibly, mwah ๐Ÿ’–โœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from