'\" t .\" Title: cryptsetup-reencrypt .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.23 .\" Date: 2023-11-15 .\" Manual: Maintenance Commands .\" Source: cryptsetup 2.7.5 .\" Language: English .\" .TH "CRYPTSETUP\-REENCRYPT" "8" "2023-11-15" "cryptsetup 2.7.5" "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 [] or \-\-active\-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 or \-\-active\-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\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 parameter cryptsetup looks up active 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 takes effect only with encrypt option and it activates device 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 \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\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\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 \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 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 \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 \fP .RS 4 This option can be used to set specific cipher encryption for the LUKS2 keyslot area. .RE .sp \fB\-\-keyslot\-key\-size \fP .RS 4 This option can be used to set specific key size for the LUKS2 keyslot area. .RE .sp \fB\-\-label