bc3fff61fadbb2c15d4b53ae958163e5cfedaf68
[platform/upstream/cryptsetup.git] / man / cryptsetup.8
1 .TH CRYPTSETUP "8" "January 2019" "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
14 In addition, cryptsetup provides limited support for the use of
15 loop-AES volumes, TrueCrypt, VeraCrypt and BitLocker compatible volumes.
16
17 .SH PLAIN DM-CRYPT OR LUKS?
18 .PP
19 Unless you understand the cryptographic background well, use LUKS.
20 With plain dm-crypt there are a number of possible user errors
21 that massively decrease security. While LUKS cannot fix them
22 all, it can lessen the impact for many of them.
23 .SH WARNINGS
24 .PP
25 A lot of good information on the risks of using encrypted storage,
26 on handling problems and on security aspects can be found in the
27 \fICryptsetup FAQ\fR. Read it. Nonetheless, some risks deserve
28 to be mentioned here.
29
30 \fBBackup:\fR Storage media die. Encryption has no influence on that.
31 Backup is mandatory for encrypted data as well, if the data has any
32 worth. See the Cryptsetup FAQ for advice on how to do a backup of an
33 encrypted volume.
34
35 \fBCharacter encoding:\fR If you enter a
36 passphrase with special symbols, the passphrase can change
37 depending on character encoding. Keyboard settings can also change,
38 which can make blind input hard or impossible. For
39 example, switching from some ASCII 8-bit variant to UTF-8
40 can lead to a different binary encoding and hence different
41 passphrase seen by cryptsetup, even if what you see on
42 the terminal is exactly the same. It is therefore highly
43 recommended to select passphrase characters only from 7-bit
44 ASCII, as the encoding for 7-bit ASCII stays the same for
45 all ASCII variants and UTF-8.
46
47 \fBLUKS header:\fR If the header of a LUKS volume gets damaged,
48 all data is permanently lost unless you have a header-backup.
49 If a key-slot is damaged, it can only be restored from a header-backup
50 or if another active key-slot with known passphrase is undamaged.
51 Damaging the LUKS header is something people manage to do with
52 surprising frequency. This risk is the result of a trade-off
53 between security and safety, as LUKS is designed for fast and
54 secure wiping by just overwriting header and key-slot area.
55
56 \fBPreviously used partitions:\fR If a partition was previously used,
57 it is a very good idea to wipe filesystem signatures, data, etc. before
58 creating a LUKS or plain dm-crypt container on it.
59 For a quick removal of filesystem signatures, use "wipefs". Take care
60 though that this may not remove everything. In particular, MD RAID
61 signatures at the end of a device may survive. It also does not
62 remove data. For a full wipe, overwrite the whole partition before
63 container creation. If you do not know how to do that, the
64 cryptsetup FAQ describes several options.
65
66 .SH BASIC COMMANDS
67 The following are valid actions for all supported device types.
68
69 \fIopen\fR <device> <name> \-\-type <device_type>
70 .IP
71 Opens (creates a mapping with) <name> backed by device <device>.
72
73 Device type can be \fIplain\fR, \fIluks\fR (default), \fIluks1\fR, \fIluks2\fR,
74 \fIloopaes\fR or \fItcrypt\fR.
75
76 For backward compatibility there are \fBopen\fR command aliases:
77
78 \fBcreate\fR (argument-order <name> <device>): open \-\-type plain
79 .br
80 \fBplainOpen\fR: open \-\-type plain
81 .br
82 \fBluksOpen\fR: open \-\-type luks
83 .br
84 \fBloopaesOpen\fR: open \-\-type loopaes
85 .br
86 \fBtcryptOpen\fR: open \-\-type tcrypt
87 .br
88 \fBbitlkOpen\fR: open \-\-type bitlk
89
90 \fB<options>\fR are type specific and are described below
91 for individual device types. For \fBcreate\fR, the order of the <name>
92 and <device> options is inverted for historical reasons, all other
93 aliases use the standard \fB<device> <name>\fR order.
94 .PP
95 \fIclose\fR <name>
96 .IP
97 Removes the existing mapping <name> and wipes the key from kernel memory.
98
99 For backward compatibility there are \fBclose\fR command aliases:
100 \fBremove\fR, \fBplainClose\fR, \fBluksClose\fR, \fBloopaesClose\fR,
101 \fBtcryptClose\fR (all behaves exactly the same, device type is
102 determined automatically from active device).
103
104 \fB<options>\fR can be [\-\-deferred]
105
106 .PP
107 \fIstatus\fR <name>
108 .IP
109 Reports the status for the mapping <name>.
110 .PP
111 \fIresize\fR <name>
112 .IP
113 Resizes an active mapping <name>.
114
115 If \-\-size (in 512-bytes sectors) or \-\-device\-size are not specified,
116 the size is computed from the underlying device. For LUKS it is the size
117 of the underlying device without the area reserved for LUKS header
118 (see data payload offset in \fBluksDump\fR command).
119 For plain crypt device, the whole device size is used.
120
121 Note that this does not change the raw device geometry, it just
122 changes how many sectors of the raw device are represented
123 in the mapped device.
124
125 If cryptsetup detected volume key for active device loaded in kernel keyring
126 service, resize action would first try to retrieve
127 the key using a token and only if it failed it'd ask for a passphrase
128 to unlock a keyslot (LUKS) or to derive a volume key again (plain mode).
129 The kernel keyring is used by default for LUKS2 devices.
130
131 With LUKS2 device additional \fB<options>\fR can be [\-\-token\-id, \-\-token\-only,
132 \-\-key\-slot, \-\-key\-file, \-\-keyfile\-size, \-\-keyfile\-offset, \-\-timeout,
133 \-\-disable\-locks, \-\-disable\-keyring].
134
135 .PP
136 \fIrefresh\fR <name>
137 .IP
138 Refreshes parameters of active mapping <name>.
139
140 Updates parameters of active device <name> without need to deactivate the device
141 (and umount filesystem). Currently it supports parameters refresh on following
142 devices: LUKS1, LUKS2 (including authenticated encryption), plain crypt
143 and loopaes.
144
145 Mandatory parametrs are identical to those of an open action for respective
146 device type.
147
148 You may change following parameters on all devices \-\-perf\-same_cpu_crypt,
149 \-\-perf\-submit_from_crypt_cpus and \-\-allow\-discards.
150
151 Refreshing device without any optional parameter will refresh the device
152 with default setting (respective to device type).
153
154 \fBLUKS2 only:\fR
155
156 \-\-integrity\-no\-journal parameter affects only LUKS2 devices with
157 underlying dm-integrity device.
158
159 Adding option \-\-persistent stores any combination of device parameters
160 above in LUKS2 metadata (only after successful refresh operation).
161
162 \-\-disable\-keyring parameter refreshes a device with volume key passed
163 in dm-crypt driver.
164
165 .PP
166 \fIreencrypt\fR <device> or --active-name <name> [<new_name>]
167 .IP
168 Run resilient reencryption (LUKS2 device only).
169
170 There are 3 basic modes of operation:
171
172 \(bu device reencryption (\fIreencrypt\fR)
173
174 \(bu device encryption (\fIreencrypt\fR \-\-encrypt)
175
176 \(bu device decryption (\fIreencrypt\fR \-\-decrypt)
177
178 <device> or --active-name <name> is mandatory parameter.
179
180 With <device> parameter cryptsetup looks up active <device> dm mapping.
181 If no active mapping is detected, it starts offline reencryption otherwise online
182 reencryption takes place.
183
184 Reencryption process may be safely interrupted by a user via SIGTERM signal (ctrl+c).
185
186 To resume already initialized or interrupted reencryption, just run the cryptsetup
187 \fIreencrypt\fR command again to continue the reencryption operation.
188 Reencryption may be resumed with different \-\-resilience or \-\-hotzone\-size unless
189 implicit datashift resilience mode is used (reencrypt \-\-encrypt with \-\-reduce-device-size
190 option).
191
192 If the reencryption process was interrupted abruptly (reencryption process crash, system crash, poweroff)
193 it may require recovery. The recovery is currently run automatically on next activation (action \fIopen\fR)
194 when needed.
195
196 Optional parameter <new_name> takes effect only with \-\-encrypt option and it activates device <new_name>
197 immediately after encryption initialization gets finished. That's useful when device needs to be ready
198 as soon as possible and mounted (used) before full data area encryption is completed.
199
200 Action supports following additional \fB<options>\fR [\-\-encrypt, \-\-decrypt, \-\-device\-size,
201 \-\-resilience, \-\-resilience-hash, \-\-hotzone-size, \-\-init\-only, \-\-resume\-only,
202 \-\-reduce\-device\-size].
203
204 .SH PLAIN MODE
205 Plain dm-crypt encrypts the device sector-by-sector with a
206 single, non-salted hash of the passphrase. No checks
207 are performed, no metadata is used. There is no formatting operation.
208 When the raw device is mapped (opened), the usual device operations
209 can be used on the mapped device, including filesystem creation.
210 Mapped devices usually reside in /dev/mapper/<name>.
211
212 The following are valid plain device type actions:
213
214 \fIopen\fR \-\-type plain <device> <name>
215 .br
216 \fIcreate\fR <name> <device> (\fBOBSOLETE syntax\fR)
217 .IP
218 Opens (creates a mapping with) <name> backed by device <device>.
219
220 \fB<options>\fR can be [\-\-hash, \-\-cipher, \-\-verify-passphrase,
221 \-\-sector\-size, \-\-key-file, \-\-keyfile-offset, \-\-key-size,
222 \-\-offset, \-\-skip, \-\-size, \-\-readonly, \-\-shared, \-\-allow\-discards,
223 \-\-refresh]
224
225 Example: 'cryptsetup open \-\-type plain /dev/sda10 e1' maps the raw
226 encrypted device /dev/sda10 to the mapped (decrypted) device
227 /dev/mapper/e1, which can then be mounted, fsck-ed or have a
228 filesystem created on it.
229 .SH LUKS EXTENSION
230 LUKS, the Linux Unified Key Setup, is a standard for disk encryption.
231 It adds a standardized header at the start of the device,
232 a key-slot area directly behind the header and the bulk
233 data area behind that. The whole set is called a 'LUKS container'.
234 The device that a LUKS container resides on is called a 'LUKS device'.
235 For most purposes, both terms can be used interchangeably. But
236 note that when the LUKS header is at a nonzero offset
237 in a device, then the device is not a LUKS device anymore, but
238 has a LUKS container stored in it at an offset.
239
240 LUKS can manage multiple passphrases that can be individually revoked
241 or changed and that can be securely scrubbed from persistent
242 media due to the use of anti-forensic stripes. Passphrases
243 are protected against brute-force and dictionary
244 attacks by PBKDF2, which implements hash iteration and salting
245 in one function.
246
247 LUKS2 is a new version of header format that allows additional
248 extensions like different PBKDF algorithm or authenticated encryption.
249 You can format device with LUKS2 header if you specify
250 \fI\-\-type luks2\fR in \fIluksFormat\fR command.
251 For activation, the format is already recognized automatically.
252
253 Each passphrase, also called a
254 .B key
255 in this document, is associated with one of 8 key-slots.
256 Key operations that do not specify a slot affect the first slot
257 that matches the supplied passphrase or the first empty slot if
258 a new passphrase is added.
259
260 The \fB<device>\fR parameter can also be specified by a LUKS UUID in the
261 format UUID=<uuid>. Translation to real device name uses symlinks
262 in /dev/disk/by-uuid directory.
263
264 To specify a detached header, the \fB\-\-header\fR parameter can be used
265 in all LUKS commands and always takes precedence over the positional
266 \fB<device>\fR parameter.
267
268 The following are valid LUKS actions:
269
270 \fIluksFormat\fR <device> [<key file>]
271 .IP
272 Initializes a LUKS partition and sets the initial passphrase
273 (for key-slot 0),
274 either via prompting or via <key file>. Note that
275 if the second argument is present, then the passphrase
276 is taken from the file given there, without the need
277 to use the \-\-key-file option. Also note that for both forms
278 of reading the passphrase from a file you can
279 give '-' as file name, which results in the passphrase being read
280 from stdin and the safety-question being skipped.
281
282 You can only call luksFormat on a LUKS device that is not mapped.
283
284 To use LUKS2, specify \fI\-\-type luks2\fR.
285
286 \fB<options>\fR can be [\-\-hash, \-\-cipher, \-\-verify\-passphrase,
287 \-\-key\-size, \-\-key\-slot,
288 \-\-key\-file (takes precedence over optional second argument),
289 \-\-keyfile\-offset, \-\-keyfile\-size, \-\-use\-random | \-\-use\-urandom,
290 \-\-uuid, \-\-master\-key\-file, \-\-iter\-time, \-\-header,
291 \-\-pbkdf\-force\-iterations,
292 \-\-force\-password, \-\-disable-locks].
293
294 For LUKS2, additional \fB<options>\fR can be
295 [\-\-integrity, \-\-integrity\-no\-wipe, \-\-sector\-size,
296 \-\-label, \-\-subsystem,
297 \-\-pbkdf, \-\-pbkdf\-memory, \-\-pbkdf\-parallel,
298 \-\-disable\-locks, \-\-disable\-keyring,
299 \-\-luks2\-metadata\-size, \-\-luks2\-keyslots\-size,
300 \-\-keyslot\-cipher, \-\-keyslot\-key\-size].
301
302 \fBWARNING:\fR Doing a luksFormat on an existing LUKS container will
303 make all data the old container permanently irretrievable unless
304 you have a header backup.
305 .PP
306 \fIopen\fR \-\-type luks <device> <name>
307 .br
308 \fIluksOpen\fR <device> <name> (\fBold syntax\fR)
309 .IP
310 Opens the LUKS device <device> and sets up a mapping <name> after
311 successful verification of the supplied passphrase.
312
313 First, the passphrase is searched in LUKS tokens. If it's not
314 found in any token and also the passphrase is not supplied via \-\-key-file,
315 the command prompts for it interactively.
316
317 \fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-offset,
318 \-\-keyfile\-size, \-\-readonly, \-\-test\-passphrase,
319 \-\-allow\-discards, \-\-header, \-\-key-slot, \-\-master\-key\-file, \-\-token\-id,
320 \-\-token\-only, \-\-disable\-keyring, \-\-disable\-locks, \-\-type, \-\-refresh,
321 \-\-serialize\-memory\-hard\-pbkdf].
322 .PP
323 \fIluksSuspend\fR <name>
324 .IP
325 Suspends an active device (all IO operations will block
326 and accesses to the device will wait indefinitely)
327 and wipes the encryption
328 key from kernel memory. Needs kernel 2.6.19 or later.
329
330 After this operation you have to use \fIluksResume\fR to reinstate
331 the encryption key and unblock the device or \fIclose\fR to remove
332 the mapped device.
333
334 \fBWARNING:\fR never suspend the device on which the cryptsetup binary resides.
335
336 \fB<options>\fR can be [\-\-header, \-\-disable\-locks].
337 .PP
338 \fIluksResume\fR <name>
339 .IP
340 Resumes a suspended device and reinstates the encryption key.
341 Prompts interactively for a passphrase if \-\-key-file is not given.
342
343 \fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-size, \-\-header,
344 \-\-disable\-keyring, \-\-disable\-locks, \-\-type]
345 .PP
346 \fIluksAddKey\fR <device> [<key file with new key>]
347 .IP
348 Adds a new passphrase. An existing passphrase must be supplied
349 interactively or via \-\-key-file.
350 The new passphrase to be added can be specified interactively
351 or read from the file given as positional argument.
352
353 \fBNOTE:\fR with \-\-unbound option the action creates new unbound
354 LUKS2 keyslot. The keyslot cannot be used for device activation.
355 If you don't pass new key via \-\-master\-key\-file option,
356 new random key is generated. Existing passphrase for any active keyslot
357 is not required.
358
359 \fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-offset,
360 \-\-keyfile\-size, \-\-new\-keyfile\-offset,
361 \-\-new\-keyfile\-size, \-\-key\-slot, \-\-master\-key\-file,
362 \-\-force\-password, \-\-header, \-\-disable\-locks,
363 \-\-iter-time, \-\-pbkdf, \-\-pbkdf\-force\-iterations,
364 \-\-unbound, \-\-type, \-\-keyslot\-cipher, \-\-keyslot\-key\-size].
365 .PP
366 \fIluksRemoveKey\fR <device> [<key file with passphrase to be removed>]
367 .IP
368 Removes the supplied passphrase from the LUKS device. The
369 passphrase to be removed can be specified interactively,
370 as the positional argument or via \-\-key-file.
371
372 \fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-offset,
373 \-\-keyfile\-size, \-\-header, \-\-disable\-locks, \-\-type]
374
375 \fBWARNING:\fR If you read the passphrase from stdin
376 (without further argument or with '-' as an argument
377 to \-\-key\-file), batch-mode (\-q) will be implicitly
378 switched on and no warning will be given when you remove the
379 last remaining passphrase from a LUKS container. Removing
380 the last passphrase makes the LUKS container permanently
381 inaccessible.
382 .PP
383 \fIluksChangeKey\fR <device> [<new key file>]
384 .IP
385 Changes an existing passphrase. The passphrase
386 to be changed must be supplied interactively or via \-\-key\-file.
387 The new passphrase can be supplied interactively or in
388 a file given as positional argument.
389
390 If a key-slot is specified (via \-\-key-slot), the passphrase
391 for that key-slot must be given and the new passphrase
392 will overwrite the specified key-slot. If no key-slot
393 is specified and there is still a free key-slot, then
394 the new passphrase will be put into a free key-slot before the
395 key-slot containing the old passphrase is purged. If there is
396 no free key-slot, then the key-slot with the old passphrase is
397 overwritten directly.
398
399 \fBWARNING:\fR If a key-slot is overwritten, a media failure
400 during this operation can cause the overwrite to fail after
401 the old passphrase has been wiped and make the LUKS container
402 inaccessible.
403
404 \fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-offset,
405 \-\-keyfile\-size, \-\-new\-keyfile\-offset,
406 \-\-iter-time, \-\-pbkdf, \-\-pbkdf\-force\-iterations,
407 \-\-new\-keyfile\-size, \-\-key\-slot, \-\-force\-password, \-\-header,
408 \-\-disable\-locks, \-\-type, \-\-keyslot\-cipher, \-\-keyslot\-key\-size].
409 .PP
410 .PP
411 \fIluksConvertKey\fR <device>
412 .IP
413 Converts an existing LUKS2 keyslot to new pbkdf parameters. The
414 passphrase for keyslot to be converted must be supplied interactively
415 or via \-\-key\-file. If no \-\-pbkdf parameters are specified LUKS2
416 default pbkdf values will apply.
417
418 If a keyslot is specified (via \-\-key\-slot), the passphrase for that
419 keyslot must be given. If no keyslot is specified and there is still
420 a free keyslot, then the new parameters will be put into a free
421 keyslot before the keyslot containing the old parameters is
422 purged. If there is no free keyslot, then the keyslot with the old
423 parameters is overwritten directly.
424
425 \fBWARNING:\fR If a keyslot is overwritten, a media failure during
426 this operation can cause the overwrite to fail after the old
427 parameters have been wiped and make the LUKS container inaccessible.
428
429 \fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-offset,
430 \-\-keyfile\-size, \-\-key\-slot, \-\-header, \-\-disable\-locks,
431 \-\-iter-time, \-\-pbkdf, \-\-pbkdf\-force\-iterations,
432 \-\-pbkdf\-memory, \-\-pbkdf\-parallel,
433 \-\-keyslot\-cipher, \-\-keyslot\-key\-size].
434 .PP
435 \fIluksKillSlot\fR <device> <key slot number>
436 .IP
437 Wipe the key-slot number <key slot> from the LUKS device. Except running
438 in batch-mode (\-q) a remaining passphrase must be supplied,
439 either interactively or via \-\-key-file.
440 This command can remove the last remaining key-slot, but requires
441 an interactive confirmation when doing so. Removing the last
442 passphrase makes a LUKS container permanently inaccessible.
443
444 \fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-offset,
445 \-\-keyfile\-size, \-\-header, \-\-disable\-locks, \-\-type].
446
447 \fBWARNING:\fR If you read the passphrase from stdin
448 (without further argument or with '-' as an argument
449 to \-\-key-file), batch-mode (\-q) will be implicitly
450 switched on and no warning will be given when you remove the
451 last remaining passphrase from a LUKS container. Removing
452 the last passphrase makes the LUKS container permanently
453 inaccessible.
454
455 \fBNOTE:\fR If there is no passphrase provided (on stdin or through
456 \-\-key-file argument) and batch-mode (\-q) is active, the
457 key-slot is removed without any other warning.
458
459 .PP
460 \fIerase\fR <device>
461 .br
462 \fIluksErase\fR <device>
463 .IP
464 Erase all keyslots and make the LUKS container permanently inaccessible.
465 You do not need to provide any password for this operation.
466
467 \fBWARNING:\fR This operation is irreversible.
468 .PP
469 \fIluksUUID\fR <device>
470 .IP
471 Print the UUID of a LUKS device.
472 .br
473 Set new UUID if \fI\-\-uuid\fR option is specified.
474 .PP
475 \fIisLuks\fR <device>
476 .IP
477 Returns true, if <device> is a LUKS device, false otherwise.
478 Use option \-v to get human-readable feedback. 'Command successful.'
479 means the device is a LUKS device.
480
481 By specifying \-\-type you may query for specific LUKS version.
482 .PP
483 \fIluksDump\fR <device>
484 .IP
485 Dump the header information of a LUKS device.
486
487 If the \-\-dump\-master\-key option is used, the LUKS device master key is
488 dumped instead of the keyslot info. Together with \-\-master\-key\-file option,
489 master key is dumped to a file instead of standard output. Beware that the
490 master key cannot be changed without reencryption and can be used to decrypt
491 the data stored in the LUKS container without a passphrase and even without the
492 LUKS header. This means that if the master key is compromised, the whole device
493 has to be erased or reencrypted to prevent further access. Use this option carefully.
494
495 To dump the master key, a passphrase has to be supplied,
496 either interactively or via \-\-key\-file.
497
498 To dump unbound key (LUKS2 format only), \-\-unbound parameter, specific \-\-key-slot
499 id and proper passphrase has to be supplied, either interactively or via \-\-key\-file.
500 Optional \-\-master\-key\-file parameter enables unbound keyslot dump to a file.
501
502 \fB<options>\fR can be [\-\-dump\-master\-key, \-\-key\-file,
503 \-\-keyfile\-offset, \-\-keyfile\-size, \-\-header, \-\-disable\-locks,
504 \-\-master\-key\-file, \-\-type, \-\-unbound, \-\-key-slot].
505
506 \fBWARNING:\fR If \-\-dump\-master\-key is used with \-\-key\-file
507 and the argument to \-\-key\-file is '-', no validation question
508 will be asked and no warning given.
509 .PP
510 \fIluksHeaderBackup\fR <device> \-\-header\-backup\-file <file>
511 .IP
512 Stores a binary backup of the LUKS header and keyslot area.
513 .br
514 Note: Using '-' as filename writes the header backup to a file named '-'.
515
516 \fBWARNING:\fR This backup file and a passphrase valid
517 at the time of backup allows decryption of the
518 LUKS data area, even if the passphrase was later changed or
519 removed from the LUKS device. Also note that with a header
520 backup you lose the ability to securely wipe the LUKS
521 device by just overwriting the header and key-slots. You
522 either need to securely erase all header backups in
523 addition or overwrite the encrypted data area as well.
524 The second option is less secure, as some sectors
525 can survive, e.g. due to defect management.
526 .PP
527 \fIluksHeaderRestore\fR <device> \-\-header\-backup\-file <file>
528 .IP
529 Restores a binary backup of the LUKS header and keyslot area
530 from the specified file.
531 .br
532 Note: Using '-' as filename reads the header backup from a file named '-'.
533
534 \fBWARNING:\fR Header and keyslots will be replaced, only
535 the passphrases from the backup will work afterward.
536
537 This command requires that the master key size and data offset
538 of the LUKS header already on the device and of the header backup
539 match. Alternatively, if there is no LUKS header on the device,
540 the backup will also be written to it.
541 .PP
542 \fItoken\fR <add|remove|import|export> <device>
543 .IP
544 Action \fIadd\fR creates new keyring token to enable auto-activation of the device.
545 For the auto-activation, the passphrase must be stored in keyring with the specified
546 description. Usually, the passphrase should be stored in \fIuser\fR or
547 \fIuser-session\fR keyring.
548 The \fItoken\fR command is supported only for LUKS2.
549
550 For adding new keyring token, option \-\-key\-description is mandatory.
551 Also, new token is assigned to key slot specified with \-\-key\-slot option or to all
552 active key slots in the case \-\-key\-slot option is omitted.
553
554 To remove existing token, specify the token ID which should be removed with
555 \-\-token\-id option.
556
557 \fBWARNING:\fR The action \fItoken remove\fR removes any token type, not just \fIkeyring\fR
558 type from token slot specified by \-\-token\-id option.
559
560 Action \fIimport\fR can store arbitrary valid token json in LUKS2 header. It may be passed via
561 standard input or via file passed in \-\-json\-file option. If you specify \-\-key\-slot then
562 successfully imported token is also assigned to the key slot.
563
564 Action \fIexport\fR writes requested token json to a file passed with \-\-json\-file or
565 to standard output.
566
567 \fB<options>\fR can be [\-\-header, \-\-token\-id, \-\-key\-slot, \-\-key\-description,
568 \-\-disable\-locks, \-\-disable\-keyring, \-\-json\-file].
569 .PP
570 \fIconvert\fR <device> \-\-type <format>
571 .IP
572 Converts the device between LUKS1 and LUKS2 format (if possible).
573 The conversion will not be performed if there is an additional LUKS2 feature or LUKS1 has
574 unsupported header size.
575
576 Conversion (both directions) must be performed on inactive device. There must not be active
577 dm-crypt mapping established for LUKS header requested for conversion.
578
579 \fB\-\-type\fR option is mandatory with following accepted values: \fIluks1\fR or \fIluks2\fR.
580
581 \fBWARNING:\fR The \fIconvert\fR action can destroy the LUKS header in the case of a crash
582 during conversion or if a media error occurs.
583 Always create a header backup before performing this operation!
584
585 \fB<options>\fR can be [\-\-header, \-\-type].
586 .PP
587 \fIconfig\fR <device>
588 .IP
589 Set permanent configuration options (store to LUKS header).
590 The \fIconfig\fR command is supported only for LUKS2.
591
592 The permanent options can be \fI\-\-priority\fR to set priority (normal, prefer, ignore)
593 for keyslot (specified by \fI\-\-key\-slot\fR) or \fI\-\-label\fR and \fI\-\-subsystem\fR.
594
595 \fB<options>\fR can be [\-\-priority, \-\-label, \-\-subsystem, \-\-key\-slot, \-\-header].
596
597 .SH loop-AES EXTENSION
598 cryptsetup supports mapping loop-AES encrypted partition using
599 a compatibility mode.
600 .PP
601 \fIopen\fR \-\-type loopaes <device> <name> \-\-key\-file <keyfile>
602 .br
603 \fIloopaesOpen\fR <device> <name> \-\-key\-file <keyfile>  (\fBold syntax\fR)
604 .IP
605 Opens the loop-AES <device> and sets up a mapping <name>.
606
607 If the key file is encrypted with GnuPG, then you have to use
608 \-\-key\-file=\- and decrypt it before use, e.g. like this:
609 .br
610 gpg \-\-decrypt <keyfile> | cryptsetup loopaesOpen \-\-key\-file=\-
611 <device> <name>
612
613 \fBWARNING:\fR The loop-AES extension cannot use the direct input of key file
614 on real terminal because the keys are separated by end-of-line and only part
615 of the multi-key file would be read.
616 .br
617 If you need it in script, just use the pipe redirection:
618 .br
619 echo $keyfile | cryptsetup loopaesOpen \-\-key\-file=\- <device> <name>
620
621 Use \fB\-\-keyfile\-size\fR to specify the proper key length if needed.
622
623 Use \fB\-\-offset\fR to specify device offset. Note that the units
624 need to be specified in number of 512 byte sectors.
625
626 Use \fB\-\-skip\fR to specify the IV offset. If the original device
627 used an offset and but did not use it in IV sector calculations,
628 you have to explicitly use \fB\-\-skip 0\fR in addition to the offset
629 parameter.
630
631 Use \fB\-\-hash\fR to override the default hash function for
632 passphrase hashing (otherwise it is detected according to key
633 size).
634
635 \fB<options>\fR can be [\-\-key\-file, \-\-key\-size, \-\-offset, \-\-skip,
636 \-\-hash, \-\-readonly, \-\-allow\-discards, \-\-refresh].
637 .PP
638 See also section 7 of the FAQ and \fBhttp://loop-aes.sourceforge.net\fR
639 for more information regarding loop-AES.
640 .SH TCRYPT (TrueCrypt-compatible and VeraCrypt) EXTENSION
641 cryptsetup supports mapping of TrueCrypt, tcplay or VeraCrypt
642 (with \fB\-\-veracrypt\fR option) encrypted partition
643 using a native Linux kernel API.
644 Header formatting and TCRYPT header change is not supported, cryptsetup
645 never changes TCRYPT header on-device.
646
647 TCRYPT extension requires kernel userspace
648 crypto API to be available (introduced in Linux kernel 2.6.38).
649 If you are configuring kernel yourself, enable
650 "User-space interface for symmetric key cipher algorithms" in
651 "Cryptographic API" section (CRYPTO_USER_API_SKCIPHER .config option).
652
653 Because TCRYPT header is encrypted, you have to always provide valid
654 passphrase and keyfiles.
655
656 Cryptsetup should recognize all header variants, except legacy cipher chains
657 using LRW encryption mode with 64 bits encryption block (namely Blowfish
658 in LRW mode is not recognized, this is limitation of kernel crypto API).
659
660 To recognize a VeraCrypt device use the \fB\-\-veracrypt\fR option.
661 VeraCrypt is just extension of TrueCrypt header with increased
662 iteration count so unlocking can take quite a lot of time (in comparison
663 with TCRYPT device).
664
665 To open a VeraCrypt device with a custom Personal Iteration Multiplier (PIM)
666 value, \fBadditionally to \-\-veracrypt \fR use either the
667 \fB\-\-veracrypt\-pim=<PIM>\fR option to directly specify the PIM on the command-
668 line or use \fB\-\-veracrypt\-query\-pim\fR to be prompted for the PIM.
669
670 The PIM value affects the number of iterations applied during key derivation. Please refer to
671 \fBhttps://www.veracrypt.fr/en/Personal%20Iterations%20Multiplier%20%28PIM%29.html\fR
672 for more detailed information.
673
674 \fBNOTE:\fR Activation with \fBtcryptOpen\fR is supported only for cipher chains
675 using LRW or XTS encryption modes.
676
677 The \fBtcryptDump\fR command should work for all recognized TCRYPT devices
678 and doesn't require superuser privilege.
679
680 To map system device (device with boot loader where the whole encrypted
681 system resides) use \fB\-\-tcrypt\-system\fR option.
682 You can use partition device as the parameter (parameter must be real partition
683 device, not an image in a file), then only this partition is mapped.
684
685 If you have the whole TCRYPT device as a file image and you want to map multiple
686 partition encrypted with system encryption, please create loopback mapping
687 with partitions first (\fBlosetup \-P\fR, see \fPlosetup(8)\fR man page for more info),
688 and use loop partition as the device parameter.
689
690 If you use the whole base device as a parameter, one device for the whole system
691 encryption is mapped. This mode is available only for backward compatibility
692 with older cryptsetup versions which mapped TCRYPT system encryption
693 using the whole device.
694
695 To use hidden header (and map hidden device, if available),
696 use \fB\-\-tcrypt\-hidden\fR option.
697
698 To explicitly use backup (secondary) header, use \fB\-\-tcrypt\-backup\fR
699 option.
700
701 \fBNOTE:\fR There is no protection for a hidden volume if
702 the outer volume is mounted. The reason is that if there
703 were any protection, it would require some metadata describing
704 what to protect in the outer volume and the hidden volume would
705 become detectable.
706
707 .PP
708 \fIopen\fR \-\-type tcrypt <device> <name>
709 .br
710 \fItcryptOpen\fR <device> <name>  (\fBold syntax\fR)
711 .IP
712 Opens the TCRYPT (a TrueCrypt-compatible) <device> and sets up
713 a mapping <name>.
714
715 \fB<options>\fR can be [\-\-key\-file, \-\-tcrypt\-hidden,
716 \-\-tcrypt\-system, \-\-tcrypt\-backup, \-\-readonly, \-\-test\-passphrase,
717 \-\-allow-discards, \-\-veracrypt, \-\-veracrypt\-pim, \-\-veracrypt\-query\-pim].
718
719 The keyfile parameter allows a combination of file content with the
720 passphrase and can be repeated. Note that using keyfiles is compatible
721 with TCRYPT and is different from LUKS keyfile logic.
722
723 \fBWARNING:\fR Option \fB\-\-allow\-discards\fR cannot be combined with
724 option \fB\-\-tcrypt\-hidden\fR. For normal mapping, it can cause
725 the \fBdestruction of hidden volume\fR (hidden volume appears as unused space
726 for outer volume so this space can be discarded).
727
728 .PP
729 \fItcryptDump\fR <device>
730 .IP
731 Dump the header information of a TCRYPT device.
732
733 If the \-\-dump\-master\-key option is used, the TCRYPT device master key
734 is dumped instead of TCRYPT header info. Beware that the master key
735 (or concatenated master keys if cipher chain is used)
736 can be used to decrypt the data stored in the TCRYPT container without
737 a passphrase.
738 This means that if the master key is compromised, the whole device has
739 to be erased to prevent further access. Use this option carefully.
740
741 \fB<options>\fR can be [\-\-dump\-master\-key, \-\-key\-file,
742 \-\-tcrypt\-hidden, \-\-tcrypt\-system, \-\-tcrypt\-backup].
743
744 The keyfile parameter allows a combination of file content with the
745 passphrase and can be repeated.
746 .PP
747 See also \fBhttps://en.wikipedia.org/wiki/TrueCrypt\fR for more information regarding
748 TrueCrypt.
749
750 Please note that cryptsetup does not use TrueCrypt code, please report
751 all problems related to this compatibility extension to the cryptsetup project.
752
753 .SH BITLK (Windows BitLocker-compatible) EXTENSION (EXPERIMENTAL)
754 cryptsetup supports mapping of BitLocker and BitLocker to Go encrypted partition
755 using a native Linux kernel API.
756 Header formatting and BITLK header changes are not supported, cryptsetup
757 never changes BITLK header on-device.
758
759 \fBWARNING:\fR This extension is EXPERIMENTAL.
760
761 BITLK extension requires kernel userspace crypto API to be available
762 (for details see TCRYPT section).
763
764 Cryptsetup should recognize all BITLK header variants, except legacy
765 header used in Windows Vista systems and partially decrypted BitLocker devices.
766 Activation of legacy devices encrypted in CBC mode requires at least
767 Linux kernel version 5.3 and for devices using Elephant diffuser kernel 5.6.
768
769 The \fBbitlkDump\fR command should work for all recognized BITLK devices
770 and doesn't require superuser privilege.
771
772 For unlocking with the \fBopen\fR a password or a recovery passphrase must
773 be provided. Other unlocking methods (TPM, SmartCard) are not supported.
774
775 .PP
776 \fIopen\fR \-\-type bitlk <device> <name>
777 .br
778 \fIbitlkOpen\fR <device> <name>  (\fBold syntax\fR)
779 .IP
780 Opens the BITLK (a BitLocker-compatible) <device> and sets up
781 a mapping <name>.
782
783 \fB<options>\fR can be [\-\-key\-file, \-\-readonly, \-\-test\-passphrase,
784 \-\-allow-discards].
785
786 .PP
787 \fIbitlkDump\fR <device>
788 .IP
789 Dump the header information of a BITLK device.
790
791 Please note that cryptsetup does not use any Windows BitLocker code, please report
792 all problems related to this compatibility extension to the cryptsetup project.
793 .SH MISCELLANEOUS
794 .PP
795 \fIrepair\fR <device>
796 .IP
797 Tries to repair the device metadata if possible. Currently supported only
798 for LUKS device type.
799
800 This command is useful to fix some known benign LUKS metadata
801 header corruptions. Only basic corruptions of unused keyslot
802 are fixable. This command will only change the LUKS header, not
803 any key-slot data. You may enforce LUKS version by adding \-\-type
804 option.
805
806 \fBWARNING:\fR Always create a binary backup of the original
807 header before calling this command.
808 .PP
809 \fIbenchmark\fR <options>
810 .IP
811 Benchmarks ciphers and KDF (key derivation function).
812 Without parameters, it tries to measure few common configurations.
813
814 To benchmark other ciphers or modes, you need to specify \fB\-\-cipher\fR
815 and \fB\-\-key\-size\fR options or \fB\-\-hash\fR for KDF test.
816
817 \fBNOTE:\fR This benchmark is using memory only and is only informative.
818 You cannot directly predict real storage encryption speed from it.
819
820 For testing block ciphers, this benchmark requires kernel userspace
821 crypto API to be available (introduced in Linux kernel 2.6.38).
822 If you are configuring kernel yourself, enable
823 "User-space interface for symmetric key cipher algorithms" in
824 "Cryptographic API" section (CRYPTO_USER_API_SKCIPHER .config option).
825
826 \fB<options>\fR can be [\-\-cipher, \-\-key\-size, \-\-hash].
827 .SH OPTIONS
828 .TP
829 .B "\-\-verbose, \-v"
830 Print more information on command execution.
831 .TP
832 .B "\-\-debug or \-\-debug\-json"
833 Run in debug mode with full diagnostic logs. Debug output
834 lines are always prefixed by '#'.
835 If \-\-debug\-json is used, additional LUKS2 JSON data structures are printed.
836 .TP
837 .B "\-\-type <device-type>
838 Specifies required device type, for more info
839 read \fIBASIC COMMANDS\fR section.
840 .TP
841 .B "\-\-hash, \-h \fI<hash\-spec>\fR"
842 Specifies the passphrase hash for \fIopen\fR (for plain and
843 loopaes device types).
844
845 Specifies the hash used in the LUKS key setup scheme and volume key digest
846 for \fIluksFormat\fR. The specified hash is used as hash-parameter
847 for PBKDF2 and for the AF splitter.
848
849 The specified hash name is passed to the compiled-in crypto backend.
850 Different backends may support different hashes.
851 For \fIluksFormat\fR, the hash
852 algorithm must provide at least 160 bits of output, which
853 excludes, e.g., MD5. Do not use a non-crypto hash like
854 \fB"crc32"\fR as this breaks security.
855
856 Values compatible with old version of cryptsetup are
857 \fB"ripemd160"\fR for \fIopen \-\-type plain\fR and
858 \fB"sha1"\fR for \fIluksFormat\fR.
859
860 Use \fIcryptsetup \-\-help\fR to show the defaults.
861 .TP
862 .B "\-\-cipher, \-c \fI<cipher\-spec>\fR"
863 Set the cipher specification string.
864
865 \fIcryptsetup \-\-help\fR shows the compiled-in defaults.
866 The current default in the distributed sources is
867 "aes-cbc-essiv:sha256" for plain dm-crypt and
868 "aes-xts-plain64" for LUKS.
869
870 If a hash is part of the cipher specification, then it is
871 used as part of the IV generation. For example, ESSIV
872 needs a hash function, while "plain64" does not and
873 hence none is specified.
874
875 For XTS mode you can optionally set a key size of
876 512 bits with the \-s option. Key size for XTS
877 mode is twice that for other modes for the same
878 security level.
879
880 XTS mode requires kernel 2.6.24 or later and plain64 requires
881 kernel 2.6.33 or later. More information can be found in the FAQ.
882 .TP
883 .B "\-\-verify-passphrase, \-y"
884 When interactively asking for a passphrase, ask for it twice
885 and complain if both inputs do not match. Advised when creating
886 a regular mapping for the first time, or when running
887 \fIluksFormat\fR. Ignored on input from file or stdin.
888 .TP
889 .B "\-\-key-file, \-d \fIname\fR"
890 Read the passphrase from file.
891
892 If the name given is "-", then the passphrase will be read from stdin.
893 In this case, reading will not stop at newline characters.
894
895 With LUKS, passphrases supplied via \-\-key\-file are always
896 the existing passphrases requested by a command, except in
897 the case of \fIluksFormat\fR where \-\-key\-file is equivalent
898 to the positional key file argument.
899
900 If you want to set a new passphrase via key file, you have to
901 use a positional argument to \fIluksAddKey\fR.
902
903 See section \fBNOTES ON PASSPHRASE PROCESSING\fR for more information.
904 .TP
905 .B "\-\-keyfile\-offset \fIvalue\fR"
906 Skip \fIvalue\fR bytes at the beginning of the key file.
907 Works with all commands that accept key files.
908 .TP
909 .B "\-\-keyfile\-size, \-l \fIvalue\fR"
910 Read a maximum of \fIvalue\fR bytes from the key file.
911 The default is to read the whole file up to the compiled-in
912 maximum that can be queried with \-\-help. Supplying more
913 data than the compiled-in maximum aborts the operation.
914
915 This option is useful
916 to cut trailing newlines, for example. If \-\-keyfile\-offset
917 is also given, the size count starts after the offset.
918 Works with all commands that accept key files.
919 .TP
920 .B "\-\-new\-keyfile\-offset \fIvalue\fR"
921 Skip \fIvalue\fR bytes at the start when
922 adding a new passphrase from key file with
923 \fIluksAddKey\fR.
924 .TP
925 .B "\-\-new\-keyfile\-size  \fIvalue\fR"
926 Read a maximum of \fIvalue\fR bytes when adding
927 a new passphrase from key file with \fIluksAddKey\fR.
928 The default is to read the whole file up to the compiled-in
929 maximum length that can be queried with \-\-help.
930 Supplying more than the compiled in maximum aborts the
931 operation.
932 When \-\-new\-keyfile\-offset is also given, reading starts
933 after the offset.
934 .TP
935 .B "\-\-master\-key\-file"
936 Use a master key stored in a file.
937
938 For \fIluksFormat\fR this
939 allows creating a LUKS header with this specific
940 master key. If the master key was taken from an existing
941 LUKS header and all other parameters are the same,
942 then the new header decrypts the data encrypted with the
943 header the master key was taken from.
944
945 Action \fIluksDump\fR together with \-\-dump\-master\-key
946 option: The volume (master) key is stored in a file instead of
947 being printed out to standard output.
948
949 \fBWARNING:\fR If you create your own master key, you
950 need to make sure to do it right. Otherwise, you can end
951 up with a low-entropy or otherwise partially predictable
952 master key which will compromise security.
953
954 For \fIluksAddKey\fR this allows adding a new passphrase
955 without having to know an existing one.
956
957 For \fIopen\fR this allows one to open the LUKS device
958 without giving a passphrase.
959 .TP
960 .B "\-\-dump\-master\-key"
961 For \fIluksDump\fR this option includes the master key in the displayed
962 information. Use with care, as the master key can be used to
963 bypass the passphrases, see also option \-\-master\-key\-file.
964 .TP
965 .B "\-\-json\-file"
966 Read token json from a file or write token to it. See \fItoken\fR action for more
967 information. \-\-json\-file=- reads json from standard input or writes it to
968 standard output respectively.
969 .TP
970 .B "\-\-use\-random"
971 .TP
972 .B "\-\-use\-urandom"
973 For \fIluksFormat\fR these options define which kernel random number
974 generator will be used to create the master key (which is a
975 long-term key).
976
977 See \fBNOTES ON RANDOM NUMBER GENERATORS\fR for more
978 information. Use \fIcryptsetup \-\-help\fR
979 to show the compiled-in default random number generator.
980
981 \fBWARNING:\fR In a low-entropy situation (e.g. in an
982 embedded system), both selections are problematic.
983 Using /dev/urandom can lead to weak keys.
984 Using /dev/random can block a long time, potentially
985 forever, if not enough entropy can be harvested by
986 the kernel.
987 .TP
988 .B "\-\-key\-slot, \-S <0\-7>"
989 For LUKS operations that add key material, this options allows you
990 to specify which key slot is selected for the new key.
991 This option can be used for \fIluksFormat\fR,
992 and \fIluksAddKey\fR.
993 .br
994 In addition, for \fIopen\fR, this option selects a
995 specific key-slot to compare the passphrase against.
996 If the given passphrase would only match a different key-slot,
997 the operation fails.
998 .TP
999 .B "\-\-key\-size, \-s <bits>"
1000 Sets key size in bits. The argument has to be a multiple of
1001 8. The possible key-sizes are limited by the cipher and
1002 mode used.
1003
1004 See /proc/crypto for more information. Note that key-size
1005 in /proc/crypto is stated in bytes.
1006
1007 This option can be used for \fIopen \-\-type plain\fR or \fIluksFormat\fR.
1008 All other LUKS actions will use the key-size specified in the LUKS header.
1009 Use \fIcryptsetup \-\-help\fR to show the compiled-in defaults.
1010 .TP
1011 .B "\-\-size, \-b <number of 512 byte sectors>"
1012 Set the size of the device in sectors of 512 bytes.
1013 This option is only relevant for the \fIopen\fR and \fIresize\fR
1014 actions.
1015 .TP
1016 .B "\-\-offset, \-o <number of 512 byte sectors>"
1017 Start offset in the backend device in 512-byte sectors.
1018 This option is only relevant for the \fIopen\fR action with plain
1019 or loopaes device types or for LUKS devices in \fIluksFormat\fR.
1020
1021 For LUKS, the \-\-offset option sets the data offset (payload) of data
1022 device and must be be aligned to 4096-byte sectors (must be multiple of 8).
1023 This option cannot be combined with \-\-align\-payload option.
1024 .TP
1025 .B "\-\-skip, \-p <number of 512 byte sectors>"
1026 Start offset used in IV calculation in 512-byte sectors
1027 (how many sectors of the encrypted data to skip at the beginning).
1028 This option is only relevant for the \fIopen\fR action with plain
1029 or loopaes device types.
1030
1031 Hence, if \-\-offset \fIn\fR, and \-\-skip \fIs\fR, sector \fIn\fR
1032 (the first sector of the encrypted device) will get a sector number
1033 of \fIs\fR for the IV calculation.
1034 .TP
1035 .B "\-\-device\-size \fIsize[units]\fR"
1036 Instead of real device size, use specified value.
1037
1038 With \fIreencrypt\fR action it means that only specified area
1039 (from the start of the device to the specified size) will be
1040 reencrypted.
1041
1042 With \fIresize\fR action it sets new size of the device.
1043
1044 If no unit suffix is specified, the size is in bytes.
1045
1046 Unit suffix can be S for 512 byte sectors, K/M/G/T (or KiB,MiB,GiB,TiB)
1047 for units with 1024 base or KB/MB/GB/TB for 1000 base (SI scale).
1048
1049 \fBWARNING:\fR This is destructive operation when used with reencrypt command.
1050 .TP
1051 .B "\-\-readonly, \-r"
1052 set up a read-only mapping.
1053 .TP
1054 .B "\-\-shared"
1055 Creates an additional mapping for one common
1056 ciphertext device. Arbitrary mappings are supported.
1057 This option is only relevant for the
1058 \fIopen \-\-type plain\fR action. Use \-\-offset, \-\-size and \-\-skip to
1059 specify the mapped area.
1060 .TP
1061 .B "\-\-pbkdf <PBKDF spec>"
1062 Set Password-Based Key Derivation Function (PBKDF) algorithm for LUKS keyslot.
1063 The PBKDF can be: \fIpbkdf2\fR (for PBKDF2 according to RFC2898),
1064 \fIargon2i\fR for Argon2i or \fIargon2id\fR for Argon2id
1065 (see https://www.cryptolux.org/index.php/Argon2 for more info).
1066
1067 For LUKS1, only PBKDF2 is accepted (no need to use this option).
1068 The default PBKDF2 for LUKS2 is set during compilation time
1069 and is available in \fIcryptsetup \-\-help\fR output.
1070
1071 A PBKDF is used for increasing dictionary and brute-force attack cost
1072 for keyslot passwords. The parameters can be time, memory and parallel cost.
1073
1074 For PBKDF2, only time cost (number of iterations) applies.
1075 For Argon2i/id, there is also memory cost (memory required during
1076 the process of key derivation) and parallel cost (number of threads
1077 that run in parallel during the key derivation.
1078
1079 Note that increasing memory cost also increases time, so the final
1080 parameter values are measured by a benchmark. The benchmark
1081 tries to find iteration time (\fI\-\-iter\-time\fR) with required
1082 memory cost \fI\-\-pbkdf\-memory\fR. If it is not possible,
1083 the memory cost is decreased as well.
1084 The parallel cost \fI\-\-pbkdf\-parallel\fR is constant, is is checked
1085 against available CPU cores (if not available, it is decreased) and the maximum
1086 parallel cost is 4.
1087
1088 You can see all PBKDF parameters for particular LUKS2 keyslot with
1089 \fIluksDump\fR command.
1090
1091 \fBNOTE:\fR If you do not want to use benchmark and want to specify
1092 all parameters directly, use \fI\-\-pbkdf\-force\-iterations\fR with
1093 \fI\-\-pbkdf\-memory\fR and \fI\-\-pbkdf\-parallel\fR.
1094 This will override the values without benchmarking.
1095 Note it can cause extremely long unlocking time. Use only is specified
1096 cases, for example, if you know that the formatted device will
1097 be used on some small embedded system.
1098 In this case, the LUKS PBKDF2 digest will be set to the minimum iteration count.
1099 .TP
1100 .B "\-\-iter\-time, \-i <number of milliseconds>"
1101 The number of milliseconds to spend with PBKDF passphrase processing.
1102 This option is only relevant for LUKS operations that set or change
1103 passphrases, such as \fIluksFormat\fR or \fIluksAddKey\fR.
1104 Specifying 0 as parameter selects the compiled-in default.
1105 .TP
1106 .B "\-\-pbkdf\-memory <number>"
1107 Set the memory cost for PBKDF (for Argon2i/id the number represents kilobytes).
1108 Note that it is maximal value, PBKDF benchmark or available physical memory
1109 can decrease it.
1110 This option is not available for PBKDF2.
1111 .TP
1112 .B "\-\-pbkdf\-parallel <number>"
1113 Set the parallel cost for PBKDF (number of threads, up to 4).
1114 Note that it is maximal value, it is decreased automatically if
1115 CPU online count is lower.
1116 This option is not available for PBKDF2.
1117 .TP
1118 .B "\-\-pbkdf\-force\-iterations <num>"
1119 Avoid PBKDF benchmark and set time cost (iterations) directly.
1120 It can be used for LUKS/LUKS2 device only.
1121 See \fI\-\-pbkdf\fR option for more info.
1122 .TP
1123 .B "\-\-batch\-mode, \-q"
1124 Suppresses all confirmation questions. Use with care!
1125
1126 If the \-y option is not specified, this option also switches off
1127 the passphrase verification for \fIluksFormat\fR.
1128 .TP
1129 .B "\-\-progress-frequency <seconds>"
1130 Print separate line every <seconds> with wipe progress.
1131 .TP
1132 .B "\-\-timeout, \-t <number of seconds>"
1133 The number of seconds to wait before timeout on passphrase input
1134 via terminal. It is relevant every time a passphrase is asked,
1135 for example for \fIopen\fR, \fIluksFormat\fR or \fIluksAddKey\fR.
1136 It has no effect if used in conjunction with \-\-key-file.
1137 .br
1138 This option is useful when the system
1139 should not stall if the user does not input a passphrase,
1140 e.g. during boot. The default is a value of 0 seconds,
1141 which means to wait forever.
1142 .TP
1143 .B "\-\-tries, \-T"
1144 How often the input of the passphrase shall be retried.
1145 This option is relevant
1146 every time a passphrase is asked, for example for
1147 \fIopen\fR, \fIluksFormat\fR or \fIluksAddKey\fR.
1148 The default is 3 tries.
1149 .TP
1150 .B "\-\-align\-payload <number of 512 byte sectors>"
1151 Align payload at a boundary of \fIvalue\fR 512-byte sectors.
1152 This option is relevant for \fIluksFormat\fR.
1153
1154 If not specified, cryptsetup tries to use the topology info
1155 provided by the kernel for the underlying device to get the optimal alignment.
1156 If not available (or the calculated value is a multiple of the default)
1157 data is by default aligned to a 1MiB boundary (i.e. 2048 512-byte sectors).
1158
1159 For a detached LUKS header, this option specifies the offset on the
1160 data device. See also the \-\-header option.
1161
1162 \fBWARNING:\fR This option is DEPRECATED and has often unexpected impact
1163 to the data offset and keyslot area size (for LUKS2) due to the complex rounding.
1164 For fixed data device offset use \fI\-\-offset\fR option instead.
1165
1166 .TP
1167 .B "\-\-uuid=\fIUUID\fR"
1168 Use the provided \fIUUID\fR for the \fIluksFormat\fR command
1169 instead of generating a new one. Changes the existing UUID when
1170 used with the \fIluksUUID\fR command.
1171
1172 The UUID must be provided in the standard UUID format,
1173 e.g. 12345678-1234-1234-1234-123456789abc.
1174 .TP
1175 .B "\-\-allow\-discards\fR"
1176 Allow the use of discard (TRIM) requests for the device.
1177 This option is only relevant for \fIopen\fR action.
1178 This is also not supported for LUKS2 devices with data integrity protection.
1179
1180 \fBWARNING:\fR This command can have a negative security impact
1181 because it can make filesystem-level operations visible on
1182 the physical device. For example, information leaking
1183 filesystem type, used space, etc. may be extractable from
1184 the physical device if the discarded blocks can be located
1185 later. If in doubt, do not use it.
1186
1187 A kernel version of 3.1 or later is needed. For earlier kernels,
1188 this option is ignored.
1189 .TP
1190 .B "\-\-perf\-same_cpu_crypt\fR"
1191 Perform encryption using the same cpu that IO was submitted on.
1192 The default is to use an unbound workqueue so that encryption work
1193 is automatically balanced between available CPUs.
1194 This option is only relevant for \fIopen\fR action.
1195
1196 \fBNOTE:\fR This option is available only for low-level dm-crypt
1197 performance tuning, use only if you need a change to default dm-crypt
1198 behaviour. Needs kernel 4.0 or later.
1199 .TP
1200 .B "\-\-perf\-submit_from_crypt_cpus\fR"
1201 Disable offloading writes to a separate thread after encryption.
1202 There are some situations where offloading write bios from the
1203 encryption threads to a single thread degrades performance
1204 significantly.  The default is to offload write bios to the same
1205 thread.
1206 This option is only relevant for \fIopen\fR action.
1207
1208 \fBNOTE:\fR This option is available only for low-level dm-crypt
1209 performance tuning, use only if you need a change to default dm-crypt
1210 behaviour. Needs kernel 4.0 or later.
1211 .TP
1212 .B "\-\-test\-passphrase\fR"
1213 Do not activate the device, just verify passphrase.
1214 This option is only relevant for \fIopen\fR action (the device
1215 mapping name is not mandatory if this option is used).
1216 .TP
1217 .B "\-\-header\fR <device or file storing the LUKS header>"
1218 Use a detached (separated) metadata device or file where the
1219 LUKS header is stored. This option allows one to store ciphertext
1220 and LUKS header on different devices.
1221
1222 This option is only relevant for LUKS devices and can be
1223 used with the \fIluksFormat\fR, \fIopen\fR, \fIluksSuspend\fR,
1224 \fIluksResume\fR, \fIstatus\fR and \fIresize\fR commands.
1225
1226 For \fIluksFormat\fR with a file name as the argument to \-\-header,
1227 the file will be automatically created if it does not exist.
1228 See the cryptsetup FAQ for header size calculation.
1229
1230 For other commands that change the LUKS header (e.g. \fIluksAddKey\fR),
1231 specify the device or file with the LUKS header directly as the
1232 LUKS device.
1233
1234 If used with \fIluksFormat\fR, the \-\-align\-payload option is taken
1235 as absolute sector alignment on ciphertext device and can be zero.
1236
1237 \fBWARNING:\fR There is no check whether the ciphertext device specified
1238 actually belongs to the header given. In fact, you can specify an
1239 arbitrary device as the ciphertext device for \fIopen\fR
1240 with the \-\-header option. Use with care.
1241 .TP
1242 .B "\-\-header\-backup\-file <file>"
1243 Specify file with header backup for \fIluksHeaderBackup\fR or
1244 \fIluksHeaderRestore\fR actions.
1245 .TP
1246 .B "\-\-force\-password"
1247 Do not use password quality checking for new LUKS passwords.
1248
1249 This option applies only to \fIluksFormat\fR, \fIluksAddKey\fR and
1250 \fIluksChangeKey\fR and is ignored if cryptsetup is built without
1251 password quality checking support.
1252
1253 For more info about password quality check, see the manual page
1254 for \fBpwquality.conf(5)\fR and \fBpasswdqc.conf(5)\fR.
1255 .TP
1256 .B "\-\-deferred"
1257 Defers device removal in \fIclose\fR command until the last user closes it.
1258 .TP
1259 .B "\-\-disable\-locks"
1260 Disable lock protection for metadata on disk.
1261 This option is valid only for LUKS2 and ignored for other formats.
1262
1263 \fBWARNING:\fR Do not use this option unless you run cryptsetup in
1264 a restricted environment where locking is impossible to perform
1265 (where /run directory cannot be used).
1266 .TP
1267 .B "\-\-disable\-keyring"
1268 Do not load volume key in kernel keyring and store it directly
1269 in the dm-crypt target instead.
1270 This option is supported only for the LUKS2 format.
1271 .TP
1272 .B "\-\-key\-description <text>"
1273 Set key description in keyring for use with \fItoken\fR command.
1274 .TP
1275 .B "\-\-priority <normal|prefer|ignore>"
1276 Set a priority for LUKS2 keyslot.
1277 The \fIprefer\fR priority marked slots are tried before \fInormal\fR priority.
1278 The \fIignored\fR priority means, that slot is never used, if not explicitly
1279 requested by \fI\-\-key\-slot\fR option.
1280 .TP
1281 .B "\-\-token\-id"
1282 Specify what token to use in actions \fItoken\fR, \fIopen\fR or \fIresize\fR.
1283 If omitted, all available tokens will be checked before proceeding further with
1284 passphrase prompt.
1285 .TP
1286 .B "\-\-token\-only"
1287 Do not proceed further with action (any of \fItoken\fR, \fIopen\fR or
1288 \fIresize\fR) if token activation failed. Without the option,
1289 action asks for passphrase to proceed further.
1290 .TP
1291 .B "\-\-sector\-size <bytes>"
1292 Set sector size for use with disk encryption. It must be power of two
1293 and in range 512 - 4096 bytes. The default is 512 bytes sectors.
1294 This option is available only in the LUKS2 mode.
1295
1296 Note that if sector size is higher than underlying device hardware sector
1297 and there is not integrity protection that uses data journal, using
1298 this option can increase risk on incomplete sector writes during a power fail.
1299
1300 If used together with \fI\-\-integrity\fR option and dm-integrity journal,
1301 the atomicity of writes is guaranteed in all cases (but it cost write
1302 performance - data has to be written twice).
1303
1304 Increasing sector size from 512 bytes to 4096 bytes can provide better
1305 performance on most of the modern storage devices and also with some
1306 hw encryption accelerators.
1307 .TP
1308 .B "\-\-iv-large-sectors"
1309 Count Initialization Vector (IV) in larger sector size (if set) instead
1310 of 512 bytes sectors. This option can be used only for \fIopen\fR command
1311 and \fIplain\fR encryption type.
1312
1313 \fBNOTE:\fR This option does not have any performance or security impact,
1314 use it only for accessing incompatible existing disk images from other systems
1315 that require this option.
1316 .TP
1317 .B "\-\-persistent"
1318 If used with LUKS2 devices and activation commands like \fIopen\fR or \fIrefresh\fR,
1319 the specified activation flags are persistently written into metadata
1320 and used next time automatically even for normal activation.
1321 (No need to use cryptab or other system configuration files.)
1322
1323 If you need to remove a persistent flag, use \fI\-\-persistent\fR without
1324 the flag you want to remove (e.g. to disable persistently stored discard flag,
1325 use \fI\-\-persistent\fR without \fI\-\-allow-discards\fR).
1326
1327 Only \fI\-\-allow-discards\fR, \fI\-\-perf\-same_cpu_crypt\fR,
1328 \fI\-\-perf\-submit_from_crypt_cpus\fR and \fI\-\-integrity\-no\-journal\fR
1329 can be stored persistently.
1330 .TP
1331 .B "\-\-refresh"
1332 Refreshes an active device with new set of parameters. See action \fIrefresh\fR description
1333 for more details.
1334 .TP
1335 .B "\-\-label <LABEL>"
1336 .B "\-\-subsystem <SUBSYSTEM>"
1337 Set label and subsystem description for LUKS2 device, can be used
1338 in \fIconfig\fR and \fIformat\fR actions.
1339 The label and subsystem are optional fields and can be later used in udev scripts
1340 for triggering user actions once device marked by these labels is detected.
1341 .TP
1342 .B "\-\-integrity <integrity algorithm>"
1343 Specify integrity algorithm to be used for authenticated disk encryption in LUKS2.
1344
1345 \fBWARNING: This extension is EXPERIMENTAL\fR and requires dm-integrity
1346 kernel target (available since kernel version 4.12).
1347 For native AEAD modes, also enable "User-space interface for AEAD cipher algorithms"
1348 in "Cryptographic API" section (CONFIG_CRYPTO_USER_API_AEAD .config option).
1349
1350 For more info, see \fIAUTHENTICATED DISK ENCRYPTION\fR section.
1351 .TP
1352 .B "\-\-luks2\-metadata\-size <size>"
1353 This option can be used to enlarge the LUKS2 metadata (JSON) area.
1354 The size includes 4096 bytes for binary metadata (usable JSON area is smaller
1355 of the binary area).
1356 According to LUKS2 specification, only these values are valid:
1357 16, 32, 64, 128, 256, 512, 1024, 2048 and 4096 kB
1358 The <size> can be specified with unit suffix (for example 128k).
1359 .TP
1360 .B "\-\-luks2\-keyslots\-size <size>"
1361 This option can be used to set specific size of the LUKS2 binary keyslot area
1362 (key material is encrypted there). The value must be aligned to multiple
1363 of 4096 bytes with maximum size 128MB.
1364 The <size> can be specified with unit suffix (for example 128k).
1365 .TP
1366 .B "\-\-keyslot\-cipher <cipher\-spec>"
1367 This option can be used to set specific cipher encryption for the LUKS2 keyslot area.
1368 .TP
1369 .B "\-\-keyslot\-key\-size <bits>"
1370 This option can be used to set specific key size for the LUKS2 keyslot area.
1371 .TP
1372 .B "\-\-integrity\-no\-journal"
1373 Activate device with integrity protection without using data journal (direct
1374 write of data and integrity tags).
1375 Note that without journal power fail can cause non-atomic write and data corruption.
1376 Use only if journalling is performed on a different storage layer.
1377 .TP
1378 .B "\-\-integrity\-no\-wipe"
1379 Skip wiping of device authentication (integrity) tags. If you skip this
1380 step, sectors will report invalid integrity tag until an application write
1381 to the sector.
1382
1383 \fBNOTE:\fR Even some writes to the device can fail if the write is not
1384 aligned to page size and page-cache initiates read of a sector with invalid
1385 integrity tag.
1386 .TP
1387 .B "\-\-unbound"
1388
1389 Creates new or dumps existing LUKS2 unbound keyslot. See \fIluksAddKey\fR or
1390 \fIluksDump\fR actions for more details.
1391
1392 .TP
1393 .B "\-\-tcrypt\-hidden"
1394 .B "\-\-tcrypt\-system"
1395 .B "\-\-tcrypt\-backup"
1396 Specify which TrueCrypt on-disk header will be used to open the device.
1397 See \fITCRYPT\fR section for more info.
1398 .TP
1399 .B "\-\-veracrypt"
1400 Allow VeraCrypt compatible mode. Only for TCRYPT extension.
1401 See \fITCRYPT\fR section for more info.
1402 .TP
1403 .B "\-\-veracrypt\-pim"
1404 .B "\-\-veracrypt\-query\-pim"
1405 Use a custom Personal Iteration Multiplier (PIM) for VeraCrypt device.
1406 See \fITCRYPT\fR section for more info.
1407 .TP
1408 .B "\-\-serialize\-memory\-hard\-pbkdf"
1409 Use a global lock to serialize unlocking of keyslots using memory-hard PBKDF.
1410
1411 \fBNOTE:\fR This is (ugly) workaround for a specific situation when multiple
1412 devices are activated in parallel and system instead of reporting out of memory
1413 starts unconditionally stop processes using out-of-memory killer.
1414
1415 \fBDO NOT USE\fR this switch until you are implementing boot environment
1416 with parallel devices activation!
1417 .TP
1418 .B "\-\-encrypt"
1419 Initialize (and run) device encryption (\fIreencrypt\fR action parameter)
1420 .TP
1421 .B "\-\-decrypt"
1422 Initialize (and run) device decryption (\fIreencrypt\fR action parameter)
1423 .TP
1424 .B "\-\-init\-only"
1425 Initialize reencryption (any variant) operation in LUKS2 metadata only and exit. If any
1426 reencrypt operation is already initialized in metadata, the command with \-\-init\-only
1427 parameter fails.
1428 .TP
1429 .B "\-\-resume\-only"
1430 Resume reencryption (any variant) operation already described in LUKS2 metadata. If no
1431 reencrypt operation is initialized, the command with \-\-resume\-only
1432 parameter fails. Useful for resuming reencrypt operation without accidentally triggering
1433 new reencryption operation.
1434 .TP
1435 .B "\-\-resilience <mode>"
1436 Reencryption resilience mode can be one of \fIchecksum\fR, \fIjournal\fR or \fInone\fR.
1437
1438 \fIchecksum\fR: default mode, where individual checksums of ciphertext hotzone sectors are stored,
1439 so the recovery process can detect which sectors where already reencrypted. It requires that the device sector write is atomic.
1440
1441 \fIjournal\fR: the hotzone is journaled in the binary area (so the data are written twice).
1442
1443 \fInone\fR: performance mode. There is no protection and the only way it's safe to interrupt
1444 the reencryption is similar to old offline reencryption utility. (ctrl+c).
1445
1446 The option is ignored if reencryption with datashift mode is in progress.
1447 .TP
1448 .B "\-\-resilience-hash <hash>"
1449 The hash algorithm used with "\-\-resilience checksum" only. The default hash is sha256. With other resilience modes, the hash parameter is ignored.
1450 .TP
1451 .B "\-\-hotzone-size <size>"
1452 This option can be used to set an upper limit on the size of reencryption area (hotzone).
1453 The <size> can be specified with unit suffix (for example 50M). Note that actual hotzone
1454 size may be less than specified <size> due to other limitations (free space in keyslots area or
1455 available memory).
1456 .TP
1457 .B "\-\-reduce\-device\-size <size>"
1458 Initialize LUKS2 reencryption with data device size reduction (currently only \-\-encrypt variant is supported).
1459
1460 Last <size> sectors of <device> will be used to properly initialize device reencryption. That means any
1461 data at last <size> sectors will be lost.
1462
1463 It could be useful if you added some space to underlying partition or logical volume (so last <size> sectors contains no data).
1464
1465 Recommended minimal size is twice the default LUKS2 header size (\-\-reduce\-device\-size 32M) for \-\-encrypt use case. Be sure to
1466 have enough (at least \-\-reduce\-device\-size value of free space at the end of <device>).
1467
1468 WARNING: This is a destructive operation and cannot be reverted.  Use with extreme care - accidentally overwritten filesystems are usually unrecoverable.
1469 .TP
1470 .B "\-\-version"
1471 Show the program version.
1472 .TP
1473 .B "\-\-usage"
1474 Show short option help.
1475 .TP
1476 .B "\-\-help, \-?"
1477 Show help text and default parameters.
1478 .SH RETURN CODES
1479 Cryptsetup returns 0 on success and a non-zero value on error.
1480
1481 Error codes are: 1 wrong parameters, 2 no permission (bad passphrase),
1482 3 out of memory, 4 wrong device specified, 5 device already exists
1483 or device is busy.
1484 .SH NOTES ON PASSPHRASE PROCESSING FOR PLAIN MODE
1485 Note that no iterated hashing or salting is done in plain mode.
1486 If hashing is done, it is a single direct hash. This means that
1487 low-entropy passphrases are easy to attack in plain mode.
1488
1489 \fBFrom a terminal\fR: The passphrase is read until the
1490 first newline, i.e. '\\n'.
1491 The input without the newline character is processed with
1492 the default hash or the hash specified with \-\-hash.
1493 The hash result will be truncated to the key size
1494 of the used cipher, or the size specified with \-s.
1495
1496 \fBFrom stdin\fR: Reading will continue until a newline (or until
1497 the maximum input size is reached), with the trailing newline
1498 stripped. The maximum input size is defined by the same
1499 compiled-in default as for the maximum key file size and can
1500 be overwritten using \-\-keyfile-size option.
1501
1502 The data read will be hashed with the default hash
1503 or the hash specified with \-\-hash.
1504 The hash result will be truncated to the key size
1505 of the used cipher, or the size specified with \-s.
1506
1507 Note that if \-\-key-file=- is used for reading the key
1508 from stdin, trailing newlines are not stripped from the input.
1509
1510 If "plain" is used as argument to \-\-hash, the input
1511 data will not be hashed. Instead, it will be zero padded (if
1512 shorter than the key size) or truncated (if longer than the
1513 key size) and used directly as the binary key. This is useful for
1514 directly specifying a binary key.
1515 No warning will be given if the amount of data read from stdin is
1516 less than the key size.
1517
1518 \fBFrom a key file\fR: It will be truncated to the
1519 key size of the used cipher or the size given by \-s
1520 and directly used as a binary key.
1521
1522 \fBWARNING\fR: The \-\-hash argument is being ignored.
1523 The \-\-hash option is usable only for stdin input in plain mode.
1524
1525 If the key file is shorter than the key, cryptsetup
1526 will quit with an error.
1527 The maximum input size is defined by the same
1528 compiled-in default as for the maximum key file size and can
1529 be overwritten using \-\-keyfile-size option.
1530
1531
1532 .SH NOTES ON PASSPHRASE PROCESSING FOR LUKS
1533 LUKS uses PBKDF2 to protect against dictionary attacks
1534 and to give some protection to low-entropy passphrases
1535 (see RFC 2898 and the cryptsetup FAQ).
1536
1537 \fBFrom a terminal\fR: The passphrase is read until the
1538 first newline and then processed by PBKDF2 without
1539 the newline character.
1540
1541 \fBFrom stdin\fR:
1542 LUKS will read passphrases from stdin up to the
1543 first newline character or the compiled-in
1544 maximum key file length. If \-\-keyfile\-size is
1545 given, it is ignored.
1546
1547 \fBFrom key file\fR:
1548 The complete keyfile is read up to the compiled-in
1549 maximum size. Newline characters do not terminate the
1550 input. The \-\-keyfile\-size option can be used to limit
1551 what is read.
1552
1553 \fBPassphrase processing\fR:
1554 Whenever a passphrase is added to a LUKS header (luksAddKey, luksFormat),
1555 the user may specify how much the time the passphrase processing
1556 should consume. The time is used to determine the iteration count
1557 for PBKDF2 and higher times will offer better protection for
1558 low-entropy passphrases, but open will take longer to
1559 complete. For passphrases that have entropy higher than the
1560 used key length, higher iteration times will not increase security.
1561
1562 The default setting of one or two seconds is sufficient for most
1563 practical cases. The only exception is a low-entropy
1564 passphrase used on a device with a slow CPU, as this will
1565 result in a low iteration count. On a slow device, it may
1566 be advisable to increase the iteration time using the
1567 \-\-iter\-time option in order to obtain a higher
1568 iteration count. This does slow down all later luksOpen
1569 operations accordingly.
1570 .SH INCOHERENT BEHAVIOR FOR INVALID PASSPHRASES/KEYS
1571 LUKS checks for a valid passphrase when an encrypted partition
1572 is unlocked. The behavior of plain dm-crypt is different.
1573 It will always decrypt with the passphrase given. If the
1574 given passphrase is wrong, the device mapped by plain
1575 dm-crypt will essentially still contain encrypted data and
1576 will be unreadable.
1577 .SH NOTES ON SUPPORTED CIPHERS, MODES, HASHES AND KEY SIZES
1578 The available combinations of ciphers, modes, hashes and key sizes
1579 depend on kernel support. See /proc/crypto for a list of available
1580 options. You might need to load additional kernel crypto modules
1581 in order to get more options.
1582
1583 For the \-\-hash option, if the crypto backend is libgcrypt,
1584 then all algorithms supported by the gcrypt library are available.
1585 For other crypto backends, some algorithms may be missing.
1586 .SH NOTES ON PASSPHRASES
1587 Mathematics can't be bribed. Make sure you keep your passphrases safe.
1588 There are a few nice tricks for constructing a fallback, when suddenly
1589 out of the blue, your brain refuses to cooperate.
1590 These fallbacks need LUKS, as it's only possible with LUKS
1591 to have multiple passphrases. Still, if your attacker model does
1592 not prevent it, storing your passphrase in a sealed envelope somewhere
1593 may be a good idea as well.
1594 .SH NOTES ON RANDOM NUMBER GENERATORS
1595 Random Number Generators (RNG) used in cryptsetup are always the
1596 kernel RNGs without any modifications or additions to data stream
1597 produced.
1598
1599 There are two types of randomness cryptsetup/LUKS needs. One type
1600 (which always uses /dev/urandom) is used for salts, the AF splitter
1601 and for wiping deleted keyslots.
1602
1603 The second type is used for the volume (master) key. You can switch
1604 between using /dev/random and /dev/urandom  here, see
1605 \fP\-\-use\-random\fR and \fP\-\-use\-urandom\fR
1606 options. Using /dev/random on a system without enough entropy sources
1607 can cause \fPluksFormat\fR to block until the requested amount of
1608 random data is gathered. In a low-entropy situation (embedded system),
1609 this can take a very long time and potentially forever. At the same
1610 time, using /dev/urandom in a low-entropy situation will
1611 produce low-quality keys. This is a serious problem, but solving
1612 it is out of scope for a mere man-page.
1613 See \fPurandom(4)\fR for more information.
1614 .SH AUTHENTICATED DISK ENCRYPTION (EXPERIMENTAL)
1615 Since Linux kernel version 4.12 dm-crypt supports authenticated
1616 disk encryption.
1617
1618 Normal disk encryption modes are length-preserving (plaintext sector
1619 is of the same size as a ciphertext sector) and can provide only
1620 confidentiality protection, but not cryptographically sound
1621 data integrity protection.
1622
1623 Authenticated modes require additional space per-sector for
1624 authentication tag and use Authenticated Encryption with Additional
1625 Data (AEAD) algorithms.
1626
1627 If you configure LUKS2 device with data integrity protection,
1628 there will be an underlying dm-integrity device, which provides
1629 additional per-sector metadata space and also provide data
1630 journal protection to ensure atomicity of data and metadata update.
1631 Because there must be additional space for metadata and journal,
1632 the available space for the device will be smaller than for
1633 length-preserving modes.
1634
1635 The dm-crypt device then resides on top of such a dm-integrity device.
1636 All activation and deactivation of this device stack is performed
1637 by cryptsetup, there is no difference in using \fIluksOpen\fR
1638 for integrity protected devices.
1639 If you want to format LUKS2 device with data integrity protection,
1640 use \fI\-\-integrity\fR option.
1641
1642 Since dm-integrity doesn't support discards (TRIM), dm-crypt device on top of it
1643 inherits this, so integrity protection mode doesn't support discards either.
1644
1645 Some integrity modes requires two independent keys (key for encryption
1646 and for authentication). Both these keys are stored in one LUKS keyslot.
1647
1648 \fBWARNING:\fR All support for authenticated modes is experimental
1649 and there are only some modes available for now. Note that there
1650 are a very few authenticated encryption algorithms that are suitable
1651 for disk encryption.
1652
1653 .SH NOTES ON LOOPBACK DEVICE USE
1654 Cryptsetup is usually used directly on a block device (disk
1655 partition or LVM volume). However, if the device argument is a
1656 file, cryptsetup tries to allocate a loopback device
1657 and map it into this file. This mode requires Linux kernel 2.6.25
1658 or more recent which supports the loop autoclear flag (loop device is
1659 cleared on the last close automatically). Of course, you can
1660 always map a file to a loop-device manually. See the
1661 cryptsetup FAQ for an example.
1662
1663 When device mapping is active, you can see the loop backing file in
1664 the status command output. Also see losetup(8).
1665 .SH LUKS2 header locking
1666 .PP
1667 The LUKS2 on-disk metadata is updated in several steps and
1668 to achieve proper atomic update, there is a locking mechanism.
1669 For an image in file, code uses \fIflock(2)\fR system call.
1670 For a block device, lock is performed over a special file stored
1671 in a locking directory (by default \fI/run/lock/cryptsetup\fR).
1672 The locking directory should be created with the proper security
1673 context by the distribution during the boot-up phase.
1674 Only LUKS2 uses locks, other formats do not use this mechanism.
1675 .SH DEPRECATED ACTIONS
1676 .PP
1677 The \fIreload\fR action is no longer supported.
1678 Please use \fIdmsetup(8)\fR if you need to
1679 directly manipulate with the device mapping table.
1680 .PP
1681 The \fIluksDelKey\fR was replaced with \fIluksKillSlot\fR.
1682 .PP
1683 .SH REPORTING BUGS
1684 Report bugs, including ones in the documentation, on
1685 the cryptsetup mailing list at <dm-crypt@saout.de>
1686 or in the 'Issues' section on LUKS website.
1687 Please attach the output of the failed command with the
1688 \-\-debug option added.
1689 .SH AUTHORS
1690 cryptsetup originally written by Jana Saout <jana@saout.de>
1691 .br
1692 The LUKS extensions and original man page were written by
1693 Clemens Fruhwirth <clemens@endorphin.org>.
1694 .br
1695 Man page extensions by Milan Broz <gmazyland@gmail.com>.
1696 .br
1697 Man page rewrite and extension by Arno Wagner <arno@wagner.name>.
1698 .SH COPYRIGHT
1699 Copyright \(co 2004 Jana Saout
1700 .br
1701 Copyright \(co 2004-2006 Clemens Fruhwirth
1702 .br
1703 Copyright \(co 2012-2014 Arno Wagner
1704 .br
1705 Copyright \(co 2009-2020 Red Hat, Inc.
1706 .br
1707 Copyright \(co 2009-2020 Milan Broz
1708
1709 This is free software; see the source for copying conditions.  There is NO
1710 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1711 .SH SEE ALSO
1712 The LUKS website at \fBhttps://gitlab.com/cryptsetup/cryptsetup/\fR
1713
1714 The cryptsetup FAQ, contained in the distribution package and
1715 online at
1716 \fBhttps://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions\fR
1717
1718 The cryptsetup mailing list and list archive, see FAQ entry 1.6.
1719
1720 The LUKS on-disk format specification available at
1721 \fBhttps://gitlab.com/cryptsetup/cryptsetup/wikis/Specification\fR