Add ability to encrypt plain device.
[platform/upstream/cryptsetup.git] / man / cryptsetup-reencrypt.8
1 .TH CRYPTSETUP-REENCRYPT "8" "June 2012" "cryptsetup-reencrypt" "Maintenance Commands"
2 .SH NAME
3 cryptsetup-reencrypt - tool for offline LUKS device re-encryption
4 .SH SYNOPSIS
5 .B cryptsetup-reencrypt <options> <device>
6 .SH DESCRIPTION
7 .PP
8 Cryptsetup-reencrypt can be used to change reencryption parameters
9 which otherwise require full on-disk data change (re-encryption).
10
11 You can regenerate \fBvolume key\fR (the real key used in on-disk encryption
12 unclocked by passphrase), \fBcipher\fR, \fBcipher mode\fR.
13
14 Cryptsetup-reencrypt reencrypts data on LUKS device in-place. During
15 reencryption process the LUKS device is marked unavailable.
16
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).
19
20 \fIALWAYS BE SURE YOU HAVE RELIABLE BACKUP BEFORE USING THIS TOOL.\fR
21 .br
22 \fITHIS TOOL IS EXPERIMENTAL.\fR
23
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.
27
28 For more info about LUKS see cryptsetup(8).
29 .PP
30 .SH OPTIONS
31 .TP
32 To start (or continue) re-encryption for <device> use:
33 .PP
34 \fIcryptsetup-reencrypt\fR <device>
35
36 \fB<options>\fR can be [\-\-block-size, \-\-cipher, \-\-hash, \-\-iter-time,
37 \-\-use-random | \-\-use-urandom, \-\-key-file, \-\-key-slot, \-\-keyfile-offset,
38 \-\-keyfile-size, \-\-tries, \-\-use-directio, \-\-use-fsync, \-\-write-log]
39
40 For detailed description of encryption and key file options see \fIcryptsetup(8)\fR
41 man page.
42 .TP
43 .B "\-\-verbose, \-v"
44 Print more information on command execution.
45 .TP
46 .B "\-\-debug"
47 Run in debug mode with full diagnostic logs. Debug output
48 lines are always prefixed by '#'.
49 .TP
50 .B "\-\-cipher, \-c" \fI<cipher-spec>\fR
51 Set the cipher specification string.
52 .TP
53 .B "\-\-key-size, \-s \fI<bits>\fR"
54 Set key size in bits. The argument has to be a multiple of  8.
55
56 The possible key-sizes are limited by the cipher and mode used. 
57
58 If you are increasing key size, there must be enough space in the LUKS header
59 for enlarged keyslots (data offset must be large enough) or reencryption
60 cannot be performed.
61
62 If there is not enough space for keyslots with new key size,
63 you can destructively shrink device with \-\-reduce-device-size option.
64 .TP
65 .B "\-\-hash, \-h \fI<hash-spec>\fR"
66 Specifies the hash used in the LUKS key setup scheme and volume key digest.
67 .TP
68 .B "\-\-iter-time, \-i \fI<milliseconds>\fR"
69 The number of milliseconds to spend with PBKDF2 passphrase processing for the
70 new LUKS header.
71 .TP
72 .B "\-\-use-random"
73 .TP
74 .B "\-\-use-urandom"
75 Define which kernel random number generator will be used to create the volume key.
76 .TP
77 .B "\-\-key-file, \-d \fIname\fR"
78 Read the passphrase from file.
79
80 WARNING: \-\-key-file option can be used only if there only one active keyslot,
81 or alternatively, also if \-\-key-slot option is specified (then all other keyslots
82 will be disabled in new LUKS device).
83
84 If this option is not used, cryptsetup-reencrypt will ask for all active keyslot
85 passphrases.
86 .TP
87 .B "\-\-key-slot, \-S <0-7>"
88 Specify which key slot is used.
89
90 WARNING: All other keyslots will be disabled if this option is used.
91 .TP
92 .B "\-\-keyfile-offset \fIvalue\fR"
93 Skip \fIvalue\fR bytes at the beginning of the key file.
94 .TP
95 .B "\-\-keyfile-size, \-l"
96 Read a maximum of \fIvalue\fR bytes from the key file.
97 Default is to read the whole file up to the compiled-in
98 maximum.
99 .TP
100 .B "\-\-tries, \-T"
101 Number of retries for invalid passphrase entry.
102 .TP
103 .B "\-\-block-size, \-B \fIvalue\fR"
104 Use re-encryption block size of <value> in MiB.
105
106 Values can be between 1 and 64 MiB.
107 .TP
108 .B "\-\-reduce-device-size \fInumber of 512 bytes sectors\fR"
109 Enlarge data offset for specified value of sectors by shrinking
110 device size.
111
112 This means that last sectors on the original device will be lost,
113 ciphertext data will be effectively shifted by specified
114 number of sectors.
115
116 It can be usefull if you e.g. added some space to underlying
117 partition (so last sectors contains no data).
118
119 WARNING: This is destructive operation and cannot be reverted.
120 Use with extreme care - shrinked filesystems are usually unrecoverable.
121
122 You cannot shrink device more than by 64 MiB (131072 sectors).
123 .TP
124 .B "\-\-new, N"
125 Create new header (encrypt not yet encrypted device).
126
127 This option must be used together with \-\-reduce-device-size.
128
129 WARNING: This is destructive operation and cannot be reverted.
130
131 .TP
132 .B "\-\-use-directio"
133 Use direct-io (O_DIRECT) for all read/write data operations.
134
135 Usefull if direct-io operations perform better than normal buffered
136 operations (e.g. in virtual environments).
137 .TP
138 .B "\-\-use-fsync"
139 Use fsync call after every written block.
140 .TP
141 .B "\-\-write-log"
142 Update log file after every block write. This can slow down reencryption
143 but will minimize data loss in the case of system crash.
144 .TP
145 .B "\-\-batch-mode, \-q"
146 Suppresses all warnings and reencryption progress output.
147 .TP
148 .B "\-\-version"
149 Show the program version.
150 .SH RETURN CODES
151 Cryptsetup-reencrypt returns 0 on success and a non-zero value on error.
152
153 Error codes are: 1 wrong parameters, 2 no permission,
154 3 out of memory, 4 wrong device specified, 5 device already exists
155 or device is busy.
156 .SH REPORTING BUGS
157 Report bugs, including ones in the documentation, on
158 the cryptsetup mailing list at <dm-crypt@saout.de>
159 or in the 'Issues' section on LUKS website.
160 Please attach the output of the failed command with the
161 \-\-debug option added.
162 .SH AUTHORS
163 Cryptsetup-reencrypt was written by Milan Broz <gmazyland@gmail.com>.
164 .SH COPYRIGHT
165 Copyright \(co 2012 Milan Broz
166 .br
167 Copyright \(co 2012 Red Hat, Inc.
168
169 This is free software; see the source for copying conditions.  There is NO
170 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
171 .SH SEE ALSO
172 The project website at \fBhttp://code.google.com/p/cryptsetup/\fR