35921a99b09580bd8c8dd7aa7a1b4f66bf12478c
[platform/upstream/cryptsetup.git] / man / cryptsetup.8
1 .TH CRYPTSETUP "8" "May 2012" "cryptsetup" "Maintenance Commands"
2 .SH NAME
3 cryptsetup - manage plain dm-crypt and LUKS encrypted volumes
4 .SH SYNOPSIS
5 .B cryptsetup <options> <action> <action args>
6 .SH DESCRIPTION
7 .PP
8 cryptsetup is used to conveniently setup dm-crypt managed 
9 device-mapper mappings. These include plain dm-crypt volumes and 
10 LUKS volumes. The difference is that LUKS uses a metadata header
11 and can hence offer more features than plain dm-crypt. On the other 
12 hand, the header is visible and vulnerable to damage.
13 .SH WARNINGS
14 .PP 
15 A lot of good information on the risks of using encrypted storage,
16 on handling problems and on security aspects can be found in the
17 \fICryptsetup FAQ\fR. Read it. Nonetheless, some risks deserve
18 to be mentioned here. 
19
20 \fBBackup:\fR Storage media die. Encryption has no influence on that.
21 Backup is mandatory for encrypted data as well, if the data has any
22 worth. See the Cryptsetup FAQ for advice on how to do backup of an
23 encrypted volume.
24
25 \fBCharacter encoding:\fR If you enter a 
26 passphrase with special symbols, the passphrase can change 
27 depending character encoding. Keyboard settings can also change,
28 which can make blind input hard or impossible. For
29 example, switching from some ASCII 8-bit variant to UTF-8
30 can lead to a different binary encoding and hence different
31 passphrase seen by cryptsetup, even if what you see on
32 the terminal is exactly the same. It is therefore highly
33 recommended to select passphrase characters only from 7-bit 
34 ASCII, as the encoding for 7-bit ASCII stays the same for
35 all ASCII variants and UTF-8.
36
37 \fBLUKS header:\fR If the header of a LUKS volume gets damaged,
38 all data is permanently lost unless you have a header-backup.
39 If a key-slot is damaged, it can only be restored from a header-backup
40 or if another active key-slot with known passphrase is undamaged.
41 Damaging the LUKS header is something people manage to do with 
42 surprising frequency. This risk is the result of a trade-off 
43 between security and safety, as LUKS is designed for fast and 
44 secure wiping by just overwriting header and key-slot area. 
45
46 .SH PLAIN MODE
47 Plain dm-crypt encrypts the device sector-by-sector with a
48 single, non-salted hash of the passphrase. No checks 
49 are performed, no metadata is used. There is no formatting operation. 
50 When the raw device is mapped (created), the usual device operations 
51 can be used on the mapped device, including filesystem creation.
52 Mapped devices usually reside in /dev/mapper/<name>.
53
54 There are four operations:
55
56 \fIcreate\fR <name> <device>
57 .IP
58 Creates a mapping with <name> backed by device <device>.
59
60 \fB<options>\fR can be [\-\-hash, \-\-cipher, \-\-verify-passphrase,
61 \-\-key-file, \-\-keyfile-offset, \-\-key-size, \-\-offset, \-\-skip, \-\-size,
62 \-\-readonly, \-\-shared, \-\-allow-discards]
63
64 Example: 'cryptsetup create e1 /dev/sda10' maps the raw
65 encrypted device /dev/sda10 to the mapped (decrypted) device
66 /dev/mapper/e1, which can then be mounted, fsck-ed or have a 
67 filesystem created on it.
68 .PP
69 \fIremove\fR <name>
70 .IP
71 Removes the existing mapping <name> and wipes the key from kernel memory.
72 .PP
73 \fIstatus\fR <name>
74 .IP
75 Reports the status for the mapping <name>.
76 .PP
77 \fIresize\fR <name>
78 .IP
79 Resizes an active mapping <name>.
80
81 If \-\-size (in sectors) is not specified, the size of the 
82 underlying block device is used. Note that this does not
83 change the raw device geometry, it just changes how many
84 sectors of the raw device are represented in the mapped device.
85 .SH LUKS EXTENSION
86 LUKS, the Linux Unified Key Setup, is a standard for disk encryption.
87 It adds a standardized header at the start of the device, 
88 a key-slot area directly behind the header and the bulk
89 data area behind that. The whole set is called a 'LUKS container'.
90 The device that a LUKS container resides on is called a 'LUKS device'.
91 For most purposes both terms can be used interchangeably. But
92 note that when the LUKS header is at a nonzero offset
93 in a device, then the device is not a LUKS device anymore, but
94 has a LUKS container stored in it at an offset.
95
96 LUKS can manage multiple passphrases that can be individually revoked 
97 or changed and that can be securely scrubbed from persistent 
98 media due to the use of anti-forensic stripes. Passphrases
99 are protected against brute-force and dictionary
100 attacks by PBKDF2, which implements hash iteration and salting
101 in one function.
102
103 Each passphrase, also called a
104 .B key
105 in this document, is associated with one of 8 key-slots.
106 Key operations that do not specify a slot affect the first slot
107 that matches the supplied passphrase or the first empty slot if
108 a new passphrase is added.
109
110 The following are valid LUKS actions:
111
112 \fIluksFormat\fR <device> [<key file>]
113 .IP
114 Initializes a LUKS partition and sets the initial passphrase
115 (for key-slot 0), 
116 either via prompting or via <key file>. Note that 
117 if the second argument is present, then the passphrase 
118 is taken from the file given there, without the need
119 to use the \-\-key-file option. Also note that for both forms
120 of reading the passphrase from file you can 
121 give '-' as file name, which results in the passphrase being read
122 from stdin and the safety-question being skipped.
123
124 You can only call luksFormat on a LUKS device that is not mapped.
125
126 \fB<options>\fR can be [\-\-cipher, \-\-verify-passphrase, \-\-key-size,
127 \-\-key-slot, \-\-key-file (takes precedence over optional second argument),
128 \-\-keyfile-offset, \-\-keyfile-size, \-\-use-random | \-\-use-urandom, 
129 \-\-uuid,
130 \-\-master-key-file].
131
132 \fBWARNING:\fR Doing a luksFormat on an existing LUKS container will
133 make all data the old container permanently irretrievable, unless
134 you have a header backup.
135 .PP
136 \fIluksOpen\fR <device> <name>
137 .IP
138 Opens the LUKS device <device> and sets up a mapping <name> after
139 successful verification of the supplied passphrase. 
140 If the passphrase is not supplied via \-\-key-file, the command
141 prompts for it interactively.
142
143 The <device> parameter can be also specified by LUKS UUID in the 
144 format UUID=<uuid>, which uses the symlinks in /dev/disk/by-uuid.
145
146 \fB<options>\fR can be [\-\-key-file, \-\-keyfile-offset, 
147 \-\-keyfile-size, \-\-readonly,
148 \-\-allow-discards, \-\-header, \-\-key-slot, \-\-master-key-file].
149 .PP
150 \fIluksClose\fR <name>
151 .IP
152 identical to \fIremove\fR.
153 .PP
154 \fIluksSuspend\fR <name>
155 .IP
156 Suspends an active device (all IO operations will blocked
157 and accesses to the device will wait indefinitely)
158 and wipes the encryption
159 key from kernel memory. Needs kernel 2.6.19 or later.
160
161 After this operation you have to use \fIluksResume\fR to reinstate
162 the encryption key and unblock the device or \fIluksClose\fR to remove 
163 the mapped device.
164
165 \fBWARNING:\fR never suspend the device on which the cryptsetup binary resides.
166
167 \fB<options>\fR can be [\-\-header].
168 .PP
169 \fIluksResume\fR <name>
170 .IP
171 Resumes a suspended device and reinstates the encryption key. 
172 Prompts interactively for a passphrase if \-\-key-file is not given.
173
174 \fB<options>\fR can be [\-\-key-file, \-\-keyfile-size, \-\-header]
175 .PP
176 \fIluksAddKey\fR <device> [<key file with new key>]
177 .IP
178 adds a new passphrase. An existing passphrase must be supplied 
179 interactively or via \-\-key-file.
180 The new passphrase to be added can be specified interactively
181 or read from the file given as positional argument.
182
183 \fB<options>\fR can be [\-\-key-file, \-\-keyfile-offset, 
184 \-\-keyfile-size, \-\-new-keyfile-offset,
185 \-\-new-keyfile-size, \-\-key-slot, \-\-master-key-file].
186 .PP
187 \fIluksRemoveKey\fR <device> [<key file with passphrase to be removed>] 
188 .IP
189 Removes the supplied passphrase from the LUKS device. The
190 passphrase to be removed can be specified interactively,
191 as positional argument or via \-\-key-file.
192
193 \fB<options>\fR can be [\-\-key-file, \-\-keyfile-offset, 
194 \-\-keyfile-size]
195
196 \fBWARNING:\fR If you read the passphrase from stdin
197 (without further argument or with '-' as argument 
198 to \-\-key-file), batch-mode (-q) will be implicitely
199 switched on and no warning will be given when you remove the 
200 last remaining passphrase from a LUKS container. Removing
201 the last passphrase makes the LUKS container permanently 
202 inaccessible.
203 .PP
204 \fIluksChangeKey\fR <device> [<new key file>]
205 .IP
206 Changes an existing passphrase. The passphrase
207 to be changed must be supplied interactively or via \-\-key-file.
208 The new passphrase can be supplied interactively or in 
209 a file given as positional argument.
210
211 If a key-slot is specified (via \-\-key-slot), the passphrase
212 for that key-slot must be given and the new passphrase
213 will overwrite the specified key-slot. If no key-slot
214 is specified and there is still a free key-slot, then
215 the new passphrase will be put into a free key-slot before the 
216 key-slot containing the old passphrase is purged. If there is
217 no free key-slot, then the key-slot with the old passphrase is
218 overwritten directly.
219
220 \fBWARNING:\fR If a key-slot is overwritten, a media failure
221 during this operation can cause the overwrite to fail after
222 the old passphrase has been wiped and make the LUKS container
223 inaccessible. 
224
225 \fB<options>\fR can be [\-\-key-file, \-\-keyfile-offset, 
226 \-\-keyfile-size, \-\-new-keyfile-offset,
227 \-\-new-keyfile-size, \-\-key-slot].
228 .PP
229 \fIluksKillSlot\fR <device> <key slot number>
230 .IP
231 Wipe the key-slot number <key slot> from the LUKS device. A remaining 
232 passphrase must be supplied, either interactively or via \-\-key-file.
233 This command can remove the last remaining key-slot, but requires
234 an interactive confirmation when doing so. Removing the last
235 passphrase makes a LUKS container permanently inaccessible.
236
237 \fB<options>\fR can be [\-\-key-file, \-\-keyfile-offset, \-\-keyfile-size].
238
239 \fBWARNING:\fR If you read the passphrase from stdin
240 (without further argument or with '-' as argument 
241 to \-\-key-file), batch-mode (-q) will be implicitely
242 switched on and no warning will be given when you remove the 
243 last remaining passphrase from a LUKS container. Removing
244 the last passphrase makes the LUKS container permanently 
245 inaccessible.
246 .PP
247 \fIluksUUID\fR <device>
248 .IP
249 Print the UUID of a LUKS device.
250 .br
251 Set new UUID if \fI\-\-uuid\fR option is specified.
252 .PP
253 \fIisLuks\fR <device>
254 .IP
255 Returns true, if <device> is a LUKS device, false otherwise.
256 Use option \-v to get human-readable feedback. 'Command successful.'
257 means the device is a LUKS device. 
258 .PP
259 \fIluksDump\fR <device>
260 .IP
261 Dump the header information of a LUKS device.
262
263 If the \-\-dump-master-key option is used, the LUKS device master key is 
264 dumped instead of the keyslot info. Beware that the master key cannot be
265 changed and can be used to decrypt the data stored in the LUKS container
266 without a passphrase and even without the LUKS header. This means
267 that if the master key is compromised, the whole device has to be 
268 erased to prevent further access. Use this option carefully.  
269
270 In order to dump the master key, a passphrase has to be supplied,
271 either interactively or via \-\-key-file. 
272
273 \fB<options>\fR can be [\-\-dump-master-key, \-\-key-file, 
274 \-\-keyfile-offset, \-\-keyfile-size].
275
276 \fBWARNING:\fR If \-\-dump-master-key is used with \-\-key-file
277 and the argument to \-\-key-file is '-', no validation question 
278 will be asked and no warning given.
279 .PP
280 \fIluksHeaderBackup\fR <device> \-\-header-backup-file <file>
281 .IP
282 Stores a binary backup of the LUKS header and keyslot area.
283 .br
284 Note: Using '-' as filename writes the header backup to a file named '-'. 
285
286 \fBWARNING:\fR This backup file and a passphrase valid
287 at the time of backup allows decryption of the 
288 LUKS data area, even if the passphrase was later changed or 
289 removed from the LUKS device. Also note that with a header
290 backup you lose the ability to securely wipe the LUKS
291 device by just overwriting the header and key-slots. You 
292 either need to securely erase all header backups in 
293 addition or overwrite the encrypted data area as well.
294 The second option is less secure, as some sectors
295 can survive, e.g. due to defect management. 
296 .PP
297 \fIluksHeaderRestore\fR <device> \-\-header-backup-file <file>
298 .IP
299 Restores a binary backup of the LUKS header and keyslot area 
300 from the specified file.
301 .br
302 Note: Using '-' as filename reads the header backup from a file named '-'.
303
304 \fBWARNING:\fR Header and keyslots will be replaced, only
305 the passphrases from the backup will work afterwards.
306
307 This command requires that the master key size and data offset 
308 of the LUKS header already on the device and of the header backup 
309 match. Alternatively, if there is no LUKS header on the device,
310 the backup will also be written to it.
311 .PP
312 \fIrepair\fR <device>
313 .IP
314 Tries to repair the LUKS device metadata if possible.
315
316 This command is useful to fix some known benign LUKS metadata 
317 header corruptions. Only basic corruptions of unused keyslot 
318 are fixable. This command will only change the LUKS header, not
319 any key-slot data.
320
321 \fBWARNING:\fR Always create a binary backup of the original 
322 header before calling this command.
323 .SH loop-AES EXTENSION
324 cryptsetup supports mapping loop-AES encrypted partition using
325 a compatibility mode.
326 .PP
327 \fIloopaesOpen\fR <device> <name> \-\-key-file <keyfile>
328 .IP
329 Opens the loop-AES <device> and sets up a mapping <name>.
330
331 If the key file is encrypted with GnuPG, then you have to use
332 \-\-key-file=- and decrypt it before use, e.g. like this:
333 .br
334 gpg \-\-decrypt <keyfile> | cryptsetup loopaesOpen \-\-key-file=- <device> <name>
335
336 Use \fB\-\-key-file-size\fR to specify the proper key length if needed. 
337
338 Use \fB\-\-offset\fR to specify device offset. Note that the units 
339 need to be specified in number of 512 byte sectors.
340
341 Use \fB\-\-skip\fR to specify the IV offset. If the original device 
342 used an offset and but did not use it in IV sector calculations, 
343 you have to explicitly use \fB\-\-skip 0\fR in addition to the offset 
344 parameter.
345
346 Use \fB\-\-hash\fR to override the default hash function for 
347 passphrase hashing (otherwise it is detected according to key 
348 size).
349
350 \fB<options>\fR can be [\-\-key-file, \-\-key-size, \-\-offset, \-\-skip,
351 \-\-hash, \-\-readonly, \-\-allow-discards].
352 .PP
353 \fIloopaesClose\fR <name>
354 .IP
355 Identical to \fIremove\fR.
356 .PP
357 See also section 7 of the FAQ and \fBhttp://loop-aes.sourceforge.net\fR
358 for more information regarding loop-AES.
359 .SH OPTIONS
360 .TP
361 .B "\-\-verbose, \-v"
362 Print more information on command execution.
363 .TP
364 .B "\-\-debug"
365 Run in debug mode with full diagnostic logs. Debug output
366 lines are always prefixed by '#'.
367 .TP
368 .B "\-\-hash, \-h \fI<hash-spec>\fR"
369 Specifies the passphrase hash for \fIcreate\fR and \fIloopaesOpen\fR.
370
371 Specifies the hash used in the LUKS key setup scheme and volume key digest 
372 for \fIluksFormat\fR.
373
374 The specified hash name is passed to the compiled-in crypto backend. 
375 Different backends may support different hashes. 
376 For \fIluksFormat\fR, the hash 
377 algorithm must provide at least 160 bits of output, which 
378 excludes, e.g., MD5. Do not use a non-crypto hash like
379 \fB"crc32"\fR as this breaks security.
380
381 Values compatible with old version of cryptsetup are 
382 \fB"ripemd160"\fR for \fIcreate\fR and 
383 \fB"sha1"\fR for \fIluksFormat\fR.
384
385 Use \fIcryptsetup \-\-help\fR to show the defaults.
386 .TP
387 .B "\-\-cipher, \-c \fI<cipher-spec>\fR"
388 Set the cipher specification string.
389
390 \fIcryptsetup \-\-help\fR shows the compiled-in defaults.
391 The current default in the distributed sources is
392 "aes-cbc-essiv:sha256" for both plain dm-crypt and LUKS.
393
394 For XTS mode (a possible future default), use "aes-xts-plain"
395 or better "aes-xts-plain64"
396 as cipher specification and optionally set a key size of
397 512 bits with the \-s option. Key size for XTS
398 mode is twice that for other modes for the same 
399 security level. 
400
401 XTS mode requires kernel 2.6.24 or later and plain64 requires 
402 kernel 2.6.33 or later. More information can be found in the FAQ.
403 .TP
404 .B "\-\-verify-passphrase, \-y"
405 When interactively asking for a passphrase, ask for it twice
406 and complain if both inputs do not match. Advised when creating 
407 a regular mapping for the first time, or when running 
408 \fIluksFormat\fR. Ignores on input from file or stdin.
409 .TP
410 .B "\-\-key-file, \-d \fIname\fR"
411 Read the passphrase from file.
412
413 If the name given is "-", then the passphrase will be read from stdin. 
414 In this case, reading will not stop at newline characters.
415
416 With LUKS, passphrases supplied via \-\-key-file are always 
417 the existing passphrases requested by a command, except in 
418 the case of \fIluksFormat\fR where \-\-key-file is equivalent 
419 to the positional key file argument.
420
421 If you want to set a new passphrase via key file, you have to 
422 use a positional argument to \fIluksAddKey\fR.
423
424 See section \fBNOTES ON PASSPHRASE PROCESSING\fR for more information.
425 .TP
426 .B "\-\-keyfile-offset \fIvalue\fR"
427 Skip \fIvalue\fR bytes at the beginning of the key file.
428 Works with all commands that accepts key files.
429 .TP
430 .B "\-\-keyfile-size, \-l \fIvalue\fR"
431 Read a maximum of \fIvalue\fR bytes from the key file.
432 Default is to read the whole file up to the compiled-in
433 maximum that can be queried with \-\-help. Supplying more 
434 data than the compiled-in maximum aborts the operation.
435
436 This option is useful
437 to cut trailing newlines, for example. If \-\-keyfile-offset 
438 is also given, the size count starts after the offset.
439 Works with all commands that accepts key files.
440 .TP
441 .B "\-\-new-keyfile-offset \fIvalue\fR"
442 Skip \fIvalue\fR bytes at the start when
443 adding a new passphrase from key file with 
444 \fIluksAddKey\fR. 
445 .TP
446 .B "\-\-new-keyfile-size  \fIvalue\fR"
447 Read a maximum of \fIvalue\fR bytes when adding
448 a new passphrase from key file with \fIluksAddKey\fR. 
449 Default is to read the whole file up to the compiled-in 
450 maximum length that can be queried with \-\-help.
451 Supplying more than the compiled in maximum aborts the
452 operation.
453 When \-\-new-keyfile-offset is also given, reading starts
454 after the offset.
455 .TP
456 .B "\-\-master-key-file"
457 Use a master key stored in a file. 
458
459 For \fIluksFormat\fR this
460 allows creating a LUKS header with this specific
461 master key. If the master key was taken from an existing
462 LUKS header and all other parameters are the same,
463 then the new header decrypts the data encrypted with the
464 header the master key was taken from.
465
466 For \fIluksAddKey\fR this allows adding a new passphrase 
467 without having to know an exiting one.
468
469 For \fIluksOpen\fR this allows to open the LUKS device 
470 without giving a passphrase.
471 .TP
472 .B "\-\-dump-master-key"
473 For \fIluksDump\fR this option includes the master key in the displayed
474 information. Use with care, as the master key can be used to
475 bypass the passphrases, see also option \-\-master-key-file. 
476 .TP
477 .B "\-\-use-random"
478 .TP
479 .B "\-\-use-urandom"
480 For \fIluksFormat\fR these options define which kernel random number 
481 generator will be used to create the master key (which is a
482 long-term key).
483
484 See \fBNOTES ON RANDOM NUMBER GENERATORS\fR for more 
485 information. Use \fIcryptsetup \-\-help\fR
486 to show the compiled-in default random number generator.
487
488 \fBWARNING:\fR In a low-entropy situation (e.g. in an 
489 embedded system), both selections are problematic.
490 Using /dev/urandom can lead to weak keys.
491 Using /dev/random can block a long time, potentially 
492 forever, if not enough entropy can be harvested by 
493 the kernel.
494 .TP
495 .B "\-\-key-slot, \-S <0-7>"
496 For LUKS operations that add key material, this options allows you
497 to specify which key slot is selected for the new key.
498 This option can be used for \fIluksFormat\fR, 
499 and \fIluksAddKey\fR.
500 .br
501 In addition, for \fIluksOpen\fR, this option selects a
502 specific key-slot to compare the passphrase against.
503 If the given passphrase would only match a different key-slot,
504 the operation fails.            
505 .TP
506 .B "\-\-key-size, \-s <bits>"
507 Sets key size in bits. The argument has to be a multiple of 
508 8. The possible key-sizes are limited by the cipher and
509 mode used. 
510
511 See /proc/crypto for more information. Note that key-size 
512 in /proc/crypto is stated in bytes.
513
514 This option can be used for \fIcreate\fR or \fIluksFormat\fR. All 
515 other LUKS actions will use the key-size specified in the LUKS header.
516 Use \fIcryptsetup \-\-help\fR to show the compiled-in defaults.
517 .TP
518 .B "\-\-size, \-b <number of 512 byte sectors>"
519 Force the size of the underlying device in sectors of 512 bytes.
520 This option is only relevant for the \fIcreate\fR and \fIresize\fR 
521 actions. 
522 .TP
523 .B "\-\-offset, \-o <number of 512 byte sectors>"
524 Start offset in the backend device in 512-byte sectors.
525 This option is only relevant for the \fIcreate\fR and \fIloopaesOpen\fR 
526 actions.
527 .TP
528 .B "\-\-skip, \-p <number of 512 byte sectors>"
529 How many sectors of the encrypted data to skip at the beginning.
530 This option is only relevant for \fIcreate\fR and \fIloopaesOpen\fR action.
531
532 This is different from the \-\-offset options with respect to 
533 the sector numbers used in IV calculation.
534 Using \-\-offset will shift the IV calculation by the same negative amount.
535 Hence, if \-\-offset \fIn\fR, sector \fIn\fR will get a sector
536 number of \fI0\fR for the IV calculation.
537 Using \-\-skip causes sector \fIn\fR to also be the first sector
538 of the mapped device, but with its number for IV generation is \fIn\fR.
539 .TP
540 .B "\-\-readonly, \-r" 
541 set up a read-only mapping.
542 .TP
543 .B "\-\-shared"
544 Creates an additional mapping for one common 
545 ciphertext device. Arbitrary mappings are supported.
546 This option is only relevant for the 
547 \fIcreate\fR action. Use \-\-offset, \-\-size and \-\-skip to 
548 specify the mapped area.
549 .TP
550 .B "\-\-iter-time, \-i <number of milliseconds>"
551 The number of milliseconds to spend with PBKDF2 passphrase processing.
552 This option is only relevant for LUKS operations that set or change
553 passphrases, such as \fIluksFormat\fR or \fIluksAddKey\fR.
554 Specifying 0 as parameter selects the compiled-in default.
555 .TP
556 .B "\-\-batch-mode, \-q"
557 Suppresses all confirmation questions. Use with care! 
558
559 If the \-y option is not specified, this option also switches off
560 the passphrase verification for \fIluksFormat\fR.
561 .TP
562 .B "\-\-timeout, \-t <number of seconds>"
563 The number of seconds to wait before timeout on passphrase input
564 via terminal. It is relevant every time a passphrase is asked, 
565 for example for \fIcreate\fR, \fIluksOpen\fR, \fIluksFormat\fR 
566 or \fIluksAddKey\fR. It has no effect if used in conjunction 
567 with \-\-key-file. 
568 .br
569 This option is useful when the system 
570 should not stall if the user does not input a passphrase, 
571 e.g. during boot. The default is a value of 0 seconds,
572 which means to wait forever.  
573 .TP
574 .B "\-\-tries, \-T"
575 How often the input of the passphrase shall be retried. 
576 This option is relevant
577 every time a passphrase is asked, for example for 
578 \fIcreate\fR, \fIluksOpen\fR, \fIluksFormat\fR
579 or \fIluksAddKey\fR. The default is 3 tries.
580 .TP
581 .B "\-\-align-payload <number of 512 byte sectors>"   
582 Align payload at a boundary of \fIvalue\fR 512-byte sectors.
583 This option is relevant for \fIluksFormat\fR.
584
585 If not specified, cryptsetup tries to use the topology info 
586 provided by kernel for the underlying device to get optimal alignment.
587 If not available (or the calculated value is a multiple of the default) 
588 data is by default aligned to a 1MiB boundary (i.e. 2048 512-byte sectors).
589
590 For a detached LUKS header this option specifies the offset on the
591 data device. See also the \-\-header option.
592 .TP
593 .B "\-\-uuid=\fIUUID\fR"
594 Use the provided \fIUUID\fR for the \fIluksFormat\fR command 
595 instead of generating new one. Changes the existing UUID when 
596 used with the \fIluksUUID\fR command.
597
598 The UUID must be provided in the standard UUID format,
599 e.g. 12345678-1234-1234-1234-123456789abc.
600 .TP
601 .B "\-\-allow-discards\fR"
602 Allow the use of discard (TRIM) requests for device.
603 This option is only relevant for \fIcreate\fR, \fIluksOpen\fR 
604 and \fIloopaesOpen\fR.
605
606 \fBWARNING:\fR This command can have a negative security impact
607 because it can make filesystem-level operations visible on
608 the physical device. For example, information leaking
609 filesystem type, used space, etc. may be extractable from
610 the physical device if the discarded blocks can be located
611 later. If in doubt, do no use it.
612
613 A kernel version of 3.1 or later is needed. For earlier kernels
614 this option is ignored.
615 .TP
616 .B "\-\-header\fR <device or file storing the LUKS header>"
617 Use a detached (separated) metadata device or file where the 
618 LUKS header is stored. This options allows to store ciphertext
619 and LUKS header on different devices.
620
621 This option is only relevant for LUKS devices and can be 
622 used with the \fIluksFormat\fR, \fIluksOpen\fR, \fIluksSuspend\fR, 
623 \fIluksResume\fR, \fIstatus\fR and \fIresize\fR commands.
624
625 For \fIluksFormat\fR with a file name as argument to \-\-header,
626 it has to exist and be large enough to contain the LUKS header.
627 See the cryptsetup FAQ for header size calculation.
628
629 For other commands that change the LUKS header (e.g. \fIluksAddKey\fR),
630 specify the device or file with the LUKS header directly as the 
631 LUKS device.
632
633 If used with \fIluksFormat\fR, the \-\-align-payload option is taken
634 as absolute sector alignment on ciphertext device and can be zero.
635
636 \fBWARNING:\fR There is no check whether the ciphertext device specified
637 actually belongs to the header given. In fact you can specify an
638 arbitrary device as the ciphertext device for \fIluksOpen\fR
639 with the \-\-header option. Use with care.
640 .TP
641 .B "\-\-version"
642 Show the program version.
643 .SH RETURN CODES
644 Cryptsetup returns 0 on success and a non-zero value on error.
645
646 Error codes are: 1 wrong parameters, 2 no permission (bad passphrase),
647 3 out of memory, 4 wrong device specified, 5 device already exists
648 or device is busy.
649 .SH NOTES ON PASSPHRASE PROCESSING FOR PLAIN MODE
650 Note that no iterated hashing or salting is done in plain mode.
651 If hashing is done, it is a single direct hash. This means that
652 low-entropy passphrases are easy to attack in plain mode.
653
654 \fBFrom a terminal\fR: The passphrase is read until the
655 first newline, i.e. '\\n'.
656 The input without the newline character is processed with
657 the default hash or the hash specified with \-\-hash.
658 The has result will be truncated to the key size 
659 of the used cipher, or the size specified with \-s.
660
661 \fBFrom stdin\fR: Reading will continue until a newline (or until
662 the maximum input size is reached), with the trailing newline 
663 stripped. The maximum input size is defined by the same 
664 compiled-in default as for the maximum key file size and  can 
665 be overwritten using \-\-keyfile-size option.
666
667 The data read will be hashed with the default hash
668 or the hash specified with \-\-hash.
669 The has result will be truncated to the key size
670 of the used cipher, or the size specified with \-s.
671
672 Note that if \-\-key-file=- is used for reading the key 
673 from stdin, trailing newlines are not stripped from the input. 
674
675 If "plain" is used as argument to \-\-hash, the input
676 data will not be hashed. Instead, it will be zero padded (if 
677 shorter than the key size) or truncated (if longer than the 
678 key size) and used directly as the binary key. This is useful for
679 directly specifying a binary key.
680 No warning will be given if the amount of data read from stdin is
681 less than the key size.
682
683 \fBFrom a key file\fR: It will be truncated to the 
684 key size of the used cipher or the size given by \-s
685 and directly used as binary key. 
686 if the key file is shorter than the key, cryptsetup
687 will quit with an error.
688
689 .SH NOTES ON PASSPHRASE PROCESSING FOR LUKS
690 LUKS uses PBKDF2 to protect against dictionary attacks 
691 and to give some protection to low-entropy passphrases
692 (see RFC 2898 and the cryptsetup FAQ).
693
694 \fBFrom a terminal\fR: The passphrase is read until the
695 first newline and then processed by PBKDF2 without 
696 the newline character.
697
698 \fBFrom stdin\fR:
699 LUKS will read passphrases from stdin up to the 
700 first newline character or the compiled-in
701 maximum key file length. If \-\-keyfile-size is 
702 given, it is ignored. 
703
704 \fBFrom key file\fR:
705 The complete keyfile is read up to the compiled-in
706 maximum size. Newline characters do not terminate the
707 input. The \-\-keyfile-size option can be used to limit
708 what is read.
709
710 \fBPassphrase processing\fR:
711 Whenever a passphrase is added to a LUKS header (luksAddKey, luksFormat),
712 the user may specify how much the time the passphrase processing
713 should consume. The time is used to determine the iteration count 
714 for PBKDF2 and higher times will offer better protection for
715 low-entropy passphrases, but luksOpen will take longer to 
716 complete. For passphrases that have entropy higher than the
717 used key length, higher iteration times will not increase security.
718
719 The default setting of one second is sufficient for most
720 practical cases. The only exception is a low-entropy
721 passphrase used on a slow device.
722 .SH INCOHERENT BEHAVIOR FOR INVALID PASSPHRASES/KEYS
723 LUKS checks for a valid passphrase when an encrypted partition
724 is unlocked. The behavior of plain dm-crypt is different.
725 It will always decrypt with the passphrase given. If the
726 given passphrase is wrong, the device mapped by plain
727 dm-crypt will essentially still contain encrypted data and 
728 will be unreadable.
729 .SH NOTES ON SUPPORTED CIPHERS, MODES, HASHES AND KEY SIZES
730 The available combinations of ciphers, modes, hashes and key sizes
731 depend on kernel support. See /proc/crypto for a list of available
732 options. You might need to load additional kernel crypto modules
733 in order to get more options.
734
735 For the \-\-hash option, if the crypto backend is libgcrypt, 
736 then all algorithms supported by the gcrypt library are available.
737 For other crypto backends some algorithms may be missing.
738 .SH NOTES ON PASSPHRASES
739 Mathematics can't be bribed. Make sure you keep your passphrases safe.
740 There are a few nice tricks for constructing a fallback, when suddenly
741 out of the blue, your brain refuses to cooperate.
742 These fallbacks need LUKS, as it's only possible with LUKS
743 to have multiple passphrases. Still, if your attacker model does
744 not prevent it, storing your passphrase in a sealed envelope somewhere 
745 may be a good idea as well.
746 .SH NOTES ON RANDOM NUMBER GENERATORS
747 Random Number Generators (RNG) used in cryptsetup are always the 
748 kernel RNGs without any modifications or additions to data stream 
749 produced.
750
751 There are two types of randomness cryptsetup/LUKS needs. One type 
752 (which always uses /dev/urandom) is used for salts, the AF splitter 
753 and for wiping deleted keyslots.
754
755 The second type is used for the volume (master) key. You can switch 
756 between using /dev/random and /dev/urandom  here, see 
757 \fP\-\-use-random\fR and \fP\-\-use-urandom\fR
758 options. Using /dev/random on a system without enough entropy sources
759 can cause \fPluksFormat\fR to block until the requested amount of 
760 random data is gathered. In a low-entropy situation (embedded system),
761 this can take a very long time and potentially forever. At the same
762 time, using /dev/urandom in a low-entropy situation will 
763 produce low-quality keys. This is a serious problem, but solving
764 it is out of scope for a mere man-page.
765 See \fPurandom(4)\fR for more information.
766 .SH NOTES ON LOOPBACK DEVICE USE
767 Cryptsetup is usually used directly on a block device (disk 
768 partition or LVM volume). However, if the device argument is a 
769 file, cryptsetup tries to allocate a loopback device
770 and map it into this file. This mode requires Linux kernel 2.6.25 
771 or more recent which supports the loop autoclear flag (loop device is 
772 cleared on last close automatically). Of course, you can
773 always map a file to a loop-device manually. See the 
774 cryptsetup FAQ for an example.
775
776 When device mapping is active, you can see the loop backing file in 
777 the status command output. Also see losetup(8).
778 .SH DEPRECATED ACTIONS
779 .PP
780 The \fIreload\fR action is no longer supported.
781 Please use \fIdmsetup(8)\fR if you need to
782 directly manipulate with the device mapping table.
783 .PP
784 The \fIluksDelKey\fR was replaced with \fIluksKillSlot\fR.
785 .PP
786 .SH REPORTING BUGS
787 Report bugs, including ones in the documentation, on
788 the cryptsetup mailing list at <dm-crypt@saout.de> 
789 or in the 'Issues' section on LUKS website.
790 Please attach the output of the failed command with the 
791 \-\-debug option added.
792 .SH AUTHORS
793 cryptsetup originally written by Christophe Saout <christophe@saout.de>
794 .br
795 The LUKS extensions and original man page were written by 
796 Clemens Fruhwirth <clemens@endorphin.org>.
797 .br
798 Man page extensions by Milan Broz <gmazyland@gmail.com>.
799 .br
800 Man page rewrite and extension by Arno Wagner <arno@wagner.name>. 
801 .SH COPYRIGHT
802 Copyright \(co 2004 Christophe Saout
803 .br
804 Copyright \(co 2004-2006 Clemens Fruhwirth
805 .br
806 Copyright \(co 2009-2011 Red Hat, Inc.
807 .br
808 Copyright \(co 2012 Arno Wagner
809
810 This is free software; see the source for copying conditions.  There is NO
811 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
812 .SH SEE ALSO
813 The LUKS website at \fBhttp://code.google.com/p/cryptsetup/\fR
814
815 The cryptsetup FAQ, contained in the distribution package and
816 online at 
817 \fBhttp://code.google.com/p/cryptsetup/wiki/FrequentlyAskedQuestions\fR
818
819 The cryptsetup mailing list and list archive, see FAQ entry 1.6.
820
821 The LUKS on-disk format specification available at
822 \fBhttp://code.google.com/p/cryptsetup/wiki/Specification\fR