1 .TH CRYPTSETUP-REENCRYPT "8" "June 2012" "cryptsetup-reencrypt" "Maintenance Commands"
3 cryptsetup-reencrypt - tool for offline LUKS device re-encryption
5 .B cryptsetup-reencrypt <options> <device>
8 Cryptsetup-reencrypt can be used to change reencryption parameters
9 which otherwise require full on-disk data change (re-encryption).
11 You can regenerate \fBvolume key\fR (the real key used in on-disk encryption
12 unclocked by passphrase), \fBcipher\fR, \fBcipher mode\fR.
14 Cryptsetup-reencrypt reencrypts data on LUKS device in-place. During
15 reencryption process the LUKS device is marked unavailable.
17 \fIWARNING\fR: The cryptsetup-reencrypt program is not resistant to hardware
18 or kernel failures during reencryption (you can lose you data in this case).
20 \fIALWAYS BE SURE YOU HAVE RELIABLE BACKUP BEFORE USING THIS TOOL.\fR
22 \fITHIS TOOL IS EXPERIMENTAL.\fR
24 The reencryption can be temporarily suspended (by TERM signal or by
25 using ctrl+c) but you need to retain temporary files named LUKS-<uuid>.[log|org|new].
26 LUKS device is unavailable until reencryption is finished though.
28 Current working directory must by writable and temporary
29 files created during reencryption must be present.
31 For more info about LUKS see cryptsetup(8).
35 To start (or continue) re-encryption for <device> use:
37 \fIcryptsetup-reencrypt\fR <device>
39 \fB<options>\fR can be [\-\-block-size, \-\-cipher, \-\-hash, \-\-iter-time,
40 \-\-use-random | \-\-use-urandom, \-\-key-file, \-\-key-slot, \-\-keyfile-offset,
41 \-\-keyfile-size, \-\-tries, \-\-use-directio, \-\-use-fsync, \-\-write-log]
43 For detailed description of encryption and key file options see \fIcryptsetup(8)\fR
47 Print more information on command execution.
50 Run in debug mode with full diagnostic logs. Debug output
51 lines are always prefixed by '#'.
53 .B "\-\-cipher, \-c" \fI<cipher-spec>\fR
54 Set the cipher specification string.
56 .B "\-\-key-size, \-s \fI<bits>\fR"
57 Set key size in bits. The argument has to be a multiple of 8.
59 The possible key-sizes are limited by the cipher and mode used.
61 If you are increasing key size, there must be enough space in the LUKS header
62 for enlarged keyslots (data offset must be large enough) or reencryption
65 If there is not enough space for keyslots with new key size,
66 you can destructively shrink device with \-\-reduce-device-size option.
68 .B "\-\-hash, \-h \fI<hash-spec>\fR"
69 Specifies the hash used in the LUKS key setup scheme and volume key digest.
71 .B "\-\-iter-time, \-i \fI<milliseconds>\fR"
72 The number of milliseconds to spend with PBKDF2 passphrase processing for the
78 Define which kernel random number generator will be used to create the volume key.
80 .B "\-\-key-file, \-d \fIname\fR"
81 Read the passphrase from file.
83 WARNING: \-\-key-file option can be used only if there only one active keyslot,
84 or alternatively, also if \-\-key-slot option is specified (then all other keyslots
85 will be disabled in new LUKS device).
87 If this option is not used, cryptsetup-reencrypt will ask for all active keyslot
90 .B "\-\-key-slot, \-S <0-7>"
91 Specify which key slot is used.
93 WARNING: All other keyslots will be disabled if this option is used.
95 .B "\-\-keyfile-offset \fIvalue\fR"
96 Skip \fIvalue\fR bytes at the beginning of the key file.
98 .B "\-\-keyfile-size, \-l"
99 Read a maximum of \fIvalue\fR bytes from the key file.
100 Default is to read the whole file up to the compiled-in
104 Number of retries for invalid passphrase entry.
106 .B "\-\-block-size, \-B \fIvalue\fR"
107 Use re-encryption block size of <value> in MiB.
109 Values can be between 1 and 64 MiB.
111 .B "\-\-reduce-device-size \fInumber of 512 bytes sectors\fR"
112 Enlarge data offset for specified value of sectors by shrinking
115 This means that last sectors on the original device will be lost,
116 ciphertext data will be effectively shifted by specified
119 It can be usefull if you e.g. added some space to underlying
120 partition (so last sectors contains no data).
122 WARNING: This is destructive operation and cannot be reverted.
123 Use with extreme care - shrinked filesystems are usually unrecoverable.
125 You cannot shrink device more than by 64 MiB (131072 sectors).
128 Create new header (encrypt not yet encrypted device).
130 This option must be used together with \-\-reduce-device-size.
132 WARNING: This is destructive operation and cannot be reverted.
135 .B "\-\-use-directio"
136 Use direct-io (O_DIRECT) for all read/write data operations.
138 Usefull if direct-io operations perform better than normal buffered
139 operations (e.g. in virtual environments).
142 Use fsync call after every written block.
145 Update log file after every block write. This can slow down reencryption
146 but will minimize data loss in the case of system crash.
148 .B "\-\-batch-mode, \-q"
149 Suppresses all warnings and reencryption progress output.
152 Show the program version.
154 Cryptsetup-reencrypt returns 0 on success and a non-zero value on error.
156 Error codes are: 1 wrong parameters, 2 no permission,
157 3 out of memory, 4 wrong device specified, 5 device already exists
161 Reencrypt /dev/sdb1 (change volume key)
162 cryptsetup-reencrypt /dev/sdb1
164 Reencrypt and also change cipher and cipher mode
165 cryptsetup-reencrypt /dev/sdb1 -c aes-xts-plain64
167 Add LUKS encryption to not yet encrypted device
169 First, be sure you have space added to disk.
170 Or alternatively shrink filesystem in advance.
172 Here we need 4096 512-bytes sectors (enough for 2x128 bit key).
174 fdisk -u /dev/sdb # move sdb1 partition end + 4096 sectors
176 cryptsetup-reencrypt /dev/sdb1 --new --reduce-device-size 4096
179 Report bugs, including ones in the documentation, on
180 the cryptsetup mailing list at <dm-crypt@saout.de>
181 or in the 'Issues' section on LUKS website.
182 Please attach the output of the failed command with the
183 \-\-debug option added.
185 Cryptsetup-reencrypt was written by Milan Broz <gmazyland@gmail.com>.
187 Copyright \(co 2012 Milan Broz
189 Copyright \(co 2012 Red Hat, Inc.
191 This is free software; see the source for copying conditions. There is NO
192 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
194 The project website at \fBhttp://code.google.com/p/cryptsetup/\fR