'\" t
.\"     Title: cryptsetup-reencrypt
.\"    Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.12
.\"      Date: 2025-06-04
.\"    Manual: Maintenance Commands
.\"    Source: cryptsetup 2.7.2
.\"  Language: English
.\"
.TH "CRYPTSETUP\-REENCRYPT" "8" "2025-06-04" "cryptsetup 2.7.2" "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"
cryptsetup\-reencrypt \- reencrypt LUKS encrypted volumes in\-place
.SH "SYNOPSIS"
.sp
\fBcryptsetup \fIreencrypt\fP [<options>] <device> or \-\-active\-name <name> [<new_name>]\fP
.SH "DESCRIPTION"
.sp
Run LUKS device reencryption.
.sp
There are 3 basic modes of operation:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
device reencryption (\fIreencrypt\fP)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
device encryption (\fIreencrypt\fP \-\-encrypt/\-\-new/\-N)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
device decryption (\fIreencrypt\fP \-\-decrypt)
.RE
.sp
<device> or \-\-active\-name <name> (LUKS2 only) is mandatory parameter.
.sp
Cryptsetup \fIreencrypt\fP action can be used to change reencryption parameters
which otherwise require full on\-disk data change (re\-encryption). The
\fIreencrypt\fP action reencrypts data on LUKS device in\-place.
.sp
You can regenerate \fBvolume key\fP (the real key used in on\-disk encryption
unlocked by passphrase), \fBcipher\fP, \fBcipher mode\fP or \fBencryption sector size\fP
(LUKS2 only).
.sp
Reencryption process may be safely interrupted by a user via SIGINT
signal (ctrl+c). Same applies to SIGTERM signal (i.e. issued by systemd
during system shutdown).
.sp
For in\-place encryption mode, the \fIreencrypt\fP action additionally takes all
options available for \fIluksFormat\fP action for respective LUKS version (see
cryptsetup\-luksFormat man page for more details). See \fBcryptsetup\-luksFormat\fP(8).
.sp
\fBNOTE\fP that for encrypt and decrypt mode, the whole device must be
treated as unencrypted \(em there are no guarantees of confidentiality as
part of the device contains plaintext.
.sp
\fBALWAYS BE SURE YOU HAVE RELIABLE BACKUP BEFORE USING THIS ACTION ON LUKS DEVICE.\fP
.sp
\fB<options>\fP can be [\-\-batch\-mode,
\-\-block\-size,
\-\-cipher,
\-\-debug,
\-\-debug\-json,
\-\-decrypt,
\-\-device\-size,
\-\-disable\-locks,
\-\-encrypt,
\-\-force\-offline\-reencrypt,
\-\-hash,
\-\-header,
\-\-hotzone\-size,
\-\-iter\-time,
\-\-init\-only,
\-\-keep\-key,
\-\-key\-file,
\-\-key\-size,
\-\-key\-slot,
\-\-keyfile\-offset,
\-\-keyfile\-size,
\-\-tries,
\-\-timeout,
\-\-pbkdf,
\-\-pbkdf\-force\-iterations,
\-\-pbkdf\-memory,
\-\-pbkdf\-parallel,
\-\-progress\-frequency,
\-\-progress\-json,
\-\-reduce\-device\-size,
\-\-resilience,
\-\-resilience\-hash,
\-\-resume\-only,
\-\-sector\-size,
\-\-use\-directio,
\-\-use\-random,
\-\-use\-urandom,
\-\-use\-fsync,
\-\-uuid,
\-\-verbose,
\-\-volume\-key\-file,
\-\-write\-log].
.SH "LUKS2 REENCRYPTION"
.sp
With <device> parameter cryptsetup looks up active <device> dm mapping.
If no active mapping is detected, it starts offline LUKS2 reencryption
otherwise online reencryption takes place.
.sp
To resume already initialized or interrupted reencryption, just run the
cryptsetup \fIreencrypt\fP command again to continue the reencryption
operation. Reencryption may be resumed with different \-\-resilience or
\-\-hotzone\-size unless implicit datashift resilience mode is used: either
encrypt mode with \-\-reduce\-device\-size option or decrypt mode with
original LUKS2 header exported in \-\-header file.
.sp
If the reencryption process was interrupted abruptly (reencryption
process crash, system crash, poweroff) it may require recovery. The
recovery is currently run automatically on next activation (action
\fIopen\fP) when needed or explicitly by user (action \fIrepair\fP).
.sp
Optional parameter <new_name> takes effect only with encrypt option
and it activates device <new_name> immediately after encryption
initialization gets finished. That\(cqs useful when device needs to be
ready as soon as possible and mounted (used) before full data area
encryption is completed.
.SH "LUKS1 REENCRYPTION"
.sp
Current working directory must be writable and temporary files created during
reencryption must be present. During reencryption process the LUKS1 device is
marked unavailable and must be offline (no dm\-crypt mapping or mounted
filesystem).
.sp
\fBWARNING\fP: The LUKS1 reencryption code is not resistant to hardware
or kernel failures during reencryption (you can lose your data in this case).
.SH "OPTIONS"
.sp
\fB\-\-align\-payload <number of 512 byte sectors>\fP
.RS 4
Align payload at a boundary of \fIvalue\fP 512\-byte sectors.
.sp
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).
.sp
For a detached LUKS header, this option specifies the offset on the data
device. See also the \-\-header option.
.sp
\fBWARNING:\fP This option is DEPRECATED and has often unexpected impact to
the data offset and keyslot area size (for LUKS2) due to the complex
rounding. For fixed data device offset use \fI\-\-offset\fP option instead.
.RE
.sp
\fB\-\-batch\-mode, \-q\fP
.RS 4
Suppresses all confirmation questions. Use with care!
.sp
If the \-\-verify\-passphrase option is not specified, this option also
switches off the passphrase verification.
.RE
.sp
\fB\-\-block\-size\fP \fIvalue\fP \fB(LUKS1 only)\fP
.RS 4
Use re\-encryption block size of \fIvalue\fP in MiB.
.sp
Values can be between 1 and 64 MiB.
.RE
.sp
\fB\-\-cipher, \-c\fP \fI<cipher\-spec>\fP
.RS 4
\fBLUKS2\fP:
Set the cipher specification string for data segment only.
.sp
\fBLUKS1\fP:
Set the cipher specification string for data segment and keyslots.
.sp
\fBNOTE\fP: In encrypt mode, if cipher specification is omitted the default cipher is applied.
In reencrypt mode, if no new cipher specification is requested, the existing cipher will remain
in use. Unless the existing cipher was "cipher_null". In that case default cipher would
be applied as in encrypt mode.
.sp
\fIcryptsetup \-\-help\fP shows the compiled\-in defaults.
.sp
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.
.sp
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.
.RE
.sp
\fB\-\-debug or \-\-debug\-json\fP
.RS 4
Run in debug mode with full diagnostic logs. Debug output lines are
always prefixed by \fB#\fP.
.sp
If \-\-debug\-json is used, additional LUKS2 JSON data structures are printed.
.RE
.sp
\fB\-\-decrypt\fP
.RS 4
Initialize (and run) device decryption mode.
.RE
.sp
\fB\-\-device\-size\fP \fIsize[units]\fP
.RS 4
Instead of real device size, use specified value.
It means that only specified area (from the start of the device
to the specified size) will be reencrypted.
.sp
\fBWARNING:\fP This is destructive operation. Data beyond \-\-device\-size limit may
be lost after operation gets finished.
.sp
If no unit suffix is specified, the size is in bytes.
.sp
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).
.RE
.sp
\fB\-\-disable\-blkid\fP
.RS 4
Disable use of blkid library for checking and wiping on\-disk signatures.
.RE
.sp
\fB\-\-disable\-keyring\fP
.RS 4
Do not load volume key in kernel keyring and store it directly in the
dm\-crypt target instead. This option is supported only for the LUKS2 type.
.RE
.sp
\fB\-\-disable\-locks\fP
.RS 4
Disable lock protection for metadata on disk. This option is valid
only for LUKS2 and ignored for other formats.
.sp
\fBNOTE:\fP With locking disabled LUKS2 images in files can be fully (re)encrypted
offline without need for super user privileges provided used block ciphers are
available in crypto backend.
.sp
\fBWARNING:\fP 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).
.RE
.sp
\fB\-\-encrypt, \-\-new, \-N\fP
.RS 4
Initialize (and run) device in\-place encryption mode.
.RE
.sp
\fB\-\-force\-offline\-reencrypt (LUKS2 only)\fP
.RS 4
Bypass active device auto\-detection and enforce offline reencryption.
.sp
This option is useful especially for reencryption of LUKS2 images put in
files (auto\-detection is not reliable in this scenario).
.sp
It may also help in case active device auto\-detection on particular
data device does not work or report errors.
.sp
\fBWARNING:\fP Use with extreme caution! This may destroy data if the device
is activated and/or actively used.
.RE
.sp
\fB\-\-force\-password\fP
.RS 4
Do not use password quality checking for new LUKS passwords.
.sp
This option is ignored if cryptsetup is built without password
quality checking support.
.sp
For more info about password quality check, see the manual page for
\fBpwquality.conf(5)\fP and \fBpasswdqc.conf(5)\fP.
.RE
.sp
\fB\-\-hash, \-h\fP \fI<hash\-spec>\fP
.RS 4
\fBLUKS1:\fP
Specifies the hash used in the LUKS1 key setup scheme and volume key digest.
.sp
\fBNOTE\fP: if this parameter is not specified, default hash algorithm is always used
for new LUKS1 device header.
.sp
\fBLUKS2:\fP Ignored unless new keyslot pbkdf algorithm is set to PBKDF2 (see \-\-pbkdf).
.RE
.sp
\fB\-\-header <device or file storing the LUKS header>\fP
.RS 4
Use a detached (separated) metadata device or file where the LUKS
header is stored. This option allows one to store ciphertext and LUKS
header on different devices.
.sp
If used with \-\-encrypt/\-\-new option, the header file will be created (or overwritten).
Use with care.
.sp
\fBLUKS2\fP:
For decryption mode the option may be used to export 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 head of data
device so that data can be moved at original LUKS2 header location. Later on
decryption operation continues as if the ordinary detached header was passed.
.sp
\fBWARNING:\fP Never put exported header file in a filesystem on top of device
you are about to decrypt! It would cause a deadlock.
.RE
.sp
\fB\-\-help, \-?\fP
.RS 4
Show help text and default parameters.
.RE
.sp
\fB\-\-hotzone\-size\fP \fIsize\fP \fB(LUKS2 only)\fP
.RS 4
This option can be used to set an upper limit on the size of
reencryption area (hotzone). The \fIsize\fP can be specified with unit
suffix (for example 50M). Note that actual hotzone size may be less
than specified <size> due to other limitations (free space in keyslots
area or available memory).
.sp
With decryption mode for devices with LUKS2 header placed in head of data
device, the option specifies how large is the first data segment moved
from original data offset pointer.
.RE
.sp
\fB\-\-init\-only (LUKS2 only)\fP
.RS 4
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.
.RE
.sp
\fB\-\-iter\-time, \-i <number of milliseconds>\fP
.RS 4
The number of milliseconds to spend with PBKDF passphrase processing for the
new LUKS header.
.RE
.sp
\fB\-\-keep\-key\fP
.RS 4
\fBLUKS2\fP:
Do not change effective volume key and change other parameters provided
it is requested.
.sp
\fBLUKS1\fP:
Reencrypt only the LUKS1 header and keyslots. Skips data in\-place reencryption.
.RE
.sp
\fB\-\-key\-file, \-d\fP \fIname\fP
.RS 4
Read the passphrase from file.
.sp
If the name given is "\-", then the passphrase will be read from stdin.
In this case, reading will not stop at newline characters.
.sp
\fBWARNING:\fP \-\-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 new LUKS device).
.sp
If this option is not used, cryptsetup will ask for all active keyslot
passphrases.
.RE
.sp
\fB\-\-keyfile\-offset\fP \fIvalue\fP
.RS 4
Skip \fIvalue\fP bytes at the beginning of the key file.
.RE
.sp
\fB\-\-keyfile\-size, \-l\fP \fIvalue\fP
.RS 4
Read a maximum of \fIvalue\fP 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.
.sp
This option is useful to cut trailing newlines, for example. If
\-\-keyfile\-offset is also given, the size count starts after the offset.
.RE
.sp
\fB\-\-key\-size, \-s\fP \fIbits\fP
.RS 4
Sets key size in \fIbits\fP. The argument has to be a multiple of 8. The
possible key\-sizes are limited by the cipher and mode used.
.sp
See /proc/crypto for more information. Note that key\-size in
/proc/crypto is stated in bytes.
.sp
\fBLUKS1\fP:
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.
.sp
If there is not enough space for keyslots with new key size,
you can destructively shrink device with \-\-reduce\-device\-size option.
.RE
.sp
\fB\-\-key\-slot, \-S <0\-N>\fP
.RS 4
For LUKS operations that add key material, this option allows you to
specify which key slot is selected for the new key.
.sp
For reencryption mode it selects specific keyslot (and passphrase) that can be used to unlock new volume key.
If used all other keyslots get removed after reencryption operation is finished.
.sp
The maximum number of key slots depends on the LUKS version. LUKS1 can have up
to 8 key slots. LUKS2 can have up to 32 key slots based on key slot area
size and key size, but a valid key slot ID can always be between 0 and
31 for LUKS2.
.RE
.sp
\fB\-\-keyslot\-cipher <cipher\-spec>\fP
.RS 4
This option can be used to set specific cipher encryption for the
LUKS2 keyslot area.
.RE
.sp
\fB\-\-keyslot\-key\-size <bits>\fP
.RS 4
This option can be used to set specific key size for the LUKS2 keyslot
area.
.RE
.sp
\fB\-\-label <LABEL> \-\-subsystem <SUBSYSTEM>\fP
.RS 4
Set label and subsystem description for LUKS2 device.
The label and subsystem are optional fields and can be later used
in udev scripts for triggering user actions once the device marked
by these labels is detected.
.RE
.sp
\fB\-\-luks2\-keyslots\-size <size>\fP
.RS 4
This option can be used to set specific size of the LUKS2 binary
keyslot area (key material is encrypted there). The value must be
aligned to multiple of 4096 bytes with maximum size 128MB. The <size>
can be specified with unit suffix (for example 128k).
.RE
.sp
\fB\-\-luks2\-metadata\-size <size>\fP
.RS 4
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 LUKS2 specification, only
these values are valid: 16, 32, 64, 128, 256, 512, 1024, 2048 and 4096
kB The <size> can be specified with unit suffix (for example 128k).
.RE
.sp
\fB\-\-offset, \-o <number of 512 byte sectors>\fP
.RS 4
Start offset in the backend device in 512\-byte sectors.
This option is only relevant for the encrypt mode.
.sp
The \-\-offset option sets the data offset (payload) of data
device and must be aligned to 4096\-byte sectors (must be multiple of
8). This option cannot be combined with \-\-align\-payload option.
.RE
.sp
\fB\-\-pbkdf <PBKDF spec>\fP
.RS 4
Set Password\-Based Key Derivation Function (PBKDF) algorithm for LUKS
keyslot. The PBKDF can be: \fIpbkdf2\fP (for PBKDF2 according to RFC2898),
\fIargon2i\fP for Argon2i or \fIargon2id\fP for Argon2id (see
.URL "https://www.cryptolux.org/index.php/Argon2" "Argon2" " "
for more info).
.sp
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 \fIcryptsetup \-\-help\fP output.
.sp
A PBKDF is used for increasing dictionary and brute\-force attack cost
for keyslot passwords. The parameters can be time, memory and parallel
cost.
.sp
For PBKDF2, only 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.
.sp
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 (\fI\-\-iter\-time\fP) with required memory cost
\fI\-\-pbkdf\-memory\fP. If it is not possible, the memory cost is decreased as
well. The parallel cost \fI\-\-pbkdf\-parallel\fP is constant and is checked
against available CPU cores.
.sp
You can see all PBKDF parameters for particular LUKS2 keyslot with
\fBcryptsetup\-luksDump\fP(8) command.
.sp
\fBNOTE:\fP If you do not want to use benchmark and want to specify all
parameters directly, use \fI\-\-pbkdf\-force\-iterations\fP with
\fI\-\-pbkdf\-memory\fP and \fI\-\-pbkdf\-parallel\fP. 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.
.sp
\fBMINIMAL AND MAXIMAL PBKDF COSTS:\fP For \fBPBKDF2\fP, the minimum iteration
count is 1000 and maximum is 4294967295 (maximum for 32bit unsigned
integer). Memory and parallel costs are unused for PBKDF2. For \fBArgon2i\fP
and \fBArgon2id\fP, minimum iteration count (CPU cost) is 4 and maximum is
4294967295 (maximum for 32bit unsigned integer). Minimum memory cost is
32 KiB and maximum is 4 GiB. (Limited by addressable memory on some CPU
platforms.) If the memory cost parameter is benchmarked (not specified
by a parameter) it is always in range from 64 MiB to 1 GiB. The parallel
cost minimum is 1 and maximum 4 (if enough CPUs cores are available,
otherwise it is decreased).
.RE
.sp
\fB\-\-pbkdf\-force\-iterations <num>\fP
.RS 4
Avoid PBKDF benchmark and set time cost (iterations) directly. It can
be used for LUKS/LUKS2 device only. See \fI\-\-pbkdf\fP option for more
info.
.RE
.sp
\fB\-\-pbkdf\-memory <number>\fP
.RS 4
Set the memory cost for PBKDF (for Argon2i/id the number represents
kilobytes). Note that it is maximal value, PBKDF benchmark or
available physical memory can decrease it. This option is not
available for PBKDF2.
.RE
.sp
\fB\-\-pbkdf\-parallel <number>\fP
.RS 4
Set the parallel cost for PBKDF (number of threads, up to 4). Note
that it is maximal value, it is decreased automatically if CPU online
count is lower. This option is not available for PBKDF2.
.RE
.sp
\fB\-\-progress\-frequency\fP \fIseconds\fP
.RS 4
Print separate line every \fIseconds\fP with reencryption progress.
.RE
.sp
\fB\-\-progress\-json\fP
.RS 4
Prints progress data in JSON format suitable mostly for machine
processing. It prints separate line every half second (or based on
\fI\-\-progress\-frequency\fP value). The JSON output looks as follows during
progress (except it\(cqs compact single line):
.sp
.if n .RS 4
.nf
.fam C
{
  "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
}
.fam
.fi
.if n .RE
.sp
Note on numbers in JSON output: Due to JSON parsers limitations all
numbers are represented in a string format due to need of full 64bit
unsigned integers.
.RE
.sp
\fB\-\-reduce\-device\-size\fP \fIsize\fP
.RS 4
This means that last \fIsize\fP sectors on the original device will be lost,
data will be effectively shifted by specified number of sectors.
.sp
It could be useful if you added some space to underlying partition or
logical volume (so last \fIsize\fP sectors contains no data).
.sp
For units suffix see \-\-device\-size parameter description.
.sp
\fBWARNING:\fP This is a destructive operation and cannot be reverted. Use
with extreme care \- accidentally overwritten filesystems are usually
unrecoverable.
.sp
\fBLUKS2\fP:
Initialize LUKS2 reencryption with data device size reduction
(currently only encryption mode is supported).
.sp
Recommended minimal size is twice the default LUKS2 header size
(\-\-reduce\-device\-size 32M) for encryption mode.
.sp
\fBLUKS1\fP:
Enlarge data offset to specified value by shrinking device size.
.sp
You cannot shrink device more than by 64 MiB (131072 sectors).
.RE
.sp
\fB\-\-resilience\fP \fImode\fP \fB(LUKS2 only)\fP
.RS 4
Reencryption resilience \fImode\fP can be one of \fIchecksum\fP, \fIjournal\fP or
\fInone\fP.
.sp
\fIchecksum\fP: 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.
.sp
\fIjournal\fP: the hotzone is journaled in the binary area (so the data are
written twice).
.sp
\fInone\fP: performance mode. There is no protection and the only way it\(cqs
safe to interrupt the reencryption is similar to old offline
reencryption utility.
.sp
Resilience modes can be changed unless \fIdatashift\fP mode is used for
operation initialization (encryption with \-\-reduce\-device\-size option)
.RE
.sp
\fB\-\-resilience\-hash\fP \fIhash\fP \fB(LUKS2 only)\fP
.RS 4
The \fIhash\fP algorithm used with "\-\-resilience checksum" only. The default
hash is sha256. With other resilience modes, the hash parameter is
ignored.
.RE
.sp
\fB\-\-resume\-only (LUKS2 only)\fP
.RS 4
Resume reencryption (any mode) operation already described in LUKS2
metadata. If no reencrypt operation is initialized, the command with
\-\-resume\-only parameter fails. Useful for resuming reencrypt operation
without accidentally triggering new reencryption operation.
.RE
.sp
\fB\-\-sector\-size\fP \fIbytes\fP \fB(LUKS2 only)\fP
.RS 4
Reencrypt device with new encryption sector size enforced.
.sp
\fBWARNING:\fP Increasing encryption sector size may break hosted filesystem. Do not
run reencryption with \-\-force\-offline\-reencrypt if unsure what block size
was filesystem formatted with.
.RE
.sp
\fB\-\-timeout, \-t <number of seconds>\fP
.RS 4
The number of seconds to wait before 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.
.sp
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.
.RE
.sp
\fB\-\-tries, \-T\fP
.RS 4
How often the input of the passphrase shall be retried. The default is 3 tries.
.RE
.sp
\fB\-\-type <device\-type>\fP
.RS 4
Specifies required (encryption mode) or expected (other modes) LUKS format. Accepts only \fIluks1\fP or \fIluks2\fP.
.RE
.sp
\fB\-\-usage\fP
.RS 4
Show short option help.
.RE
.sp
\fB\-\-use\-directio (LUKS1 only)\fP
.RS 4
Use direct\-io (O_DIRECT) for all read/write data operations related
to block device undergoing reencryption.
.sp
Useful if direct\-io operations perform better than normal buffered
operations (e.g. in virtual environments).
.RE
.sp
\fB\-\-use\-fsync (LUKS1 only)\fP
.RS 4
Use fsync call after every written block. This applies for reencryption
log files as well.
.RE
.sp
\fB\-\-use\-random\fP, \fB\-\-use\-urandom\fP
.RS 4
Define which kernel random number generator will be used to create the volume key.
.RE
.sp
\fB\-\-uuid <UUID>\fP
.RS 4
When used in encryption mode use the provided \fIUUID\fP for the new LUKS header
instead of generating a new one.
.sp
\fBLUKS1 (only in decryption mode)\fP:
To find out what \fIUUID\fP to pass look for temporary files LUKS\-\fIUUID\fP.[|log|org|new]
of the interrupted decryption process.
.sp
The \fIUUID\fP must be provided in the standard UUID format, e.g.
12345678\-1234\-1234\-1234\-123456789abc.
.RE
.sp
\fB\-\-verify\-passphrase, \-y\fP
.RS 4
When interactively asking for a passphrase, ask for it twice and
complain if both inputs do not match.
Ignored on input from file or stdin.
.RE
.sp
\fB\-\-version, \-V\fP
.RS 4
Show the program version.
.RE
.sp
\fB\-\-volume\-key\-file, \-\-master\-key\-file (OBSOLETE alias)\fP
.RS 4
Use (set) new volume key stored in a file.
.br
\fBWARNING:\fP 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.
.RE
.sp
\fB\-\-write\-log (LUKS1 only)\fP
.RS 4
Update log file after every block write. This can slow down reencryption
but will minimize data loss in the case of system crash.
.RE
.SH "EXAMPLES"
.sp
\fBNOTE\fP: You may drop \fB\-\-type luks2\fP option as long as LUKS2 format is
default.
.SS "LUKS2 ENCRYPTION EXAMPLES"
.sp
Encrypt LUKS2 device (in\-place). Make sure last 32 MiB on \fI/dev/plaintext\fP
is unused (e.g.: does not contain filesystem data):
.sp
\fBcryptsetup reencrypt \-\-encrypt \-\-type luks2 \-\-reduce\-device\-size 32m /dev/plaintext_device\fP
.sp
Encrypt LUKS2 device (in\-place) with detached header put in a file:
.sp
\fBcryptsetup reencrypt \-\-encrypt \-\-type luks2 \-\-header my_luks2_header /dev/plaintext_device\fP
.sp
Initialize LUKS2 in\-place encryption operation only and activate the device (not yet encrypted):
.sp
\fBcryptsetup reencrypt \-\-encrypt \-\-type luks2 \-\-init\-only \-\-reduce\-device\-size 32m /dev/plaintext_device my_future_luks_device\fP
.sp
Resume online encryption on device initialized in example above:
.sp
\fBcryptsetup reencrypt \-\-resume\-only /dev/plaintext_device\fP or
\fBcryptsetup reencrypt \-\-active\-name my_future_luks_device\fP
.SS "LUKS2 REENCRYPTION EXAMPLES"
.sp
Reencrypt LUKS2 device (refresh volume key only):
.sp
\fBcryptsetup reencrypt /dev/encrypted_device\fP
.SS "LUKS2 DECRYPTION EXAMPLES"
.sp
Decrypt LUKS2 device with header put in head of data device (header file does not exist):
.sp
\fBcryptsetup reencrypt \-\-decrypt \-\-header /export/header/to/file /dev/encrypted_device\fP
.sp
Decrypt LUKS2 device with detached header (header file exists):
.sp
\fBcryptsetup reencrypt \-\-decrypt \-\-header detached\-luks2\-header /dev/encrypted_device\fP
.sp
Resume interrupted LUKS2 decryption:
.sp
\fBcryptsetup reencrypt \-\-resume\-only \-\-header luks2\-hdr\-file /dev/encrypted_device\fP
.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" "."