== OPTIONS

ifdef::ACTION_LUKSFORMAT,ACTION_REENCRYPT[]
*--align-payload* _<number of 512 byte sectors>_ (DEPRECATED, use --offset)::
Align payload at a boundary of _value_ 512-byte sectors.
+
If not specified, cryptsetup tries to use the topology info provided by the kernel for the underlying device to get the optimal alignment.
If not available (or the calculated value is a multiple of the default), data is by default aligned to a 1MiB boundary (i.e., 2048 512-byte sectors).
+
For a detached LUKS header, this option specifies the offset on the data device.
See also the --header option.
+
This option is DEPRECATED and has an unexpected impact on the data offset and keyslot area size (for LUKS2) due to the complex rounding.
For fixed data device offset, use --offset option instead.
endif::[]

ifdef::ACTION_OPEN,ACTION_REFRESH[]
*--allow-discards*::
Allow the use of discard (TRIM) requests for the device.
This is also not supported for LUKS2 devices with data integrity protection.
+
*WARNING:* This command can have a negative security impact because it can make filesystem-level operations visible on the physical device.
For example, information leaking filesystem type, used space, etc., may be extractable from the physical device if the discarded blocks can be located later.
If in doubt, do not use it.
+
A kernel version of 3.1 or later is needed.
For earlier kernels, this option is ignored.
endif::[]

ifdef::COMMON_OPTIONS[]
*--batch-mode*, *-q*::
Suppresses all confirmation questions.
Use with care!
+
If the --verify-passphrase option is not specified, this option also switches off the passphrase verification.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--block-size* _value_ (LUKS1 only)::
Use re-encryption block size of _value_ in MiB.
+
Values can be between 1 and 64 MiB.
endif::[]

ifdef::ACTION_CLOSE[]
*--cancel-deferred*::
Removes a previously configured deferred device removal in the _close_ command.
endif::[]

ifdef::ACTION_OPEN,ACTION_LUKSFORMAT,ACTION_REENCRYPT,ACTION_TCRYPTDUMP,ACTION_BENCHMARK[]
*--cipher*, *-c* _<cipher-spec>_::
ifdef::ACTION_OPEN,ACTION_TCRYPTDUMP[]
Set the cipher specification string for the _plain_ device type.
+
For the _tcrypt_ device type, it restricts checked cipher chains when looking for the header.
endif::[]
ifndef::ACTION_REENCRYPT,ACTION_OPEN,ACTION_TCRYPTDUMP[]
Set the cipher specification string.
endif::[]
ifdef::ACTION_REENCRYPT[]
*LUKS2*:
Set the cipher specification string for the data segment only.
+
*LUKS1*:
Set the cipher specification string for the data segment and keyslots.
+
The default cipher is applied if the cipher specification is omitted in encrypt mode.
+
In reencrypt mode, if no new cipher specification is requested, the existing cipher will remain.
The only exception is if the cipher is "cipher_null", then the default cipher is used.
endif::[]
ifdef::ACTION_OPEN,ACTION_LUKSFORMAT,ACTION_REENCRYPT[]
+
_cryptsetup --help_ shows the compiled-in defaults.
+
If a hash is part of the cipher specification, then it is used as part of the IV generation.
For example, ESSIV needs a hash function, while "plain64" does not and hence none is specified.
+
For XTS mode, you can optionally set a key size of 512 bits with the -s option.
Key size for XTS mode is twice that for other modes for the same security level.
endif::[]
endif::[]

ifdef::COMMON_OPTIONS[]
*--debug* or *--debug-json*::
Run in debug mode with full diagnostic logs.
Debug output lines are always prefixed by *#*.
+
If --debug-json is used, additional LUKS2 JSON data structures are printed.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--decrypt*::
Initialize (and run) device decryption mode.
endif::[]

ifdef::ACTION_CLOSE[]
*--deferred*::
Defers device removal in the _close_ command until the last user closes it.
endif::[]

ifdef::ACTION_OPEN,ACTION_REENCRYPT,ACTION_RESIZE[]
*--device-size* _size[units]_::
ifndef::ACTION_RESIZE[]
Instead of the real device size, use the specified value.
endif::[]
ifdef::ACTION_RESIZE[]
Sets the new size of the device.
If unset, the real device size is used.
endif::[]
ifdef::ACTION_OPEN[]
Usable only with _plain_ device type.
endif::[]
ifdef::ACTION_REENCRYPT[]
It means that only the specified area (from the start of the device to the specified size) will be reencrypted.
+
*LUKS2*:
When used together with --reduce-device-size, only the initial _size_ value (--device-size parameter) of data is shifted backwards while being encrypted.
+
The sum of --device-size and --reduce-device-size values must not exceed the real device size.
+
*WARNING:* This is a destructive operation.
Data beyond --device-size limit may be lost after the operation is finished.
endif::[]
+
If no unit suffix is specified, the size is in bytes.
+
Unit suffix can be S for 512 byte sectors, K/M/G/T (or KiB, MiB, GiB, TiB) for units with 1024 base or KB/MB/GB/TB for 1000 base (SI scale).
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_REENCRYPT[]
*--disable-blkid*::
Disable use of the blkid library for checking and wiping on-disk signatures.
endif::[]

ifdef::ACTION_OPEN,ACTION_LUKSRESUME,ACTION_RESIZE,ACTION_TOKEN[]
*--disable-external-tokens*::
Disable loading of plugins for external LUKS2 tokens.
endif::[]

ifdef::ACTION_OPEN,ACTION_RESIZE,ACTION_REFRESH,ACTION_LUKSFORMAT,ACTION_LUKSRESUME,ACTION_TOKEN,ACTION_REENCRYPT[]
*--disable-keyring*::
Do not load the volume key in the kernel keyring; store it directly in the dm-crypt target instead.
This option is supported only for the LUKS2 type.
endif::[]

ifndef::ACTION_BENCHMARK,ACTION_BITLKDUMP,ACTION_TCRYPTDUMP[]
*--disable-locks*::
Disable lock protection for metadata on disk.
This option is valid only for LUKS2 and is ignored for other formats.
+
ifdef::ACTION_REENCRYPT[]
With locking disabled, LUKS2 images in files can be fully (re)encrypted offline without the need for superuser privileges provided that the used block ciphers are available in the crypto backend.
+
endif::[]
*WARNING:* Do not use this option unless you run cryptsetup in a restricted environment where locking is impossible to perform (where /run directory cannot be used).
endif::[]

ifdef::ACTION_OPEN,ACTION_TCRYPTDUMP[]
*--disable-veracrypt*::
This option can be used to disable VeraCrypt compatible mode (only TrueCrypt devices are recognized).
See the _TCRYPT_ section in *cryptsetup*(8) for more info.
endif::[]

ifdef::ACTION_LUKSDUMP[]
*--dump-json-metadata*::
For _luksDump_ (LUKS2 only), this option prints the content of the LUKS2 header JSON metadata area.
endif::[]

ifdef::ACTION_LUKSDUMP,ACTION_TCRYPTDUMP,ACTION_BITLKDUMP[]
*--dump-volume-key*::
--dump-master-key (OBSOLETE alias)::
Print the volume key in the displayed information.
Use with care, as the volume key can be used to bypass the passphrases, see also option --volume-key-file.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--encrypt*, *--new*, *-N*::
Initialize (and run) the device in-place encryption mode.
endif::[]

ifdef::ACTION_RESIZE,ACTION_OPEN,ACTION_LUKSADDKEY,ACTION_LUKSDUMP,ACTION_LUKSRESUME,ACTION_TOKEN[]
*--external-tokens-path* _<absolute path>_::
Override the system directory path where cryptsetup searches for external token handlers (or token plugins).
It must be an absolute path (starting with '/' character).
endif::[]

ifdef::ACTION_REENCRYPT[]
*--force-no-keyslots* (LUKS2 only)::
Enforce initialization of reencryption operation with additional --volume-key-file, --new-volume-key-file, --volume-key-keyring or --new-volume-key-keyring parameters.
It would result in the deletion of all remaining LUKS2 keyslots containing the volume key.
+
LUKS2 keyslot with the new volume key may be added after the reencryption operation is finished.
See *cryptsetup-luksAddKey*(8) command.
+
*WARNING:* Use with extreme caution!
If you lose the volume key stored in a file or in a kernel keyring before adding the LUKS2 keyslot containing the new volume key, the device will become unusable, and all data will be lost.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--force-offline-reencrypt* (LUKS2 only)::
Bypass active device auto-detection and enforce offline reencryption.
+
This option is useful especially for reencryption of LUKS2 images put in files (auto-detection is not reliable in this scenario).
+
It may also help in case active device auto-detection on a particular data device does not work or report errors.
+
*WARNING:* Use with extreme caution! This may destroy data if the device is activated and/or actively used.
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_REENCRYPT[]
*--force-password*::
Do not use password quality checking for new LUKS passwords.
+
This option is ignored if cryptsetup is built without password quality checking support.
+
For more info about password quality check, see the manual page for *pwquality.conf*(5) and *passwdqc.conf*(5).
endif::[]

ifdef::ACTION_OPEN,ACTION_LUKSFORMAT,ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_TCRYPTDUMP,ACTION_BENCHMARK,ACTION_REENCRYPT[]
*--hash*, *-h* _<hash-spec>_::
ifdef::ACTION_OPEN,ACTION_TCRYPTDUMP[]
Specifies the passphrase hash.
Applies to _plain_ and _loopaes_ device types only.
+
For the _tcrypt_ device type, it restricts the checked PBKDF2 variants when looking for the header.
endif::[]
ifdef::ACTION_LUKSFORMAT[]
Specifies the hash used in the LUKS key setup scheme and volume key digest.
endif::[]
ifndef::ACTION_REENCRYPT,ACTION_OPEN,ACTION_TCRYPTDUMP[]
The specified hash is used for PBKDF2 and the AF splitter.
endif::[]
ifdef::ACTION_REENCRYPT[]
*LUKS1:*
Specifies the hash used in the LUKS1 key setup scheme and volume key digest.
+
If this parameter is not specified, the default hash algorithm is always used for a new LUKS1 device header.
+
*LUKS2:* Ignored unless new keyslot pbkdf algorithm is set to PBKDF2 (see --pbkdf).
endif::[]
+
ifdef::ACTION_LUKSFORMAT[]
The hash algorithm must provide at least 160 bits of output.
Do not use a non-crypto hash like *xxhash* as this breaks security.
Use _cryptsetup --help_ to show the defaults.
endif::[]
endif::[]

ifndef::ACTION_BENCHMARK,ACTION_BITLKDUMP[]
*--header* _<device or file storing the LUKS header>_::
ifndef::ACTION_OPEN,ACTION_ERASE[]
Use a detached (separated) metadata device or file where the LUKS header is stored.
This option allows one to store the ciphertext and LUKS header on different devices.
+
endif::[]
ifdef::ACTION_OPEN[]
Specify a detached (separated) metadata device or file where the header is stored.
+
*WARNING:* There is no check whether the ciphertext device specified actually belongs to the header given.
In fact, you can specify an arbitrary device as the ciphertext device with the --header option.
Use with care.
endif::[]
ifndef::ACTION_REENCRYPT[]
ifdef::ACTION_LUKSFORMAT[]
With a file name as the argument to --header, the file will be automatically created if it does not exist.
See the cryptsetup FAQ for header size calculation.
+
The --align-payload option is taken as absolute sector alignment on the ciphertext device and can be zero.
endif::[]
ifndef::ACTION_LUKSFORMAT,ACTION_OPEN,ACTION_ERASE[]
For commands that change the LUKS header (e.g., _luksAddKey_), specify the device or file with the LUKS header directly as the LUKS device.
endif::[]
endif::[]
ifdef::ACTION_REENCRYPT[]
If used with --encrypt/--new option, the header file will be created (or overwritten).
Use with care.
+
*LUKS2*:
For decryption mode, the option may be used to export the original LUKS2 header to a detached file.
The passed future file must not exist at the time of initializing the decryption operation.
This frees space in the head of the data device so that data can be moved at the original LUKS2 header location.
Later on, the decryption operation continues as if the ordinary detached header was passed.
+
*WARNING:* Never put an exported header file in a filesystem on top of the device you are about to decrypt!
It would cause a deadlock.
endif::[]
ifdef::ACTION_ERASE[]
Use to specify a detached LUKS2 header when erasing OPAL self-encrypting drive.
endif::[]
endif::[]

ifdef::ACTION_LUKSHEADERBACKUP,ACTION_LUKSHEADERRESTORE[]
*--header-backup-file* _file_::
Specify a file with the header backup file.
endif::[]

ifdef::COMMON_OPTIONS[]
*--help*, *-?*::
Show help text and default parameters.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--hotzone-size* _size_ (LUKS2 only)::
This option can be used to set an upper limit on the size of the reencryption area (hotzone).
The _size_ can be specified with a unit suffix (for example, 50M).
Note that the actual hotzone size may be less than specified <size> due to other limitations (free space in keyslots area or available memory).
+
With decryption mode for devices with LUKS2 header placed in the head of the data device, the option specifies how large is the first data segment moved from the original data offset pointer.
endif::[]

ifdef::ACTION_LUKSFORMAT[]
*--hw-opal*::
Format LUKS2 device with dm-crypt encryption stacked on top of HW-based encryption configured on SED OPAL locking range.
This option enables both SW and HW based data encryption.
endif::[]

ifdef::ACTION_ERASE[]
*--hw-opal-factory-reset*::
Erase *ALL* data on the OPAL self-encrypting drive.
The option does not require a valid LUKS2 header to be present on the device to run.
After providing the correct PSID via interactive prompt or via --key-file parameter the device is erased.
+
PSID is usually printed on the OPAL drive label (either directly or as a QR code).
PSID must be entered without any dashes, spaces or underscores.
+
PSID should be treated as sensitive information as it allows anyone with remote access to the OPAL drive to destroy data even if the device is locked.
Be sure you do not leak PSID through transparent packaging during transport or images of the drive posted online.
endif::[]

ifdef::ACTION_LUKSFORMAT[]
*--hw-opal-only*::
Format LUKS2 device with HW based encryption configured on SED OPAL locking range only.
LUKS2 format only manages the locking range unlock key.
This option enables HW-based data encryption managed by the SED OPAL drive only.
+
Please note that with OPAL-only (--hw-opal-only) encryption, the configured OPAL administrator PIN (passphrase) allows unlocking all configured locking ranges without LUKS keyslot decryption (without knowledge of LUKS passphrase).
Because of many observed problems with compatibility, cryptsetup currently DOES NOT use OPAL single-user mode, which would allow such decoupling of OPAL admin PIN access.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--init-only* (LUKS2 only)::
Initialize reencryption (any mode) operation in LUKS2 metadata only and exit.
If any reencrypt operation is already initialized in metadata, the command with --init-only parameter fails.
endif::[]

ifdef::ACTION_LUKSFORMAT[]
*--integrity* _<integrity algorithm>_::
Specify the integrity algorithm to be used for authenticated disk encryption in LUKS2.
+
*WARNING: This extension is EXPERIMENTAL* and requires dm-integrity kernel target.
For native AEAD modes, also enable "User-space interface for AEAD cipher algorithms" in the "Cryptographic API" section (CONFIG_CRYPTO_USER_API_AEAD .config option).
+
For more info, see the _AUTHENTICATED DISK ENCRYPTION_ section in *cryptsetup*(8).
endif::[]

ifdef::ACTION_LUKSFORMAT[]
*--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.
endif::[]

ifdef::ACTION_LUKSFORMAT[]
*--integrity-key-size* _bytes_::
The size of the data integrity key.
Configurable only for HMAC integrity.
The default integrity key size is set to the same as the hash output length.
endif::[]

ifdef::ACTION_LUKSFORMAT[]
*--integrity-legacy-padding*::
Use inefficient legacy padding.
+
Do not use this option until you need compatibility with a specific old kernel.
endif::[]

ifdef::ACTION_REFRESH[]
*--integrity-no-journal*::
Activate device with integrity protection without using data journal (direct write of data and integrity tags).
Note that without a journal, a power failure can cause non-atomic writes and data corruption.
Use only if journaling is performed on a different storage layer.
endif::[]

ifdef::ACTION_LUKSFORMAT[]
*--integrity-no-wipe*::
Skip wiping of device authentication (integrity) tags.
If you skip this step, sectors will report an invalid integrity tag until an application writes to the sector.
+
Skipping this step could also cause write failures due to IO operation alignments.
For example, kernel page cache can request a read of a full page that fails due to an uninitialized integrity tag.
It is usually a bug in the application that tries to read data that was not written before.
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_REENCRYPT,ACTION_BENCHMARK[]
*--iter-time*, *-i* _<number of milliseconds>_::
ifndef::ACTION_REENCRYPT[]
The number of milliseconds to spend with PBKDF passphrase processing.
Specifying 0 as a parameter selects the compiled-in default.
endif::[]
ifdef::ACTION_REENCRYPT[]
The number of milliseconds to spend with PBKDF passphrase processing for the new LUKS header.
endif::[]
endif::[]

ifdef::ACTION_OPEN[]
*--iv-large-sectors*::
Count Initialization Vector (IV) in larger sector size (if set) instead of 512-byte sectors.
This option can be used only with the _plain_ device type.
+
This option does not have any performance or security impact; use it only for accessing incompatible existing disk images from other systems that require this option.
endif::[]

ifdef::ACTION_TOKEN[]
*--json-file*::
Read the token JSON from a file or write the token to it.
Option --json-file=- reads JSON from standard input or writes it to standard output, respectively.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--keep-key*::
*LUKS2*:
Do not change the effective volume key, and change other parameters if requested.
+
*LUKS1*:
Reencrypt only the LUKS1 header and keyslots.
Skips data in-place reencryption.
endif::[]

ifdef::ACTION_OPEN,ACTION_LUKSFORMAT,ACTION_LUKSDUMP,ACTION_RESIZE,ACTION_LUKSRESUME,ACTION_LUKSADDKEY,ACTION_TOKEN[]
*--key-description* _text_::
Set the key description in the keyring that will be used for passphrase retrieval.
endif::[]

ifdef::ACTION_OPEN,ACTION_RESIZE,ACTION_LUKSFORMAT,ACTION_LUKSRESUME,ACTION_LUKSADDKEY,ACTION_LUKSREMOVEKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_LUKSKILLSLOT,ACTION_LUKSDUMP,ACTION_TCRYPTDUMP,ACTION_REENCRYPT,ACTION_REPAIR,ACTION_BITLKDUMP[]
*--key-file*, *-d* _file_::
Read the passphrase from the file.
+
If the name given is "-", then the passphrase will be read from stdin.
In this case, reading will not stop at newline characters.
+
ifdef::ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY[]
The passphrase supplied via --key-file is always the passphrase for the existing keyslot requested by the command.
+
ifdef::ACTION_LUKSADDKEY[]
If you want to set a new passphrase via key file, you have to use a positional argument or parameter --new-keyfile.
endif::[]
ifdef::ACTION_LUKSCHANGEKEY[]
If you want to set a new passphrase via a key file, you have to use a positional argument.
endif::[]
+
endif::[]
ifdef::ACTION_OPEN[]
With _plain_ device type, the passphrase obtained via --key-file option is passed directly in dm-crypt.
Unlike the interactive mode (stdin), where the digest of the passphrase is passed in dm-crypt instead.
+
endif::[]
ifndef::ACTION_REENCRYPT[]
See section _NOTES ON PASSPHRASE PROCESSING_ in *cryptsetup*(8) for more information.
endif::[]
ifdef::ACTION_REENCRYPT[]
The --key-file option can be used only if there is only one active keyslot, or alternatively, also if --key-slot option is specified (then all other keyslots will be disabled in the new LUKS device).
+
If this option is not used, cryptsetup will ask for all active keyslot passphrases.
endif::[]
endif::[]
ifdef::ACTION_ERASE[]
*--key-file*, *-d* _file_ (LUKS2 with HW OPAL only)::
Read the Admin PIN or PSID (with --hw-opal-factory-reset) from the file, depending on options used.
+
If the name given is "-", then the secret will be read from stdin.
In this case, reading will not stop at newline characters.
+
endif::[]

ifdef::ACTION_OPEN,ACTION_RESIZE,ACTION_LUKSFORMAT,ACTION_LUKSRESUME,ACTION_LUKSADDKEY,ACTION_LUKSREMOVEKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_LUKSKILLSLOT,ACTION_LUKSDUMP,ACTION_REENCRYPT,ACTION_REPAIR,ACTION_BITLKDUMP[]
*--keyfile-offset* _value_::
Skip _value_ bytes at the beginning of the key file.
endif::[]

ifdef::ACTION_OPEN,ACTION_RESIZE,ACTION_LUKSFORMAT,ACTION_LUKSRESUME,ACTION_LUKSADDKEY,ACTION_LUKSREMOVEKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_LUKSKILLSLOT,ACTION_LUKSDUMP,ACTION_REENCRYPT,ACTION_REPAIR,ACTION_BITLKDUMP[]
*--keyfile-size*, *-l* _value_::
Read a maximum of _value_ bytes from the key file.
The default is to read the whole file up to the compiled-in maximum that can be queried with --help.
Supplying more data than the compiled-in maximum aborts the operation.
+
This option is useful to cut trailing newlines, for example.
If --keyfile-offset is also given, the size count starts after the offset.
endif::[]

ifdef::ACTION_OPEN,ACTION_LUKSFORMAT,ACTION_REENCRYPT,ACTION_BENCHMARK,ACTION_LUKSADDKEY[]
*--key-size*, *-s* _bits_::
ifndef::ACTION_LUKSADDKEY,ACTION_REENCRYPT[]
Sets key size in _bits_.
The argument has to be a multiple of 8.
The possible key sizes are limited by the cipher and mode used.
+
See /proc/crypto for more information.
Note that the key size in /proc/crypto is stated in bytes.
+
endif::[]
ifdef::ACTION_LUKSADDKEY[]
Provide volume key size in _bits_.
The argument has to be a multiple of 8.
+
This option is required when the parameter --volume-key-file is used to provide current volume key.
Also, it is used when a new unbound keyslot is created by specifying --unbound parameter.
endif::[]
ifdef::ACTION_OPEN[]
This option can be used for _plain_ and _luks_ devices.
For LUKS2 devices in reencryption, you may use the parameter twice to specify both old and new volume key sizes.
Each --key-size option corresponds to the respective --volume-key-file parameter (also allowed to be used up to two times).
endif::[]
ifndef::ACTION_REENCRYPT,ACTION_OPEN,ACTION_LUKSADDKEY[]
This option can be used for _open --type plain_ or _luksFormat_.
All other LUKS actions will use the key size specified in the LUKS header.
Use _cryptsetup --help_ to show the compiled-in defaults.
endif::[]
ifdef::ACTION_REENCRYPT[]
*LUKS2*:
Provide current key size in _bits_.
The argument has to be a multiple of 8.
Useful when specifying the size of the current volume key when no keyslot is active.
+
*LUKS1*:
See --new-key-size.
endif::[]
endif::[]

ifdef::ACTION_OPEN,ACTION_RESIZE,ACTION_LUKSFORMAT,ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_LUKSDUMP,ACTION_LUKSRESUME,ACTION_TOKEN,ACTION_CONFIG,ACTION_TOKEN,ACTION_REPAIR,ACTION_REENCRYPT[]
*--key-slot*, *-S* _<0-N>_::
ifdef::ACTION_LUKSADDKEY[]
When used together with the parameter --new-key-slot, this option allows you to specify which keyslot is selected for unlocking the volume key.
+
This option is ignored if the existing volume key gets unlocked via LUKS2 token (--token-id, --token-type or --token-only parameters) or when volume key is provided directly via --volume-key-file parameter.
+
To maintain backward compatibility, without --new-key-slot parameter, this option allows you to specify which keyslot is selected for the new key.
endif::[]
ifndef::ACTION_OPEN,ACTION_LUKSADDKEY[]
For LUKS operations that add key material, this option allows you to specify which keyslot is selected for the new key.
endif::[]
ifdef::ACTION_OPEN[]
This option selects a specific keyslot to compare the passphrase against.
If the given passphrase would only matches a different keyslot, the operation fails.
endif::[]
+
ifdef::ACTION_REENCRYPT[]
For reencryption mode, it selects a specific keyslot (and passphrase) that can be used to unlock the new volume key.
If used, all other keyslots get removed after the reencryption operation is finished.
+
endif::[]
The maximum number of keyslots depends on the LUKS version.
LUKS1 can have up to 8 keyslots.
LUKS2 can have up to 32 keyslots based on keyslot area size and key size, but a valid keyslot ID can always be between 0 and 31 for LUKS2.
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_REENCRYPT[]
*--keyslot-cipher* _<cipher-spec>_::
This option can be used to set specific cipher encryption for the LUKS2 keyslot area.
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_REENCRYPT[]
*--keyslot-key-size* _<bits>_::
This option can be used to set a specific key size for the LUKS2 keyslot area.
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_CONFIG,ACTION_REENCRYPT[]
*--label* _<label>_,  *--subsystem* _<subsystem>_::
Set label and subsystem description for LUKS2 device.
These are similar to filesystem labels.
The label and subsystem are optional fields and can be later used in udev scripts to trigger user actions once the device marked by these labels is detected.
endif::[]

ifdef::ACTION_OPEN,ACTION_LUKSRESUME[]
*--link-vk-to-keyring* _<keyring description>::<key description>_::
Link the volume key in a keyring with the specified key name.
The volume key is linked only if the requested action is successfully finished (with --test-passphrase, the verified volume key is linked in a keyring without taking further action).
+
The _<keyring description>_ string has to contain the existing kernel keyring description.
The keyring name may be optionally prefixed with "%:" or "%keyring:" type descriptions.
Or, the keyring may also be specified directly by numeric key id.
Also, special keyring notations starting with "@" may be used to select existing predefined kernel keyrings.
+
The string "::" is a delimiter used to separate the keyring description and key description.
+
_<key description>_ part describes key type and key name of volume key linked in the keyring described in _<keyring description>_.
The type may be specified by adding a "%<type_name>:" prefix in front of the key name.
If the type is missing, the default _user_ type is applied.
If the key of the same name and type already exists (already linked in the keyring), it will get replaced in the process.
+
See also the *KEY IDENTIFIERS* section of *keyctl*(1).
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_REENCRYPT[]
*--luks2-keyslots-size* _size_::
This option can be used to set a specific size of the LUKS2 binary keyslot area (key material is encrypted there).
The value must be aligned to a multiple of 4096 bytes with a maximum size 128MB.
The <size> can be specified with a unit suffix (for example, 128k).
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_REENCRYPT[]
*--luks2-metadata-size* _size_::
This option can be used to enlarge the LUKS2 metadata (JSON) area.
The size includes 4096 bytes for binary metadata (usable JSON area is smaller of the binary area).
According to the LUKS2 specification, only these values are valid: 16, 32, 64, 128, 256, 512, 1024, 2048 and 4096 kB.
The <size> can be specified with a unit suffix (for example, 128k).
endif::[]

ifdef::ACTION_LUKSADDKEY[]
*--new-keyfile* _name_::
Read the passphrase for a new keyslot from a file.
+
If the name given is "-", then the passphrase will be read from stdin.
In this case, reading will not stop at newline characters.
+
This is an alternative method to positional argument when adding a new passphrase via keyfile.
endif::[]

ifdef::ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY[]
*--new-keyfile-offset* _value_::
Skip _value_ bytes at the start when adding a new passphrase from the key file.
endif::[]

ifdef::ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY[]
*--new-keyfile-size* _value_::
Read a maximum of _value_ bytes when adding a new passphrase from the key file.
The default is to read the whole file up to the compiled-in maximum length that can be queried with --help.
Supplying more than the compiled-in maximum aborts the operation.
When --new-keyfile-offset is also given, reading starts after the offset.
endif::[]

ifdef::ACTION_LUKSADDKEY[]
*--new-key-description* _text_::
Set the key description in the keyring that will be used for new passphrase retrieval.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--new-key-size* _bits_::
Sets new key size in _bits_.
The argument has to be a multiple of 8.
The possible key sizes are limited by the new cipher and mode used in reencryption.
+
See /proc/crypto for more information.
Note that the key size in /proc/crypto is stated in bytes.
+
*LUKS1*:
If you are increasing key size, there must be enough space in the LUKS header for enlarged keyslots (data offset must be large enough), or reencryption cannot be performed.
+
If there is not enough space for keyslots with the new key size, you can destructively shrink the device with --reduce-device-size option.
endif::[]

ifdef::ACTION_LUKSADDKEY[]
*--new-key-slot* _<0-N>_::
This option allows you to specify which keyslot is selected for the new key.
+
The maximum number of keyslots depends on the LUKS version.
LUKS1 can have up to 8 keyslots.
LUKS2 can have up to 32 keyslots based on keyslot area size and key size, but a valid keyslot ID can always be between 0 and 31 for LUKS2.
endif::[]

ifdef::ACTION_LUKSADDKEY[]
*--new-token-id* _<id>_::
Specify what token to use to get the passphrase for a new keyslot.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--new-volume-key-file* _file_::
Use (set) the new volume key stored in a file.
The option must be paired with --new-key-size parameter when initializing the reencryption operation.
+
*WARNING:* If you create your own volume key, you need to make sure to do it right.
Otherwise, you can end up with a low-entropy or otherwise partially predictable volume key, which will compromise security.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--new-volume-key-keyring* _<key description>_::
Use (set) the new volume key stored in a keyring.
+
The size of the key stored in a keyring must be compatible with the new cipher used in the reencryption operation.
See /proc/crypto for more information.
Note that the key size in /proc/crypto is stated in bytes.
+
The _<key description>_ uses keyctl-compatible syntax.
This can either be a numeric key ID or a string name in the format _%<key type>:<key name>_.
See also the *KEY IDENTIFIERS* section of *keyctl*(1).
When no _%<key type>:_ prefix is specified, we assume the key type is _user_ (default type).
+
*WARNING:* If you create your own volume key, you need to make sure to do it right.
Otherwise, you can end up with a low-entropy or otherwise partially predictable volume key, which will compromise security.
endif::[]

ifdef::ACTION_OPEN,ACTION_LUKSFORMAT,ACTION_REENCRYPT[]
*--offset*, *-o* _<number of 512 byte sectors>_::
Start offset in the backend device in 512-byte sectors.
ifdef::ACTION_OPEN[]
This option is only relevant with plain or loopaes device types.
endif::[]
ifdef::ACTION_REENCRYPT[]
This option is only relevant for the encrypt mode.
endif::[]
+
ifndef::ACTION_OPEN[]
The --offset option sets the data offset (payload) of the data device and must be aligned to 4096-byte sectors (must be a multiple of 8).
This option cannot be combined with --align-payload option.
endif::[]
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_REENCRYPT,ACTION_BENCHMARK[]
*--pbkdf* _<PBKDF spec>_::
Set Password-Based Key Derivation Function (PBKDF) algorithm for LUKS keyslot.
The PBKDF can be: _pbkdf2_ (for PBKDF2 according to RFC2898), _argon2i_ for Argon2i or _argon2id_ for Argon2id (see https://www.cryptolux.org/index.php/Argon2[Argon2] for more info).
+
For LUKS1, only PBKDF2 is accepted (no need to use this option).
The default PBKDF for LUKS2 is set during compilation time and is available in the _cryptsetup --help_ output.
+
A PBKDF is used for increasing the dictionary and brute-force attack cost for keyslot passwords.
The parameters can be time, memory and parallel cost.
+
For PBKDF2, only the time cost (number of iterations) applies.
For Argon2i/id, there is also memory cost (memory required during the process of key derivation) and parallel cost (number of threads that run in parallel during the key derivation.
+
Note that increasing memory cost also increases time, so the final parameter values are measured by a benchmark.
The benchmark tries to find iteration time (--iter-time) with required memory cost --pbkdf-memory.
If it is not possible, the memory cost is decreased as well.
The parallel cost --pbkdf-parallel is constant and is checked against available CPU cores.
+
You can see all PBKDF parameters for a particular LUKS2 keyslot with the *cryptsetup-luksDump*(8) command.
+
If you do not want to use benchmark and want to specify all parameters directly, use --pbkdf-force-iterations with --pbkdf-memory and --pbkdf-parallel.
This will override the values without benchmarking.
Note it can cause extremely long unlocking time or cause out-of-memory conditions with unconditional process termination.
Use only in specific cases, for example, if you know that the formatted device will be used on some small embedded system.
+
*MINIMAL AND MAXIMAL PBKDF COSTS:* For *PBKDF2*, the minimum iteration count is 1000 and the maximum is 4294967295 (maximum for 32-bit unsigned integer).
Memory and parallel costs are not supported for PBKDF2.
For *Argon2i* and *Argon2id*, the minimum iteration count (CPU cost) is 4, and the maximum is 4294967295 (maximum for a 32-bit unsigned integer).
Minimum memory cost is 32 KiB and maximum is 4 GiB.
If the memory cost parameter is benchmarked (not specified by a parameter), it is always in the range from 64 MiB to 1 GiB.
Memory cost above 1GiB (up to the 4GiB maximum) can be setup only by the --pbkdf-memory parameter.
The parallel cost minimum is 1 and maximum 4 (if enough CPU cores are available, otherwise it is decreased by the available CPU cores).
+
*WARNING:* Increasing PBKDF computational costs above the mentioned limits provides negligible additional security improvement.
While elevated costs significantly increase brute-force overhead, they offer negligible protection against dictionary attacks.
The marginal cost increase for processing an entire dictionary remains fundamentally insufficient.
+
The hardcoded PBKDF limits represent engineered trade-offs between cryptographic security and operational usability.
LUKS maintains portability and must be used within a reasonable time on resource-constrained systems.
+
Cryptsetup deliberately restricts maximum memory cost (4 GiB) and parallel cost (4) parameters due to architectural limitations (like embedded and legacy systems).
+
PBKDF memory cost mandates actual physical RAM allocation with intensive write operations that must remain in physical RAM.
Any swap usage results in unacceptable performance degradation.
Memory management often overcommits allocations beyond available physical memory, expecting most allocated memory to remain unused.
In such situations, as PBKDF always uses all allocated memory, it frequently causes out-of-memory failures that abort cryptsetup operations.
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_REENCRYPT[]
*--pbkdf-force-iterations* _number_::
Avoid the PBKDF benchmark and set the time cost (iterations) directly.
It can be used only for a LUKS/LUKS2 device.
See --pbkdf option for more info.
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_REENCRYPT,ACTION_BENCHMARK[]
*--pbkdf-memory* _number_::
Set the memory cost for PBKDF (for Argon2i/id, the number represents kilobytes).
Note that it is the maximal value; PBKDF benchmark or available physical memory can decrease it.
This option is not available for PBKDF2.
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_REENCRYPT,ACTION_BENCHMARK[]
*--pbkdf-parallel* _number_::
Set the parallel cost for PBKDF (number of threads, up to 4).
Note that it is the maximal value; it is decreased automatically if the CPU online count is lower.
This option is not available for PBKDF2.
endif::[]

ifdef::ACTION_REFRESH,ACTION_OPEN[]
*--perf-high_priority*::
Set dm-crypt workqueues and the writer thread to high priority.
This improves throughput and latency of dm-crypt while degrading the general responsiveness of the system.
+
This option is available only for low-level dm-crypt performance tuning, use only if you need a change to the default dm-crypt behaviour.
Needs kernel 6.10 or later.
endif::[]

ifdef::ACTION_REFRESH,ACTION_OPEN[]
*--perf-no_read_workqueue*, *--perf-no_write_workqueue*::
Bypass dm-crypt internal workqueue and process read or write requests synchronously.
+
These options are available only for low-level dm-crypt performance tuning, use only if you need a change to the default dm-crypt behaviour.
Needs kernel 5.9 or later.
endif::[]

ifdef::ACTION_REFRESH,ACTION_OPEN[]
*--perf-same_cpu_crypt*::
Perform encryption using the same CPU on which that IO was submitted.
The default is to use an unbound workqueue so that encryption work is automatically balanced between available CPUs.
+
This option is available only for low-level dm-crypt performance tuning, use only if you need a change to the default dm-crypt behaviour.
endif::[]

ifdef::ACTION_REFRESH,ACTION_OPEN[]
*--perf-submit_from_crypt_cpus*::
Disable offloading writes to a separate thread after encryption.
There are some situations where offloading write bios from the encryption threads to a single thread degrades performance significantly.
The default is to offload write bios to the same thread.
+
This option is available only for low-level dm-crypt performance tuning, use only if you need a change to the default dm-crypt behaviour.
endif::[]

ifdef::ACTION_OPEN,ACTION_REFRESH[]
*--persistent*::
If used with LUKS2 devices and activation commands like _open_ or _refresh_, the specified activation flags are persistently written into metadata and used next time automatically, even for normal activation.
(No need to use cryptab or other system configuration files.)
+
If you need to remove a persistent flag, use --persistent without the flag you want to remove (e.g., to disable the persistently stored discard flag, use --persistent without --allow-discards).
+
Only --allow-discards, --perf-same_cpu_crypt, --perf-submit_from_crypt_cpus, --perf-no_read_workqueue, --perf-no_write_workqueue and --integrity-no-journal can be stored persistently.
endif::[]

ifdef::ACTION_CONFIG[]
*--priority* _<normal|prefer|ignore>_::
Set a priority for LUKS2 keyslot.
The _prefer_ priority marked slots are tried before the _normal_ priority.
The _ignored_ priority means that the slot is never used, if not explicitly requested by --key-slot option.
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_REENCRYPT[]
*--progress-frequency* _seconds_::
ifndef::ACTION_REENCRYPT[]
Print a separate line every _seconds_ with wipe progress.
endif::[]
ifdef::ACTION_REENCRYPT[]
Print a separate line every _seconds_ with reencryption progress.
endif::[]
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_REENCRYPT[]
*--progress-json*::
Prints 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 progress (except it's a compact single line):
+
....
{
  "device":"/dev/sda",      // backing device or file
  "device_bytes":"8192",    // bytes of I/O so far
  "device_size":"44040192", // total bytes of I/O to go
  "speed":"126877696",      // calculated speed in bytes per second (based on progress so far)
  "eta_ms":"2520012",       // estimated time to finish an operation in milliseconds
  "time_ms":"5561235"       // total time spent in IO operation in milliseconds
}
....
+
Note on numbers in JSON output: Due to JSON parser limitations, all numbers are represented in a string format due to the need for full 64-bit unsigned integers.
endif::[]

ifdef::ACTION_OPEN[]
*--readonly*, *-r*::
Set up a read-only mapping.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--reduce-device-size* _size_::
This means that the last _size_ sectors on the original device will be lost, and data will be effectively shifted by the specified number of sectors.
+
It could be useful if you added some space to the underlying partition or logical volume (so the ast _size_ sectors contains no data).
+
For units suffix, see --device-size parameter description.
+
*WARNING:* This is a destructive operation and cannot be reverted.
Use with extreme care - accidentally overwritten filesystems are usually unrecoverable.
+
*LUKS2*:
Initialize LUKS2 reencryption with data device size reduction (currently, only encryption mode is supported).
The last _size_ sectors on the original plaintext device is used for temporarily storing the original first data segment.
The former first data segment is replaced with LUKS2 header (half the _size_ value), and plaintext data is shifted backwards (again half the _size_ value) while being encrypted.
+
The recommended minimum size is twice the default LUKS2 header size (--reduce-device-size 32M) for encryption mode.
+
The sum of --device-size and --reduce-device-size values must not exceed the real device size.
+
*LUKS1*:
Enlarge the data offset to the specified value by shrinking the device size.
+
You cannot shrink the device by more than 64 MiB (131072 sectors).
endif::[]

ifdef::ACTION_OPEN[]
*--refresh*::
Refreshes an active device with a new set of parameters.
See *cryptsetup-refresh*(8) for more details.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--resilience* _mode_ (LUKS2 only)::
Reencryption resilience _mode_ can be one of _checksum_, _journal_ or _none_.
+
_checksum_: default mode, where individual checksums of ciphertext hotzone sectors are stored, so the recovery process can detect which sectors were already reencrypted.
It requires that the device sector write is atomic.
+
_journal_: The hotzone is journaled in the binary area (so the data are written twice).
+
_none_: Performance mode.
There is no protection, and the only way it's safe to interrupt the reencryption is similar to an old offline reencryption utility.
+
Resilience modes can be changed unless _datashift_ mode is used for operation initialization (encryption with --reduce-device-size option).
endif::[]

ifdef::ACTION_REENCRYPT[]
*--resilience-hash* _hash_ (LUKS2 only)::
The _hash_ algorithm is used with "--resilience checksum" only.
The default hash is sha256.
With other resilience modes, the hash parameter is ignored.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--resume-only* (LUKS2 only)::
Resume reencryption (any mode) operation that is already described in LUKS2 metadata.
If no reencrypt operation is initialized, the command with --resume-only parameter fails.
Useful for resuming the reencrypt operation without accidentally triggering a new reencryption operation.
endif::[]

ifdef::ACTION_OPEN,ACTION_LUKSFORMAT,ACTION_REENCRYPT[]
ifndef::ACTION_REENCRYPT[]
*--sector-size* _bytes_::
endif::[]
ifndef::ACTION_REENCRYPT[]
ifdef::ACTION_OPEN[]
Set encryption sector size for use with _plain_ device type.
It must be a power of two and in the 512 - 4096 bytes range.
The default encryption sector size is 512 bytes.
endif::[]
ifdef::ACTION_LUKSFORMAT[]
Set encryption sector size for use with _LUKS2_ device type.
It must be a power of two and in the 512 - 4096 bytes range.
+
The encryption sector size is set based on the underlying data device if not specified explicitly.
For native 4096-byte physical sector devices, it is set to 4096 bytes.
For 4096/512e (4096-byte physical sector size with 512-byte sector emulation), it is set to 4096 bytes.
For drives reporting only a 512-byte physical sector size, it is set to 512 bytes.
If the data device is a regular file (container), it is set to 4096 bytes.
+
If used together with the --integrity option and dm-integrity journal, the atomicity of writes is guaranteed in all cases (but it costs write performance - data has to be written twice).
endif::[]
+
Increasing sector size from 512 to 4096 bytes can provide better performance on most modern storage devices and with some hardware encryption accelerators.
endif::[]
ifdef::ACTION_REENCRYPT[]
*--sector-size* _bytes_ (LUKS2 only)::
Reencrypt the device with a new encryption sector size enforced.
+
*WARNING:* Increasing the encryption sector size may break the hosted filesystem.
Do not run reencryption with --force-offline-reencrypt if unsure what block size the filesystem was formatted with.
endif::[]
+
Note that using a sector size larger than the underlying storage device's physical sector size may result in data corruption during unexpected power failures.
A power failure during write operations may result in only partial completion of the encryption sector write, leaving encrypted data in an inconsistent state that cannot be properly decrypted.
endif::[]

ifdef::ACTION_OPEN[]
*--serialize-memory-hard-pbkdf*::
Use a global lock to serialize unlocking of keyslots using memory-hard PBKDF.
+
This is a workaround for a specific situation when multiple devices are activated in parallel, and the system, instead of reporting out of memory, starts unconditionally stop processes using the out-of-memory killer.
+
*DO NOT USE* this switch until you are implementing the boot environment with parallel devices activation!
endif::[]

ifdef::ACTION_OPEN[]
*--shared*::
Creates an additional mapping for one common ciphertext device.
Arbitrary mappings are supported.
This option is only relevant for the _plain_ device type.
Use --offset, --size and --skip to specify the mapped area.
endif::[]

ifdef::ACTION_OPEN,ACTION_RESIZE[]
*--size*, *-b* _<number of 512 byte sectors>_::
Set the size of the device in sectors of 512 bytes.
ifdef::ACTION_OPEN[]
Usable only with _plain_ device type.
endif::[]
endif::[]

ifdef::ACTION_OPEN[]
*--skip*, *-p* _<number of 512 byte sectors>_::
Start offset used in IV calculation in 512-byte sectors (how many sectors of the encrypted data to skip at the beginning).
This option is only relevant with plain or loopaes device types.
+
Hence, if --offset _n_, and --skip _s_, sector _n_ (the first sector of the encrypted device) will get a sector number of _s_ for the IV calculation.
endif::[]

ifdef::ACTION_OPEN,ACTION_TCRYPTDUMP[]
*--tcrypt-backup*::
*--tcrypt-hidden*::
*--tcrypt-system*::
Specify which TrueCrypt on-disk header will be used to open the device.
See the _TCRYPT_ section in *cryptsetup*(8) for more info.
+
Using a system-encrypted device with the --tcrypt-system option requires specific settings to work as expected.
+
TrueCrypt/VeraCrypt supports full system encryption (only a partition table is not encrypted) or system partition encryption (only a system partition is encrypted).
The metadata header then contains the offset and size of the encrypted area.
Cryptsetup needs to know the specific partition offset to calculate encryption parameters.
To properly map a partition, you must specify a real partition device so cryptsetup can calculate this offset.
+
While you can use a full device as a parameter (/dev/sdb), always prefer to specify the partition you want to map (/dev/sdb1), as only the system partition mode can be detected this way.
+
For mapping images (stored in a file), you can use the additional --header option with the real partition device.
If the --header is used (and it is different from the data image), cryptsetup expects that the data image contains a snapshot of the data partition only.
+
If --header is not used (or points to the same image), cryptsetup expects that the image contains a full disk (including the partition table).
This can map a full encrypted area that is not directly mountable as a filesystem.
Please prefer creating a loop device with partitions (*losetup -P*, see *losetup*(8) man page) and use a real partition (/dev/loopXp1) as the device parameter.
endif::[]

ifdef::ACTION_OPEN[]
*--test-passphrase*::
Do not activate the device, just verify the passphrase.
The device mapping name is not mandatory if this option is used.
endif::[]

ifdef::ACTION_OPEN,ACTION_LUKSFORMAT,ACTION_LUKSADDKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_LUKSREMOVEKEY,ACTION_LUKSKILLSLOT,ACTION_LUKSDUMP,ACTION_REENCRYPT,ACTION_REPAIR,ACTION_LUKSRESUME,ACTION_RESIZE,ACTION_TCRYPTDUMP,ACTION_BITLKDUMP[]
*--timeout*, *-t* _seconds_::
The number of seconds to wait before a timeout on passphrase input via terminal.
It is relevant every time a passphrase is asked.
It has no effect if used in conjunction with --key-file.
+
This option is useful when the system should not stall if the user does not input a passphrase, e.g., during boot.
The default is a value of 0 seconds, which means to wait forever.
endif::[]

ifdef::ACTION_OPEN,ACTION_RESIZE,ACTION_LUKSRESUME,ACTION_TOKEN,ACTION_LUKSADDKEY,ACTION_REENCRYPT[]
*--token-id*::
ifdef::ACTION_REENCRYPT[]
*LUKS2 reencryption initialization:*
Specify what keyslots (associated with the selected token) to use for LUKS2 reencryption.
If the reencryption operation changes the effective volume key, only keyslots associated with the token and unlocked successfully will be available after the reencryption operation is finished.
+
*LUKS2 reencryption resume:*
// paragraph continues below
endif::[]
ifndef::ACTION_TOKEN,ACTION_LUKSADDKEY[]
Specify what token to use and allow the token PIN prompt to take precedence over the interactive keyslot passphrase prompt.
If omitted, all available tokens (not protected by PIN) will be checked before proceeding further with the passphrase prompt.
endif::[]
ifdef::ACTION_LUKSADDKEY[]
Specify what token to use when unlocking the existing keyslot to get the volume key.
endif::[]
ifdef::ACTION_TOKEN[]
Specify the token number.
If omitted, the first unused token id is used when adding or importing a new token.
endif::[]
endif::[]

ifdef::ACTION_OPEN,ACTION_RESIZE,ACTION_LUKSRESUME,ACTION_LUKSADDKEY,ACTION_REENCRYPT[]
*--token-only*::
ifdef::ACTION_REENCRYPT[]
*LUKS2 reencryption initialization:*
Specify that all keyslots associated with any token will be used for LUKS2 reencryption.
If the reencryption operation changes the effective volume key, only keyslots associated with any token will be available after the reencryption operation is finished.
+
*LUKS2 reencryption resume:*
// paragraph continues below
endif::[]
ifndef::ACTION_LUKSADDKEY[]
Do not proceed further with the action if the token-based keyslot unlock failed.
Without the option, the action asks for a passphrase to proceed further.
+
It allows LUKS2 tokens protected by PIN to take precedence over the interactive keyslot passphrase prompt.
endif::[]
ifdef::ACTION_LUKSADDKEY[]
Use only LUKS2 tokens to unlock the existing volume key.
+
To create a new keyslot using the passphrase provided by a token, use --new-token-id parameter.
endif::[]
endif::[]

ifdef::ACTION_TOKEN[]
*--token-replace*::
Replace an existing token when adding or importing a token with the --token-id option.
endif::[]

ifdef::ACTION_OPEN,ACTION_RESIZE,ACTION_LUKSRESUME,ACTION_LUKSADDKEY,ACTION_REENCRYPT[]
*--token-type* _type_::
ifdef::ACTION_REENCRYPT[]
*LUKS2 reencryption initialization:*
Specify what keyslots (associated with the selected token type) to use for LUKS2 reencryption.
If the reencryption operation changes the effective volume key, only keyslots associated with the token type and unlocked successfully will be available after the reencryption operation is finished.
+
*LUKS2 reencryption resume:*
// paragraph continues below
endif::[]
ifndef::ACTION_LUKSADDKEY[]
Restrict tokens eligible for operation to a specific token _type_.
Mostly useful when no --token-id is specified.
+
It allows LUKS2 _type_ tokens protected by PIN to take precedence over the interactive keyslot passphrase prompt.
endif::[]
ifdef::ACTION_LUKSADDKEY[]
Specify what token type (all _type_ tokens) to use when unlocking the existing keyslot to get the volume key.
endif::[]
endif::[]

ifdef::ACTION_OPEN,ACTION_LUKSRESUME,ACTION_REENCRYPT[]
*--tries*, *-T*::
How often the input of the passphrase shall be retried.
The default is 3 tries.
endif::[]

ifdef::ACTION_OPEN,ACTION_LUKSFORMAT,ACTION_LUKSRESUME,ACTION_LUKSADDKEY,ACTION_LUKSREMOVEKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSKILLSLOT,ACTION_ISLUKS,ACTION_LUKSDUMP,ACTION_LUKSUUID,ACTION_CONVERT,ACTION_REPAIR,ACTION_REENCRYPT[]
*--type* _type_::
ifndef::ACTION_REENCRYPT[]
Specifies required device type, for more info, read the _BASIC ACTIONS_ section in *cryptsetup*(8).
endif::[]
ifdef::ACTION_REENCRYPT[]
Specifies required (encryption mode) or expected (other modes) LUKS format.
Accepts only _luks1_ or _luks2_.
endif::[]
endif::[]

ifdef::ACTION_OPEN,ACTION_LUKSADDKEY,ACTION_LUKSDUMP,ACTION_TOKEN[]
*--unbound*::
ifdef::ACTION_LUKSADDKEY[]
Creates a new LUKS2 unbound keyslot.
endif::[]
ifdef::ACTION_LUKSDUMP[]
Dumps the existing LUKS2 unbound keyslot.
endif::[]
ifdef::ACTION_OPEN[]
Allowed only together with --test-passphrase parameter, it allows one to test the passphrase for an unbound LUKS2 keyslot.
Otherwise, an unbound keyslot passphrase can be tested only when a specific keyslot is selected via --key-slot parameter.
endif::[]
ifdef::ACTION_TOKEN[]
Creates a new LUKS2 keyring token assigned to no keyslot.
Usable only with the _add_ action.
endif::[]
endif::[]

ifdef::COMMON_OPTIONS[]
*--usage*::
Show short option help.
endif::[]

ifdef::ACTION_REENCRYPT[]
*--use-directio* (LUKS1 only)::
Use direct-io (O_DIRECT) for all read/write data operations related to the block device undergoing reencryption.
+
Useful if direct-io operations perform better than normal buffered operations (e.g., in virtual environments).
endif::[]

ifdef::ACTION_REENCRYPT[]
*--use-fsync* (LUKS1 only)::
Use the fsync call after every written block.
This applies to reencryption log files as well.
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_REENCRYPT[]
*--use-random*::
*--use-urandom*::
ifdef::ACTION_REENCRYPT[]
Define which kernel random number generator will be used to create the volume key.
endif::[]
ifndef::ACTION_REENCRYPT[]
For _luksFormat_, these options define which kernel random number generator will be used to create the volume key (which is a long-term key).
+
Do not use these options with recent kernels (later than version 5.6).
For more details, see *NOTES ON RANDOM NUMBER GENERATORS* in *cryptsetup*(8) and *urandom*(4).
endif::[]
endif::[]

ifdef::ACTION_LUKSFORMAT,ACTION_LUKSUUID,ACTION_REENCRYPT[]
*--uuid* _UUID_::
ifndef::ACTION_REENCRYPT[]
Use the provided _UUID_ for the _luksFormat_ command instead of generating a new one.
Changes the existing _UUID_ when used with the _luksUUID_ command.
+
endif::[]
ifdef::ACTION_REENCRYPT[]
When used in encryption mode, use the provided _UUID_ for the new LUKS header instead of generating a new one.
+
*LUKS1 (only in decryption mode)*:
To find out what _UUID_ to pass, look for temporary files LUKS-_UUID_.[|log|org|new] of the interrupted decryption process.
+
endif::[]
The _UUID_ must be provided in the standard UUID format, e.g., 12345678-1234-1234-1234-123456789abc.
endif::[]

ifdef::ACTION_TCRYPTDUMP,ACTION_OPEN[]
*--veracrypt*::
This option is ignored as VeraCrypt compatible mode is supported by default.
endif::[]

ifdef::ACTION_OPEN,ACTION_TCRYPTDUMP[]
*--veracrypt-pim*::
*--veracrypt-query-pim*::
Use a custom Personal Iteration Multiplier (PIM) for the VeraCrypt device.
See the _TCRYPT_ section in *cryptsetup*(8) for more info.
endif::[]

ifdef::ACTION_ISLUKS[]
*--verbose*, *-v*::
Print more information on command execution.
endif::[]

ifdef::ACTION_OPEN,ACTION_RESIZE,ACTION_LUKSFORMAT,ACTION_LUKSRESUME,ACTION_LUKSADDKEY,ACTION_LUKSREMOVEKEY,ACTION_LUKSCHANGEKEY,ACTION_LUKSCONVERTKEY,ACTION_LUKSKILLSLOT,ACTION_REPAIR,ACTION_TCRYPTDUMP,ACTION_REENCRYPT[]
*--verify-passphrase*, *-y*::
When interactively asking for a passphrase, ask for it twice and complain if both inputs do not match.
ifdef::ACTION_OPEN[]
Advised when creating a _plain_ type mapping for the first time.
endif::[]
Ignored on input from file or stdin.
endif::[]

ifdef::COMMON_OPTIONS[]
*--version*, *-V*::
Show the program version.
endif::[]

ifdef::ACTION_OPEN,ACTION_LUKSFORMAT,ACTION_LUKSADDKEY,ACTION_LUKSDUMP,ACTION_BITLKDUMP,ACTION_REENCRYPT[]
*--volume-key-file* _file_::
--master-key-file file (OBSOLETE alias)::
ifndef::ACTION_REENCRYPT[]
Use a volume key stored in a file.
+
endif::[]
ifdef::ACTION_FORMAT[]
This allows creating a LUKS header with this specific volume key.
If the volume key was taken from an existing LUKS header and all other parameters are the same, then the new header decrypts the data encrypted with the header from which the volume key was taken.
+
endif::[]
ifdef::ACTION_LUKSDUMP,ACTION_BITLKDUMP[]
The volume key is stored in a file instead of being printed out to standard output.
+
endif::[]
ifdef::ACTION_LUKSADDKEY[]
This allows adding a new keyslot without having to know the passphrase to the existing one.
It may also be used when no keyslot is active.
+
endif::[]
ifdef::ACTION_OPEN[]
This allows one to open _luks_ and _bitlk_ device types without giving a passphrase.
+
For devices in reencryption, the option may be used twice to specify both old and new volume keys.
When using the option twice, make sure you pair each --volume-key-file option with the respective --key-size parameter as well.
endif::[]
ifdef::ACTION_REENCRYPT[]
*LUKS2*:
Provides the current volume key stored in a file.
It can be used to reencrypt the device with no active keyslot together with --new-volume-key-file or --new-volume-key-keyring options.
+
*LUKS1*:
See --new-volume-key-file.
+
endif::[]
ifdef::ACTION_LUKSFORMAT,ACTION_LUKSADDKEY[]
*WARNING:* If you create your own volume key, you need to make sure to do it right.
Otherwise, you can end up with a low-entropy or otherwise partially predictable volume key, which will compromise security.
endif::[]
endif::[]

ifdef::ACTION_OPEN,ACTION_RESIZE,ACTION_LUKSRESUME,ACTION_LUKSADDKEY[]
*--volume-key-keyring* _<key description>_::
Use a volume key stored in a keyring.
This allows one to open _luks_ and _plain_ device types without giving a passphrase.
+
For LUKS, the key and associated type have to be readable from userspace so that the volume key digest may be verified before activation.
For devices in reencryption, the option may be used twice to specify both old and new volume keys.
+
For PLAIN type, the user must ensure that the key in the keyring is unchanged since activation.
Otherwise, reloading the key can cause data corruption after an unexpected key change.
+
The _<key description>_ uses keyctl-compatible syntax.
This can either be a numeric key ID or a string name in the format _%<key type>:<key name>_.
See also the *KEY IDENTIFIERS* section of *keyctl*(1).
When no _%<key type>:_ prefix is specified, we assume the key type is _user_ (default type).
endif::[]

ifdef::ACTION_REENCRYPT[]
*--write-log* (LUKS1 only)::
Update the log file after every block is written.
This can slow down reencryption, but it will minimize data loss in the case of a system crash.
endif::[]
