1CRYPTSETUP(8)                Maintenance Commands                CRYPTSETUP(8)
2
3
4

NAME

6       cryptsetup - manage plain dm-crypt and LUKS encrypted volumes
7

SYNOPSIS

9       cryptsetup <options> <action> <action args>
10

DESCRIPTION

12       cryptsetup is used to conveniently setup dm-crypt managed device-mapper
13       mappings. These include plain dm-crypt volumes and  LUKS  volumes.  The
14       difference is that LUKS uses a metadata header and can hence offer more
15       features than plain dm-crypt. On the other hand, the header is  visible
16       and vulnerable to damage.
17
18       In  addition,  cryptsetup provides limited support for the use of loop-
19       AES volumes, TrueCrypt, VeraCrypt and BitLocker compatible volumes.
20
21

PLAIN DM-CRYPT OR LUKS?

23       Unless you understand the  cryptographic  background  well,  use  LUKS.
24       With  plain  dm-crypt  there  are a number of possible user errors that
25       massively decrease security. While LUKS cannot fix  them  all,  it  can
26       lessen the impact for many of them.
27

WARNINGS

29       A  lot  of good information on the risks of using encrypted storage, on
30       handling problems and on security aspects can be found  in  the  Crypt‐
31       setup  FAQ.  Read  it.  Nonetheless, some risks deserve to be mentioned
32       here.
33
34       Backup: Storage media die. Encryption has no influence on that.  Backup
35       is mandatory for encrypted data as well, if the data has any worth. See
36       the Cryptsetup FAQ for advice on how to do a  backup  of  an  encrypted
37       volume.
38
39       Character encoding: If you enter a passphrase with special symbols, the
40       passphrase can change depending on character  encoding.  Keyboard  set‐
41       tings  can  also change, which can make blind input hard or impossible.
42       For example, switching from some ASCII 8-bit variant to UTF-8 can  lead
43       to  a  different binary encoding and hence different passphrase seen by
44       cryptsetup, even if what you see on the terminal is exactly  the  same.
45       It is therefore highly recommended to select passphrase characters only
46       from 7-bit ASCII, as the encoding for 7-bit ASCII stays  the  same  for
47       all ASCII variants and UTF-8.
48
49       LUKS  header:  If the header of a LUKS volume gets damaged, all data is
50       permanently lost unless you have a header-backup.   If  a  key-slot  is
51       damaged, it can only be restored from a header-backup or if another ac‐
52       tive key-slot with known passphrase is undamaged.   Damaging  the  LUKS
53       header is something people manage to do with surprising frequency. This
54       risk is the result of a trade-off between security and safety, as  LUKS
55       is  designed  for fast and secure wiping by just overwriting header and
56       key-slot area.
57
58       Previously used partitions: If a partition was previously used, it is a
59       very  good idea to wipe filesystem signatures, data, etc. before creat‐
60       ing a LUKS or plain dm-crypt container on it.  For a quick  removal  of
61       filesystem signatures, use "wipefs". Take care though that this may not
62       remove everything. In particular, MD RAID signatures at the  end  of  a
63       device  may  survive.  It  also  does not remove data. For a full wipe,
64       overwrite the whole partition before container creation. If you do  not
65       know how to do that, the cryptsetup FAQ describes several options.
66
67

BASIC ACTIONS

69       The following are valid actions for all supported device types.
70
71       open <device> <name> --type <device_type>
72
73              Opens (creates a mapping with) <name> backed by device <device>.
74
75              Device  type can be plain, luks (default), luks1, luks2, loopaes
76              or tcrypt.
77
78              For backward compatibility there are open command aliases:
79
80              create (argument-order <name> <device>): open --type plain
81              plainOpen: open --type plain
82              luksOpen: open --type luks
83              loopaesOpen: open --type loopaes
84              tcryptOpen: open --type tcrypt
85              bitlkOpen: open --type bitlk
86
87              <options> are type specific and are described below for individ‐
88              ual  device  types. For create, the order of the <name> and <de‐
89              vice> options is inverted  for  historical  reasons,  all  other
90              aliases use the standard <device> <name> order.
91
92       close <name>
93
94              Removes  the existing mapping <name> and wipes the key from ker‐
95              nel memory.
96
97              For backward compatibility there are close command aliases:  re‐
98              move,  plainClose, luksClose, loopaesClose, tcryptClose (all be‐
99              haves exactly the same, device type is determined  automatically
100              from active device).
101
102              <options> can be [--deferred] or [--cancel-deferred]
103
104
105       status <name>
106
107              Reports the status for the mapping <name>.
108
109       resize <name>
110
111              Resizes an active mapping <name>.
112
113              If --size (in 512-bytes sectors) or --device-size are not speci‐
114              fied, the size is computed from the underlying device. For  LUKS
115              it  is  the  size  of the underlying device without the area re‐
116              served for LUKS header (see data payload offset in luksDump com‐
117              mand).  For plain crypt device, the whole device size is used.
118
119              Note  that this does not change the raw device geometry, it just
120              changes how many sectors of the raw device  are  represented  in
121              the mapped device.
122
123              If  cryptsetup  detected  volume key for active device loaded in
124              kernel keyring service, resize action would  first  try  to  re‐
125              trieve  the key using a token and only if it failed it'd ask for
126              a passphrase to unlock a keyslot (LUKS) or to  derive  a  volume
127              key  again  (plain mode).  The kernel keyring is used by default
128              for LUKS2 devices.
129
130              With LUKS2 device additional <options> can be [--token-id, --to‐
131              ken-only,  --token-type, --key-slot, --key-file, --keyfile-size,
132              --keyfile-offset, --timeout,  --disable-external-tokens,  --dis‐
133              able-locks, --disable-keyring].
134
135
136       refresh <name>
137
138              Refreshes parameters of active mapping <name>.
139
140              Updates parameters of active device <name> without need to deac‐
141              tivate the device (and umount filesystem). Currently it supports
142              parameters refresh on following devices: LUKS1, LUKS2 (including
143              authenticated encryption), plain crypt and loopaes.
144
145              Mandatory parameters are identical to those of  an  open  action
146              for respective device type.
147
148              You   may   change   following   parameters   on   all   devices
149              --perf-same_cpu_crypt,  --perf-submit_from_crypt_cpus,   --perf-
150              no_read_workqueue,  --perf-no_write_workqueue  and  --allow-dis‐
151              cards.
152
153              Refreshing device without any optional  parameter  will  refresh
154              the device with default setting (respective to device type).
155
156              LUKS2 only:
157
158              --integrity-no-journal parameter affects only LUKS2 devices with
159              underlying dm-integrity device.
160
161              Adding option --persistent stores any combination of device  pa‐
162              rameters  above in LUKS2 metadata (only after successful refresh
163              operation).
164
165              --disable-keyring parameter refreshes a device with  volume  key
166              passed in dm-crypt driver.
167
168
169       reencrypt <device> or --active-name <name> [<new_name>]
170
171              Run resilient reencryption (LUKS2 device only).
172
173              There are 3 basic modes of operation:
174
175              • device reencryption (reencrypt)
176
177              • device encryption (reencrypt --encrypt)
178
179              • device decryption (reencrypt --decrypt)
180
181              <device> or --active-name <name> is mandatory parameter.
182
183              With  <device>  parameter cryptsetup looks up active <device> dm
184              mapping.  If no active mapping is detected,  it  starts  offline
185              reencryption otherwise online reencryption takes place.
186
187              Reencryption  process  may  be  safely interrupted by a user via
188              SIGTERM signal (ctrl+c).
189
190              To resume already initialized or interrupted reencryption,  just
191              run the cryptsetup reencrypt command again to continue the reen‐
192              cryption operation.  Reencryption may be resumed with  different
193              --resilience  or  --hotzone-size  unless  implicit datashift re‐
194              silience mode is used (reencrypt --encrypt with --reduce-device-
195              size option).
196
197              If  the reencryption process was interrupted abruptly (reencryp‐
198              tion process crash, system crash, poweroff) it may  require  re‐
199              covery.  The recovery is currently run automatically on next ac‐
200              tivation (action open) when needed.
201
202              Optional parameter <new_name> takes effect only  with  --encrypt
203              option  and it activates device <new_name> immediately after en‐
204              cryption initialization gets finished. That's useful when device
205              needs  to be ready as soon as possible and mounted (used) before
206              full data area encryption is completed.
207
208              Action supports following additional <options> [--encrypt, --de‐
209              crypt,  --device-size,  --resilience,  --resilience-hash, --hot‐
210              zone-size,  --init-only,  --resume-only,   --reduce-device-size,
211              --master-key-file, --key-size].
212
213

PLAIN MODE

215       Plain dm-crypt encrypts the device sector-by-sector with a single, non-
216       salted hash of the passphrase. No checks are performed, no metadata  is
217       used.  There is no formatting operation.  When the raw device is mapped
218       (opened), the usual device operations can be used on the mapped device,
219       including  filesystem  creation.   Mapped  devices  usually  reside  in
220       /dev/mapper/<name>.
221
222       The following are valid plain device type actions:
223
224       open --type plain <device> <name>
225       create <name> <device> (OBSOLETE syntax)
226
227              Opens (creates a mapping with) <name> backed by device <device>.
228
229              <options> can be [--hash, --cipher, --verify-passphrase,  --sec‐
230              tor-size,  --key-file,  --keyfile-offset,  --key-size, --offset,
231              --skip, --size, --readonly,  --shared,  --allow-discards,  --re‐
232              fresh]
233
234              Example:  'cryptsetup  open --type plain /dev/sda10 e1' maps the
235              raw encrypted device /dev/sda10 to the mapped (decrypted) device
236              /dev/mapper/e1,  which  can  then  be mounted, fsck-ed or have a
237              filesystem created on it.
238

LUKS EXTENSION

240       LUKS, the Linux Unified Key Setup, is a standard for  disk  encryption.
241       It  adds  a  standardized header at the start of the device, a key-slot
242       area directly behind the header and the bulk data area behind that. The
243       whole  set  is  called a 'LUKS container'.  The device that a LUKS con‐
244       tainer resides on is called a 'LUKS device'.  For most  purposes,  both
245       terms  can  be used interchangeably. But note that when the LUKS header
246       is at a nonzero offset in a device, then the device is not a  LUKS  de‐
247       vice anymore, but has a LUKS container stored in it at an offset.
248
249       LUKS  can  manage multiple passphrases that can be individually revoked
250       or changed and that can be securely scrubbed from persistent media  due
251       to  the use of anti-forensic stripes. Passphrases are protected against
252       brute-force and dictionary attacks by PBKDF2, which implements hash it‐
253       eration and salting in one function.
254
255       LUKS2  is  a new version of header format that allows additional exten‐
256       sions like different PBKDF algorithm or authenticated encryption.   You
257       can  format  device  with  LUKS2  header if you specify --type luks2 in
258       luksFormat command.  For activation, the format is  already  recognized
259       automatically.
260
261       Each passphrase, also called a key in this document, is associated with
262       one of 8 key-slots.  Key operations that do not specify a  slot  affect
263       the  first slot that matches the supplied passphrase or the first empty
264       slot if a new passphrase is added.
265
266       The <device> parameter can also be specified by a LUKS UUID in the for‐
267       mat  UUID=<uuid>.  Translation  to  real  device  name uses symlinks in
268       /dev/disk/by-uuid directory.
269
270       To specify a detached header, the --header parameter can be used in all
271       LUKS  commands and always takes precedence over the positional <device>
272       parameter.
273
274       The following are valid LUKS actions:
275
276       luksFormat <device> [<key file>]
277
278              Initializes a LUKS partition and  sets  the  initial  passphrase
279              (for  key-slot  0), either via prompting or via <key file>. Note
280              that if the second argument is present, then the  passphrase  is
281              taken  from  the  file  given there, without the need to use the
282              --key-file option. Also note that for both forms of reading  the
283              passphrase  from a file you can give '-' as file name, which re‐
284              sults in the passphrase being read from stdin  and  the  safety-
285              question being skipped.
286
287              You  cannot  call  luksFormat  on a device or filesystem that is
288              mapped or in use, e.g. mounted filesysem, used  in  LVM,  active
289              RAID  member etc.  The device or filesystem has to be un-mounted
290              in order to call luksFormat.
291
292              To use LUKS2, specify --type luks2.
293
294              <options>  can  be   [--hash,   --cipher,   --verify-passphrase,
295              --key-size,  --key-slot,  --key-file  (takes precedence over op‐
296              tional  second  argument),   --keyfile-offset,   --keyfile-size,
297              --use-random   |   --use-urandom,   --uuid,   --master-key-file,
298              --iter-time, --header,  --pbkdf-force-iterations,  --force-pass‐
299              word, --disable-locks].
300
301              For  LUKS2,  additional  <options> can be [--integrity, --integ‐
302              rity-no-wipe,  --sector-size,  --label,  --subsystem,   --pbkdf,
303              --pbkdf-memory,    --pbkdf-parallel,   --disable-locks,   --dis‐
304              able-keyring,   --luks2-metadata-size,    --luks2-keyslots-size,
305              --keyslot-cipher, --keyslot-key-size].
306
307              WARNING:  Doing  a luksFormat on an existing LUKS container will
308              make all data the old container permanently irretrievable unless
309              you have a header backup.
310
311       open --type luks <device> <name>
312       luksOpen <device> <name> (old syntax)
313
314              Opens  the LUKS device <device> and sets up a mapping <name> af‐
315              ter successful verification of the supplied passphrase.
316
317              First, the passphrase is searched in LUKS tokens.  If  it's  not
318              found  in  any token and also the passphrase is not supplied via
319              --key-file, the command prompts for it interactively.
320
321              <options> can be [--key-file, --keyfile-offset,  --keyfile-size,
322              --readonly,   --test-passphrase,   --allow-discards,   --header,
323              --key-slot, --master-key-file, --token-id,  --token-only,  --to‐
324              ken-type,  --disable-external-tokens,  --disable-keyring, --dis‐
325              able-locks, --type, --refresh, --serialize-memory-hard-pbkdf].
326
327       luksSuspend <name>
328
329              Suspends an active device (all IO operations will block and  ac‐
330              cesses  to  the device will wait indefinitely) and wipes the en‐
331              cryption key from kernel memory. Needs kernel 2.6.19 or later.
332
333              After this operation you have to use luksResume to reinstate the
334              encryption  key  and  unblock  the device or close to remove the
335              mapped device.
336
337              WARNING: never suspend the device on which the cryptsetup binary
338              resides.
339
340              <options> can be [--header, --disable-locks].
341
342       luksResume <name>
343
344              Resumes  a  suspended  device and reinstates the encryption key.
345              Prompts interactively for a  passphrase  if  --key-file  is  not
346              given.
347
348              <options>  can  be [--key-file, --keyfile-size, --header, --dis‐
349              able-keyring, --disable-locks, --type]
350
351       luksAddKey <device> [<key file with new key>]
352
353              Adds a new passphrase. An existing passphrase must  be  supplied
354              interactively or via --key-file.  The new passphrase to be added
355              can be specified interactively or read from the  file  given  as
356              positional argument.
357
358              NOTE: with --unbound option the action creates new unbound LUKS2
359              keyslot. The keyslot cannot be used for device  activation.   If
360              you  don't pass new key via --master-key-file option, new random
361              key is generated. Existing passphrase for any active keyslot  is
362              not required.
363
364              <options>  can be [--key-file, --keyfile-offset, --keyfile-size,
365              --new-keyfile-offset,  --new-keyfile-size,  --key-slot,   --mas‐
366              ter-key-file,   --force-password,   --header,   --disable-locks,
367              --iter-time,   --pbkdf,   --pbkdf-force-iterations,   --unbound,
368              --type, --keyslot-cipher, --keyslot-key-size].
369
370       luksRemoveKey <device> [<key file with passphrase to be removed>]
371
372              Removes  the  supplied  passphrase  from  the  LUKS  device. The
373              passphrase to be removed can be specified interactively, as  the
374              positional argument or via --key-file.
375
376              <options>  can be [--key-file, --keyfile-offset, --keyfile-size,
377              --header, --disable-locks, --type]
378
379              WARNING: If you read the passphrase from stdin (without  further
380              argument  or  with '-' as an argument to --key-file), batch-mode
381              (-q) will be implicitly switched on and no warning will be given
382              when  you  remove the last remaining passphrase from a LUKS con‐
383              tainer. Removing the last passphrase makes  the  LUKS  container
384              permanently inaccessible.
385
386       luksChangeKey <device> [<new key file>]
387
388              Changes  an  existing  passphrase.  The passphrase to be changed
389              must be supplied  interactively  or  via  --key-file.   The  new
390              passphrase  can  be supplied interactively or in a file given as
391              positional argument.
392
393              If a key-slot is specified (via --key-slot), the passphrase  for
394              that  key-slot  must  be given and the new passphrase will over‐
395              write the specified key-slot. If no key-slot  is  specified  and
396              there  is still a free key-slot, then the new passphrase will be
397              put into a free key-slot before the key-slot containing the  old
398              passphrase  is  purged.  If  there is no free key-slot, then the
399              key-slot with the old passphrase is overwritten directly.
400
401              WARNING: If a key-slot is overwritten, a  media  failure  during
402              this  operation  can  cause  the overwrite to fail after the old
403              passphrase has been wiped and make the LUKS container inaccessi‐
404              ble.
405
406              <options>  can be [--key-file, --keyfile-offset, --keyfile-size,
407              --new-keyfile-offset, --iter-time, --pbkdf, --pbkdf-force-itera‐
408              tions,    --new-keyfile-size,    --key-slot,   --force-password,
409              --header,     --disable-locks,     --type,     --keyslot-cipher,
410              --keyslot-key-size].
411
412       luksConvertKey <device>
413
414              Converts  an existing LUKS2 keyslot to new pbkdf parameters. The
415              passphrase for keyslot to be converted must be supplied interac‐
416              tively or via --key-file. If no --pbkdf parameters are specified
417              LUKS2 default pbkdf values will apply.
418
419              If a keyslot is specified (via --key-slot), the  passphrase  for
420              that keyslot must be given. If no keyslot is specified and there
421              is still a free keyslot, then the new  parameters  will  be  put
422              into a free keyslot before the keyslot containing the old param‐
423              eters is purged. If there is no free keyslot, then  the  keyslot
424              with the old parameters is overwritten directly.
425
426              WARNING:  If  a  keyslot  is overwritten, a media failure during
427              this operation can cause the overwrite to fail after the old pa‐
428              rameters  have been wiped and make the LUKS container inaccessi‐
429              ble.
430
431              <options> can be [--key-file, --keyfile-offset,  --keyfile-size,
432              --key-slot,  --header,  --disable-locks,  --iter-time,  --pbkdf,
433              --pbkdf-force-iterations,   --pbkdf-memory,    --pbkdf-parallel,
434              --keyslot-cipher, --keyslot-key-size].
435
436       luksKillSlot <device> <key slot number>
437
438              Wipe the key-slot number <key slot> from the LUKS device. Except
439              running in batch-mode (-q) a remaining passphrase must  be  sup‐
440              plied, either interactively or via --key-file.  This command can
441              remove the last remaining key-slot, but requires an  interactive
442              confirmation when doing so. Removing the last passphrase makes a
443              LUKS container permanently inaccessible.
444
445              <options> can be [--key-file, --keyfile-offset,  --keyfile-size,
446              --header, --disable-locks, --type].
447
448              WARNING:  If you read the passphrase from stdin (without further
449              argument or with '-' as an argument to  --key-file),  batch-mode
450              (-q) will be implicitly switched on and no warning will be given
451              when you remove the last remaining passphrase from a  LUKS  con‐
452              tainer.  Removing  the  last passphrase makes the LUKS container
453              permanently inaccessible.
454
455              NOTE: If there is no passphrase provided (on  stdin  or  through
456              --key-file argument) and batch-mode (-q) is active, the key-slot
457              is removed without any other warning.
458
459
460       erase <device>
461       luksErase <device>
462
463              Erase all keyslots and make the LUKS container permanently inac‐
464              cessible.   You do not need to provide any password for this op‐
465              eration.
466
467              WARNING: This operation is irreversible.
468
469       luksUUID <device>
470
471              Print the UUID of a LUKS device.
472              Set new UUID if --uuid option is specified.
473
474       isLuks <device>
475
476              Returns true, if <device> is a  LUKS  device,  false  otherwise.
477              Use  option -v to get human-readable feedback. 'Command success‐
478              ful.'  means the device is a LUKS device.
479
480              By specifying --type you may query for specific LUKS version.
481
482       luksDump <device>
483
484              Dump the header information of a LUKS device.
485
486              If the --dump-master-key option is used, the LUKS device  master
487              key  is dumped instead of the keyslot info. Together with --mas‐
488              ter-key-file option, master key is dumped to a file  instead  of
489              standard  output.  Beware  that the master key cannot be changed
490              without reencryption and can be used to decrypt the data  stored
491              in  the LUKS container without a passphrase and even without the
492              LUKS header. This means that if the master key  is  compromised,
493              the whole device has to be erased or reencrypted to prevent fur‐
494              ther access. Use this option carefully.
495
496              To dump the master key, a passphrase has to be supplied,  either
497              interactively or via --key-file.
498
499              To  dump  unbound  key (LUKS2 format only), --unbound parameter,
500              specific --key-slot id and proper passphrase has to be supplied,
501              either   interactively   or  via  --key-file.   Optional  --mas‐
502              ter-key-file parameter enables unbound keyslot dump to a file.
503
504              To dump LUKS2 JSON metadata  (without  basic  heade  information
505              like UUID) use --dump-json-metadata option.
506
507              <options>   can   be  [--dump-master-key,  --dump-json-metadata,
508              --key-file, --keyfile-offset, --keyfile-size,  --header,  --dis‐
509              able-locks, --master-key-file, --type, --unbound, --key-slot].
510
511              WARNING:  If  --dump-master-key  is used with --key-file and the
512              argument to --key-file is '-', no validation  question  will  be
513              asked and no warning given.
514
515       luksHeaderBackup <device> --header-backup-file <file>
516
517              Stores a binary backup of the LUKS header and keyslot area.
518              Note:  Using  '-' as filename writes the header backup to a file
519              named '-'.
520
521              WARNING: This backup file and a passphrase valid at the time  of
522              backup  allows  decryption  of  the  LUKS data area, even if the
523              passphrase was later changed or removed from  the  LUKS  device.
524              Also  note that with a header backup you lose the ability to se‐
525              curely wipe the LUKS device by just overwriting the  header  and
526              key-slots.  You either need to securely erase all header backups
527              in addition or overwrite the encrypted data area as  well.   The
528              second  option is less secure, as some sectors can survive, e.g.
529              due to defect management.
530
531       luksHeaderRestore <device> --header-backup-file <file>
532
533              Restores a binary backup of the LUKS  header  and  keyslot  area
534              from the specified file.
535              Note:  Using '-' as filename reads the header backup from a file
536              named '-'.
537
538              WARNING:  Header  and  keyslots  will  be  replaced,  only   the
539              passphrases from the backup will work afterward.
540
541              This  command  requires that the master key size and data offset
542              of the LUKS header already on  the  device  and  of  the  header
543              backup  match.  Alternatively, if there is no LUKS header on the
544              device, the backup will also be written to it.
545
546       token <add|remove|import|export> <device>
547
548              Action add creates new keyring token to  enable  auto-activation
549              of  the device.  For the auto-activation, the passphrase must be
550              stored in keyring with the specified description.  Usually,  the
551              passphrase  should  be  stored  in user or user-session keyring.
552              The token command is supported only for LUKS2.
553
554              For adding new keyring token, option --key-description is manda‐
555              tory.   Also,  new  token is assigned to key slot specified with
556              --key-slot option or  to  all  active  key  slots  in  the  case
557              --key-slot option is omitted.
558
559              To  remove  existing token, specify the token ID which should be
560              removed with --token-id option.
561
562              WARNING: The action token remove removes  any  token  type,  not
563              just  keyring  type  from token slot specified by --token-id op‐
564              tion.
565
566              Action import can store arbitrary  valid  token  json  in  LUKS2
567              header.  It  may be passed via standard input or via file passed
568              in --json-file option. If you specify --key-slot  then  success‐
569              fully imported token is also assigned to the key slot.
570
571              Action  export writes requested token json to a file passed with
572              --json-file or to standard output.
573
574              <options> can be [--header,  --token-id,  --key-slot,  --key-de‐
575              scription,  --disable-external-tokens,  --disable-locks,  --dis‐
576              able-keyring, --json-file].
577
578       convert <device> --type <format>
579
580              Converts the device between LUKS1 and LUKS2  format  (if  possi‐
581              ble).  The conversion will not be performed if there is an addi‐
582              tional LUKS2 feature or LUKS1 has unsupported header size.
583
584              Conversion (both directions) must be performed on  inactive  de‐
585              vice.  There must not be active dm-crypt mapping established for
586              LUKS header requested for conversion.
587
588              --type option is mandatory with following accepted values: luks1
589              or luks2.
590
591              WARNING:  The  convert action can destroy the LUKS header in the
592              case of a crash during conversion or if a  media  error  occurs.
593              Always create a header backup before performing this operation!
594
595              <options> can be [--header, --type].
596
597       config <device>
598
599              Set permanent configuration options (store to LUKS header).  The
600              config command is supported only for LUKS2.
601
602              The permanent options can be --priority to set priority (normal,
603              prefer, ignore) for keyslot (specified by --key-slot) or --label
604              and --subsystem.
605
606              <options> can be [--priority, --label, --subsystem,  --key-slot,
607              --header].
608
609

loop-AES EXTENSION

611       cryptsetup  supports  mapping loop-AES encrypted partition using a com‐
612       patibility mode.
613
614       open --type loopaes <device> <name> --key-file <keyfile>
615       loopaesOpen <device> <name> --key-file <keyfile>  (old syntax)
616
617              Opens the loop-AES <device> and sets up a mapping <name>.
618
619              If the key file is encrypted with GnuPG, then you  have  to  use
620              --key-file=- and decrypt it before use, e.g. like this:
621              gpg  --decrypt  <keyfile>  | cryptsetup loopaesOpen --key-file=-
622              <device> <name>
623
624              WARNING: The loop-AES extension cannot use the direct  input  of
625              key file on real terminal because the keys are separated by end-
626              of-line and only part of the multi-key file would be read.
627              If you need it in script, just use the pipe redirection:
628              echo $keyfile |  cryptsetup  loopaesOpen  --key-file=-  <device>
629              <name>
630
631              Use --keyfile-size to specify the proper key length if needed.
632
633              Use  --offset to specify device offset. Note that the units need
634              to be specified in number of 512 byte sectors.
635
636              Use --skip to specify the IV offset. If the original device used
637              an  offset and but did not use it in IV sector calculations, you
638              have to explicitly use --skip 0 in addition to the offset param‐
639              eter.
640
641              Use  --hash to override the default hash function for passphrase
642              hashing (otherwise it is detected according to key size).
643
644              <options> can  be  [--key-file,  --key-size,  --offset,  --skip,
645              --hash, --readonly, --allow-discards, --refresh].
646
647       See  also  section 7 of the FAQ and http://loop-aes.sourceforge.net for
648       more information regarding loop-AES.
649

TCRYPT (TrueCrypt-compatible and VeraCrypt) EXTENSION

651       cryptsetup supports mapping of TrueCrypt, tcplay or VeraCrypt encrypted
652       partition  using  a  native  Linux  kernel  API.  Header formatting and
653       TCRYPT header change is not supported, cryptsetup never changes  TCRYPT
654       header on-device.
655
656       TCRYPT  extension  requires kernel userspace crypto API to be available
657       (introduced in Linux kernel 2.6.38).  If  you  are  configuring  kernel
658       yourself,  enable  "User-space interface for symmetric key cipher algo‐
659       rithms" in "Cryptographic API" section (CRYPTO_USER_API_SKCIPHER  .con‐
660       fig option).
661
662       Because  TCRYPT  header  is encrypted, you have to always provide valid
663       passphrase and keyfiles.
664
665       Cryptsetup should recognize all header variants, except  legacy  cipher
666       chains  using LRW encryption mode with 64 bits encryption block (namely
667       Blowfish in LRW mode is not recognized, this is  limitation  of  kernel
668       crypto API).
669
670       VeraCrypt  is  just extension of TrueCrypt header with increased itera‐
671       tion count so unlocking can take quite a lot  of  time  (in  comparison
672       with TCRYPT device).
673
674       To  open a VeraCrypt device with a custom Personal Iteration Multiplier
675       (PIM) value, use either the --veracrypt-pim=<PIM>  option  to  directly
676       specify the PIM on the command- line or use --veracrypt-query-pim to be
677       prompted for the PIM.
678
679       The PIM value affects the number of iterations applied during key deri‐
680       vation.  Please  refer to https://www.veracrypt.fr/en/Personal%20Itera
681       tions%20Multiplier%20%28PIM%29.html for more detailed information.
682
683       If you need to disable VeraCrypt  device  support,  use  --disable-ver‐
684       acrypt option.
685
686       NOTE:  Activation  with  tcryptOpen is supported only for cipher chains
687       using LRW or XTS encryption modes.
688
689       The tcryptDump command should work for all  recognized  TCRYPT  devices
690       and doesn't require superuser privilege.
691
692       To map system device (device with boot loader where the whole encrypted
693       system resides) use --tcrypt-system option.  You can use partition  de‐
694       vice  as the parameter (parameter must be real partition device, not an
695       image in a file), then only this partition is mapped.
696
697       If you have the whole TCRYPT device as a file image and you want to map
698       multiple  partition  encrypted  with  system  encryption, please create
699       loopback mapping with partitions first (losetup -P, see losetup(8)  man
700       page for more info), and use loop partition as the device parameter.
701
702       If  you  use  the  whole base device as a parameter, one device for the
703       whole system encryption is mapped. This  mode  is  available  only  for
704       backward  compatibility  with  older  cryptsetup  versions which mapped
705       TCRYPT system encryption using the whole device.
706
707       To use hidden  header  (and  map  hidden  device,  if  available),  use
708       --tcrypt-hidden option.
709
710       To  explicitly  use  backup (secondary) header, use --tcrypt-backup op‐
711       tion.
712
713       NOTE: There is no protection for a hidden volume if the outer volume is
714       mounted.  The reason is that if there were any protection, it would re‐
715       quire some metadata describing what to protect in the outer volume  and
716       the hidden volume would become detectable.
717
718
719       open --type tcrypt <device> <name>
720       tcryptOpen <device> <name>  (old syntax)
721
722              Opens the TCRYPT (a TrueCrypt-compatible) <device> and sets up a
723              mapping <name>.
724
725              <options> can be [--key-file, --tcrypt-hidden,  --tcrypt-system,
726              --tcrypt-backup,   --readonly,  --test-passphrase,  --allow-dis‐
727              cards,     --disable-veracrypt,     --veracrypt-pim,      --ver‐
728              acrypt-query-pim, --header, --cipher, --hash].
729
730              The  keyfile parameter allows a combination of file content with
731              the passphrase and can be repeated. Note that using keyfiles  is
732              compatible with TCRYPT and is different from LUKS keyfile logic.
733
734              If  --PBKDF2  variants  with  the  specified hash algorithms are
735              checked. This could speed up unlocking the device (but  also  it
736              reveals some information about the container).
737
738              If  you  use  --header  in combination with hidden or system op‐
739              tions, the header file must contain specific headers on the same
740              positions as the original encrypted container.
741
742              WARNING:  Option --allow-discards cannot be combined with option
743              --tcrypt-hidden. For normal mapping, it can cause  the  destruc‐
744              tion of hidden volume (hidden volume appears as unused space for
745              outer volume so this space can be discarded).
746
747
748       tcryptDump <device>
749
750              Dump the header information of a TCRYPT device.
751
752              If the --dump-master-key option is used, the TCRYPT device  mas‐
753              ter key is dumped instead of TCRYPT header info. Beware that the
754              master key (or concatenated master keys if cipher chain is used)
755              can  be  used to decrypt the data stored in the TCRYPT container
756              without a passphrase.  This means that if the master key is com‐
757              promised,  the  whole device has to be erased to prevent further
758              access. Use this option carefully.
759
760              <options> can be [--dump-master-key,  --key-file,  --tcrypt-hid‐
761              den, --tcrypt-system, --tcrypt-backup, --cipher, --hash].
762
763              The  keyfile parameter allows a combination of file content with
764              the passphrase and can be repeated.
765
766       See also https://en.wikipedia.org/wiki/TrueCrypt for  more  information
767       regarding TrueCrypt.
768
769       Please  note that cryptsetup does not use TrueCrypt code, please report
770       all problems related to this compatibility extension to the  cryptsetup
771       project.
772
773

BITLK (Windows BitLocker-compatible) EXTENSION (EXPERIMENTAL)

775       cryptsetup  supports mapping of BitLocker and BitLocker to Go encrypted
776       partition using a native Linux kernel API.  Header formatting and BITLK
777       header changes are not supported, cryptsetup never changes BITLK header
778       on-device.
779
780       WARNING: This extension is EXPERIMENTAL.
781
782       BITLK extension requires kernel userspace crypto API  to  be  available
783       (for details see TCRYPT section).
784
785       Cryptsetup  should  recognize  all BITLK header variants, except legacy
786       header used in Windows Vista systems and partially decrypted  BitLocker
787       devices.   Activation  of legacy devices encrypted in CBC mode requires
788       at least Linux kernel version 5.3 and for devices using  Elephant  dif‐
789       fuser kernel 5.6.
790
791       The  bitlkDump command should work for all recognized BITLK devices and
792       doesn't require superuser privilege.
793
794       For unlocking with the open a password or a recovery  passphrase  or  a
795       startup key must be provided.
796
797       Additionally  unlocking using master key is supported. You must provide
798       BitLocker Full Volume Encryption Key (FVEK) using the --master-key-file
799       option.  The  key  must  be  decrypted  and  without  the  header (only
800       128/256/512 bits of key data depending on used cipher and mode).
801
802       Other unlocking methods (TPM, SmartCard) are not supported.
803
804
805       open --type bitlk <device> <name>
806       bitlkOpen <device> <name>  (old syntax)
807
808              Opens the BITLK (a BitLocker-compatible) <device> and sets up  a
809              mapping <name>.
810
811              <options>  can  be  [--key-file,  --readonly, --test-passphrase,
812              --allow-discards --master-key-file].
813
814
815       bitlkDump <device>
816
817              Dump the header information of a BITLK device.
818
819              <options> can be [--dump-master-key --master-key-file].
820
821
822       Please note that cryptsetup does not use any  Windows  BitLocker  code,
823       please  report  all problems related to this compatibility extension to
824       the cryptsetup project.
825
826

MISCELLANEOUS

828       repair <device>
829
830              Tries to repair the device metadata if possible. Currently  sup‐
831              ported only for LUKS device type.
832
833              This  command  is  useful to fix some known benign LUKS metadata
834              header corruptions. Only basic corruptions of unused keyslot are
835              fixable.  This command will only change the LUKS header, not any
836              key-slot data. You may enforce LUKS version by adding --type op‐
837              tion.
838
839              It also repairs (upgrades) LUKS2 reencryption metadata by adding
840              metadata digest that protects it against malicious changes.
841
842              If LUKS2 reencryption was interrupted in the middle of  writting
843              reencryption  segment  the repair command can be used to perform
844              reencryption recovery so that reencryption can continue later.
845
846              WARNING: Always create a binary backup of  the  original  header
847              before calling this command.
848
849       benchmark <options>
850
851              Benchmarks  ciphers  and KDF (key derivation function).  Without
852              parameters, it tries to measure few common configurations.
853
854              To benchmark other ciphers or modes, you need to  specify  --ci‐
855              pher and --key-size options or --hash for KDF test.
856
857              NOTE:  This  benchmark is using memory only and is only informa‐
858              tive.  You cannot directly predict real storage encryption speed
859              from it.
860
861              For  testing  block  ciphers,  this  benchmark  requires  kernel
862              userspace crypto API to be available (introduced in Linux kernel
863              2.6.38).   If you are configuring kernel yourself, enable "User-
864              space interface for symmetric key cipher algorithms" in "Crypto‐
865              graphic API" section (CRYPTO_USER_API_SKCIPHER .config option).
866
867              <options> can be [--cipher, --key-size, --hash].
868

OPTIONS

870       --verbose, -v
871              Print more information on command execution.
872
873       --debug or --debug-json
874              Run  in debug mode with full diagnostic logs. Debug output lines
875              are always prefixed by '#'.  If --debug-json is used, additional
876              LUKS2 JSON data structures are printed.
877
878       --type <device-type>
879              Specifies required device type, for more info read BASIC ACTIONS
880              section.
881
882       --hash, -h <hash-spec>
883              Specifies the passphrase hash for open (for  plain  and  loopaes
884              device types).
885
886              Specifies  the hash used in the LUKS key setup scheme and volume
887              key digest for luksFormat. The specified hash is used  as  hash-
888              parameter for PBKDF2 and for the AF splitter.
889
890              The  specified  hash  name  is  passed to the compiled-in crypto
891              backend.  Different backends may support different hashes.   For
892              luksFormat, the hash algorithm must provide at least 160 bits of
893              output, which excludes, e.g., MD5. Do not use a non-crypto  hash
894              like "crc32" as this breaks security.
895
896              Values compatible with old version of cryptsetup are "ripemd160"
897              for open --type plain and "sha1" for luksFormat.
898
899              Use cryptsetup --help to show the defaults.
900
901       --cipher, -c <cipher-spec>
902              Set the cipher specification string.
903
904              cryptsetup --help shows the compiled-in defaults.   The  current
905              default in the distributed sources is "aes-cbc-essiv:sha256" for
906              plain dm-crypt and "aes-xts-plain64" for LUKS.
907
908              If a hash is part of the cipher specification, then it  is  used
909              as  part  of  the IV generation. For example, ESSIV needs a hash
910              function, while "plain64" does not and hence none is specified.
911
912              For XTS mode you can optionally set a key size of 512 bits  with
913              the  -s  option.  Key  size for XTS mode is twice that for other
914              modes for the same security level.
915
916              XTS mode requires kernel 2.6.24 or later  and  plain64  requires
917              kernel  2.6.33  or  later.  More information can be found in the
918              FAQ.
919
920       --verify-passphrase, -y
921              When interactively asking for a passphrase, ask for it twice and
922              complain  if  both  inputs do not match. Advised when creating a
923              regular mapping for the first time, or when running  luksFormat.
924              Ignored on input from file or stdin.
925
926       --key-file, -d name
927              Read the passphrase from file.
928
929              If  the name given is "-", then the passphrase will be read from
930              stdin.  In this case, reading will not stop at  newline  charac‐
931              ters.
932
933              With  LUKS,  passphrases  supplied via --key-file are always the
934              existing passphrases requested by a command, except in the  case
935              of  luksFormat  where --key-file is equivalent to the positional
936              key file argument.
937
938              If you want to set a new passphrase via key file,  you  have  to
939              use a positional argument to luksAddKey.
940
941              See section NOTES ON PASSPHRASE PROCESSING for more information.
942
943       --keyfile-offset value
944              Skip  value  bytes at the beginning of the key file.  Works with
945              all commands that accept key files.
946
947       --keyfile-size, -l value
948              Read a maximum of value bytes from the key file.  The default is
949              to read the whole file up to the compiled-in maximum that can be
950              queried with --help. Supplying more data  than  the  compiled-in
951              maximum aborts the operation.
952
953              This  option is useful to cut trailing newlines, for example. If
954              --keyfile-offset is also given, the size count starts after  the
955              offset.  Works with all commands that accept key files.
956
957       --new-keyfile-offset value
958              Skip  value bytes at the start when adding a new passphrase from
959              key file with luksAddKey.
960
961       --new-keyfile-size  value
962              Read a maximum of value bytes when adding a new passphrase  from
963              key file with luksAddKey.  The default is to read the whole file
964              up to the compiled-in maximum length that can  be  queried  with
965              --help.   Supplying more than the compiled in maximum aborts the
966              operation.  When --new-keyfile-offset  is  also  given,  reading
967              starts after the offset.
968
969       --master-key-file
970              Use a master key stored in a file.
971
972              For luksFormat this allows creating a LUKS header with this spe‐
973              cific master key. If the master key was taken from  an  existing
974              LUKS  header and all other parameters are the same, then the new
975              header decrypts the data encrypted with the  header  the  master
976              key was taken from.
977
978              Action luksDump together with --dump-master-key option: The vol‐
979              ume (master) key is stored in a file instead  of  being  printed
980              out to standard output.
981
982              WARNING:  If  you  create  your own master key, you need to make
983              sure to do it right. Otherwise, you can end up  with  a  low-en‐
984              tropy  or  otherwise partially predictable master key which will
985              compromise security.
986
987              For luksAddKey this allows adding a new passphrase without  hav‐
988              ing to know an existing one.
989
990              For  open this allows one to open the LUKS device without giving
991              a passphrase.
992
993       --dump-json-metadata
994              For luksDump (LUKS2 only) this option prints  content  of  LUKS2
995              header JSON metadata area.
996
997       --dump-master-key
998              For  luksDump  this  option  includes the master key in the dis‐
999              played information. Use with care, as the master key can be used
1000              to bypass the passphrases, see also option --master-key-file.
1001
1002       --json-file
1003              Read  token json from a file or write token to it. See token ac‐
1004              tion for more information. --json-file=- reads json  from  stan‐
1005              dard input or writes it to standard output respectively.
1006
1007       --use-random
1008
1009       --use-urandom
1010              For  luksFormat  these options define which kernel random number
1011              generator will be used to create the  master  key  (which  is  a
1012              long-term key).
1013
1014              See  NOTES ON RANDOM NUMBER GENERATORS for more information. Use
1015              cryptsetup --help to show the compiled-in default random  number
1016              generator.
1017
1018              WARNING:  In  a  low-entropy situation (e.g. in an embedded sys‐
1019              tem), both selections are problematic.  Using  /dev/urandom  can
1020              lead to weak keys.  Using /dev/random can block a long time, po‐
1021              tentially forever, if not enough entropy can be harvested by the
1022              kernel.
1023
1024       --key-slot, -S <0-N>
1025              For  LUKS  operations that add key material, this options allows
1026              you to specify which key slot is selected for the new key.  This
1027              option can be used for luksFormat, and luksAddKey.
1028              In  addition,  for open, this option selects a specific key-slot
1029              to compare the passphrase  against.   If  the  given  passphrase
1030              would only match a different key-slot, the operation fails.
1031
1032              Maximum  number  of key slots depends on LUKS version. LUKS1 can
1033              have up to 8 key slots. LUKS2 can have up to 32 key slots  based
1034              on  key slot area size and key size, but a valid key slot ID can
1035              always be between 0 and 31 for LUKS2.
1036
1037       --key-size, -s <bits>
1038              Sets key size in bits. The argument has to be a multiple  of  8.
1039              The possible key-sizes are limited by the cipher and mode used.
1040
1041              See  /proc/crypto  for  more  information. Note that key-size in
1042              /proc/crypto is stated in bytes.
1043
1044              This option can be used for open  --type  plain  or  luksFormat.
1045              All  other  LUKS  actions will use the key-size specified in the
1046              LUKS header.  Use cryptsetup --help to show the compiled-in  de‐
1047              faults.
1048
1049       --size, -b <number of 512 byte sectors>
1050              Set the size of the device in sectors of 512 bytes.  This option
1051              is only relevant for the open and resize actions.
1052
1053       --offset, -o <number of 512 byte sectors>
1054              Start offset in the backend device in  512-byte  sectors.   This
1055              option  is  only  relevant  for  the  open  action with plain or
1056              loopaes device types or for LUKS devices in luksFormat.
1057
1058              For LUKS, the --offset option sets the data offset (payload)  of
1059              data device and must be be aligned to 4096-byte sectors (must be
1060              multiple  of  8).   This  option   cannot   be   combined   with
1061              --align-payload option.
1062
1063       --skip, -p <number of 512 byte sectors>
1064              Start  offset  used  in  IV calculation in 512-byte sectors (how
1065              many sectors of the encrypted data to skip  at  the  beginning).
1066              This  option  is only relevant for the open action with plain or
1067              loopaes device types.
1068
1069              Hence, if --offset n, and --skip s, sector n (the  first  sector
1070              of  the  encrypted device) will get a sector number of s for the
1071              IV calculation.
1072
1073       --device-size size[units]
1074              Instead of real device size, use specified value.
1075
1076              With reencrypt action it means that only  specified  area  (from
1077              the  start  of  the  device to the specified size) will be reen‐
1078              crypted.
1079
1080              With resize action it sets new size of the device.
1081
1082              If no unit suffix is specified, the size is in bytes.
1083
1084              Unit  suffix  can  be  S  for  512  byte  sectors,  K/M/G/T  (or
1085              KiB,MiB,GiB,TiB)  for  units  with  1024 base or KB/MB/GB/TB for
1086              1000 base (SI scale).
1087
1088              WARNING: This is destructive operation when used with  reencrypt
1089              command.
1090
1091       --readonly, -r
1092              set up a read-only mapping.
1093
1094       --shared
1095              Creates  an additional mapping for one common ciphertext device.
1096              Arbitrary mappings are supported.  This option is only  relevant
1097              for  the  open  --type  plain  action.  Use --offset, --size and
1098              --skip to specify the mapped area.
1099
1100       --pbkdf <PBKDF spec>
1101              Set Password-Based Key Derivation Function (PBKDF) algorithm for
1102              LUKS keyslot.  The PBKDF can be: pbkdf2 (for PBKDF2 according to
1103              RFC2898), argon2i for Argon2i  or  argon2id  for  Argon2id  (see
1104              https://www.cryptolux.org/index.php/Argon2 for more info).
1105
1106              For LUKS1, only PBKDF2 is accepted (no need to use this option).
1107              The default PBKDF2 for LUKS2 is set during compilation time  and
1108              is available in cryptsetup --help output.
1109
1110              A PBKDF is used for increasing dictionary and brute-force attack
1111              cost for keyslot passwords. The parameters can be  time,  memory
1112              and parallel cost.
1113
1114              For  PBKDF2, only time cost (number of iterations) applies.  For
1115              Argon2i/id, there is also memory cost  (memory  required  during
1116              the  process  of  key  derivation)  and parallel cost (number of
1117              threads that run in parallel during the key derivation.
1118
1119              Note that increasing memory cost also increases time, so the fi‐
1120              nal  parameter values are measured by a benchmark. The benchmark
1121              tries to find iteration time (--iter-time) with required  memory
1122              cost  --pbkdf-memory.  If it is not possible, the memory cost is
1123              decreased as well.  The parallel cost --pbkdf-parallel  is  con‐
1124              stant and is checked against available CPU cores.
1125
1126              You  can  see  all PBKDF parameters for particular LUKS2 keyslot
1127              with luksDump command.
1128
1129              NOTE: If you do not want to use benchmark and  want  to  specify
1130              all   parameters  directly,  use  --pbkdf-force-iterations  with
1131              --pbkdf-memory and --pbkdf-parallel.   This  will  override  the
1132              values  without  benchmarking.  Note it can cause extremely long
1133              unlocking time. Use only in specific cases, for example, if  you
1134              know that the formatted device will be used on some small embed‐
1135              ded system.
1136
1137              MINIMAL AND MAXIMAL PBKDF COSTS: For PBKDF2, the minimum  itera‐
1138              tion  count is 1000 and maximum is 4294967295 (maximum for 32bit
1139              unsigned integer).  Memory and parallel  costs  are  unused  for
1140              PBKDF2.   For Argon2i and Argon2id, minimum iteration count (CPU
1141              cost) is 4 and maximum is 4294967295 (maximum for 32bit unsigned
1142              integer).   Minimum  memory cost is 32 KiB and maximum is 4 GiB.
1143              (Limited by addresable memory on some CPU  platforms.)   If  the
1144              memory cost parameter is benchmarked (not specified by a parame‐
1145              ter) it is always in range from 64 MiB to 1 GiB.   The  parallel
1146              cost minimum is 1 and maximum 4 (if enough CPUs cores are avail‐
1147              able, otherwise it is decreased).
1148
1149       --iter-time, -i <number of milliseconds>
1150              The number of milliseconds to spend with PBKDF  passphrase  pro‐
1151              cessing.   This option is only relevant for LUKS operations that
1152              set or change passphrases, such  as  luksFormat  or  luksAddKey.
1153              Specifying 0 as parameter selects the compiled-in default.
1154
1155       --pbkdf-memory <number>
1156              Set  the memory cost for PBKDF (for Argon2i/id the number repre‐
1157              sents kilobytes).  Note that it is maximal value,  PBKDF  bench‐
1158              mark  or available physical memory can decrease it.  This option
1159              is not available for PBKDF2.
1160
1161       --pbkdf-parallel <number>
1162              Set the parallel cost for PBKDF (number of threads,  up  to  4).
1163              Note  that it is maximal value, it is decreased automatically if
1164              CPU online count is lower.  This option  is  not  available  for
1165              PBKDF2.
1166
1167       --pbkdf-force-iterations <num>
1168              Avoid  PBKDF  benchmark and set time cost (iterations) directly.
1169              It can be used for LUKS/LUKS2 device only.  See  --pbkdf  option
1170              for more info.
1171
1172       --batch-mode, -q
1173              Suppresses all confirmation questions. Use with care!
1174
1175              If the -y option is not specified, this option also switches off
1176              the passphrase verification for luksFormat.
1177
1178       --progress-frequency <seconds>
1179              Print separate line every <seconds> with wipe progress.
1180
1181       --timeout, -t <number of seconds>
1182              The number of seconds to wait before timeout on passphrase input
1183              via  terminal.  It is relevant every time a passphrase is asked,
1184              for example for open, luksFormat or luksAddKey.  It has  no  ef‐
1185              fect if used in conjunction with --key-file.
1186              This  option  is  useful when the system should not stall if the
1187              user does not input a passphrase, e.g. during boot. The  default
1188              is a value of 0 seconds, which means to wait forever.
1189
1190       --tries, -T
1191              How  often  the  input of the passphrase shall be retried.  This
1192              option is relevant every time a passphrase is asked, for example
1193              for open, luksFormat or luksAddKey.  The default is 3 tries.
1194
1195       --align-payload <number of 512 byte sectors>
1196              Align payload at a boundary of value 512-byte sectors.  This op‐
1197              tion is relevant for luksFormat.
1198
1199              If not specified, cryptsetup tries to use the topology info pro‐
1200              vided by the kernel for the underlying device to get the optimal
1201              alignment.  If not available (or the calculated value is a  mul‐
1202              tiple  of  the  default)  data  is  by default aligned to a 1MiB
1203              boundary (i.e. 2048 512-byte sectors).
1204
1205              For a detached LUKS header, this option specifies the offset  on
1206              the data device. See also the --header option.
1207
1208              WARNING:  This option is DEPRECATED and has often unexpected im‐
1209              pact to the data offset and keyslot area size (for LUKS2) due to
1210              the complex rounding.  For fixed data device offset use --offset
1211              option instead.
1212
1213
1214       --uuid=UUID
1215              Use the provided UUID for the luksFormat command instead of gen‐
1216              erating  a new one. Changes the existing UUID when used with the
1217              luksUUID command.
1218
1219              The UUID must be provided in  the  standard  UUID  format,  e.g.
1220              12345678-1234-1234-1234-123456789abc.
1221
1222       --allow-discards
1223              Allow  the  use of discard (TRIM) requests for the device.  This
1224              option is only relevant for open action.  This is also not  sup‐
1225              ported for LUKS2 devices with data integrity protection.
1226
1227              WARNING:  This  command  can have a negative security impact be‐
1228              cause it can make filesystem-level  operations  visible  on  the
1229              physical  device.  For  example,  information leaking filesystem
1230              type, used space, etc. may be extractable from the physical  de‐
1231              vice  if the discarded blocks can be located later. If in doubt,
1232              do not use it.
1233
1234              A kernel version of 3.1 or later is needed. For earlier kernels,
1235              this option is ignored.
1236
1237       --perf-same_cpu_crypt
1238              Perform  encryption using the same cpu that IO was submitted on.
1239              The default is to use an unbound workqueue  so  that  encryption
1240              work is automatically balanced between available CPUs.  This op‐
1241              tion is only relevant for open action.
1242
1243              NOTE: This option is available only for low-level dm-crypt  per‐
1244              formance  tuning,  use  only if you need a change to default dm-
1245              crypt behaviour. Needs kernel 4.0 or later.
1246
1247       --perf-submit_from_crypt_cpus
1248              Disable offloading writes to a separate thread after encryption.
1249              There  are  some situations where offloading write bios from the
1250              encryption threads to a single thread degrades performance  sig‐
1251              nificantly.   The  default  is to offload write bios to the same
1252              thread.  This option is only relevant for open action.
1253
1254              NOTE: This option is available only for low-level dm-crypt  per‐
1255              formance  tuning,  use  only if you need a change to default dm-
1256              crypt behaviour. Needs kernel 4.0 or later.
1257
1258       --perf-no_read_workqueue, --perf-no_write_workqueue
1259              Bypass dm-crypt internal workqueue and process read or write re‐
1260              quests synchronously.  This option is only relevant for open ac‐
1261              tion.
1262
1263              NOTE: These options are available only  for  low-level  dm-crypt
1264              performance tuning, use only if you need a change to default dm-
1265              crypt behaviour. Needs kernel 5.9 or later.
1266
1267       --test-passphrase
1268              Do not activate the device, just verify passphrase.  This option
1269              is only relevant for open action (the device mapping name is not
1270              mandatory if this option is used).
1271
1272       --header <device or file storing the LUKS header>
1273              Use a detached (separated) metadata device  or  file  where  the
1274              LUKS  header  is stored. This option allows one to store cipher‐
1275              text and LUKS header on different devices.
1276
1277              This option is only relevant for LUKS devices and  can  be  used
1278              with  the  luksFormat, open, luksSuspend, luksResume, status and
1279              resize commands.
1280
1281              For luksFormat with a file name as the argument to --header, the
1282              file  will  be  automatically created if it does not exist.  See
1283              the cryptsetup FAQ for header size calculation.
1284
1285              For other commands that change the LUKS  header  (e.g.  luksAdd‐
1286              Key),  specify  the device or file with the LUKS header directly
1287              as the LUKS device.
1288
1289              If used with luksFormat, the --align-payload option is taken  as
1290              absolute sector alignment on ciphertext device and can be zero.
1291
1292              WARNING:  There is no check whether the ciphertext device speci‐
1293              fied actually belongs to the header  given.  In  fact,  you  can
1294              specify  an  arbitrary  device as the ciphertext device for open
1295              with the --header option. Use with care.
1296
1297       --header-backup-file <file>
1298              Specify file with header backup  for  luksHeaderBackup  or  luk‐
1299              sHeaderRestore actions.
1300
1301       --force-password
1302              Do not use password quality checking for new LUKS passwords.
1303
1304              This   option   applies   only  to  luksFormat,  luksAddKey  and
1305              luksChangeKey and is ignored  if  cryptsetup  is  built  without
1306              password quality checking support.
1307
1308              For  more info about password quality check, see the manual page
1309              for pwquality.conf(5) and passwdqc.conf(5).
1310
1311       --deferred
1312              Defers device removal in  close  command  until  the  last  user
1313              closes it.
1314
1315       --cancel-deferred
1316              Removes a previously configured deferred device removal in close
1317              command.
1318
1319       --disable-external-tokens
1320              Disable loading of plugins for external LUKS2 tokens.
1321
1322       --disable-locks
1323              Disable lock protection for metadata on disk.   This  option  is
1324              valid only for LUKS2 and ignored for other formats.
1325
1326              WARNING:  Do  not use this option unless you run cryptsetup in a
1327              restricted environment where locking is  impossible  to  perform
1328              (where /run directory cannot be used).
1329
1330       --disable-keyring
1331              Do  not  load volume key in kernel keyring and store it directly
1332              in the dm-crypt target instead.  This option is  supported  only
1333              for the LUKS2 format.
1334
1335       --key-description <text>
1336              Set key description in keyring for use with token command.
1337
1338       --priority <normal|prefer|ignore>
1339              Set  a  priority  for LUKS2 keyslot.  The prefer priority marked
1340              slots are tried before normal priority.   The  ignored  priority
1341              means,  that  slot is never used, if not explicitly requested by
1342              --key-slot option.
1343
1344       --token-id
1345              Specify what token to use in actions token, open or resize.   If
1346              omitted,  all available tokens will be checked before proceeding
1347              further with passphrase prompt.
1348
1349       --token-only
1350              Do not proceed further with action (any of token,  open  or  re‐
1351              size)  if  token  activation  failed. Without the option, action
1352              asks for passphrase to proceed further.
1353
1354       --token-type
1355              Restrict tokens eligible for operation to  specific  token  type
1356              (name). Mostly useful when no --token-id is specified.
1357
1358       --sector-size <bytes>
1359              Set  sector  size for use with disk encryption. It must be power
1360              of two and in range 512 - 4096 bytes. This option  is  available
1361              only in the LUKS2 or plain modes.
1362
1363              The  default for plain mode is 512 bytes. For LUKS2 devices it's
1364              established during luksFormat operation based on parameters pro‐
1365              vided  by  underlying  data device.  For native 4K block devices
1366              it's 4096 bytes. For 4K/512e (4K physical sector size  with  512
1367              bytes  emulation) it's 4096 bytes. For drives reporting only 512
1368              bytes block size it remains 512 bytes. If data device is regular
1369              file put in filesystem it's 4096 bytes.
1370
1371              Note  that if sector size is higher than underlying device hard‐
1372              ware sector and there is not integrity protection that uses data
1373              journal,  using this option can increase risk on incomplete sec‐
1374              tor writes during a power fail.
1375
1376              If used together with --integrity option and dm-integrity  jour‐
1377              nal,  the atomicity of writes is guaranteed in all cases (but it
1378              cost write performance - data has to be written twice).
1379
1380              Increasing sector size from 512 bytes to 4096 bytes can  provide
1381              better  performance  on  most  of the modern storage devices and
1382              also with some hw encryption accelerators.
1383
1384       --iv-large-sectors
1385              Count Initialization Vector (IV) in larger sector size (if  set)
1386              instead  of  512 bytes sectors. This option can be used only for
1387              open command and plain encryption type.
1388
1389              NOTE: This option does not have any performance or security  im‐
1390              pact,  use  it only for accessing incompatible existing disk im‐
1391              ages from other systems that require this option.
1392
1393       --persistent
1394              If used with LUKS2 devices and activation commands like open  or
1395              refresh, the specified activation flags are persistently written
1396              into metadata and used next time automatically even  for  normal
1397              activation.   (No need to use cryptab or other system configura‐
1398              tion files.)
1399
1400              If you need to remove a persistent flag, use --persistent  with‐
1401              out  the  flag  you want to remove (e.g. to disable persistently
1402              stored discard flag, use --persistent without --allow-discards).
1403
1404              Only   --allow-discards,   --perf-same_cpu_crypt,    --perf-sub‐
1405              mit_from_crypt_cpus,                   --perf-no_read_workqueue,
1406              --perf-no_write_workqueue  and  --integrity-no-journal  can   be
1407              stored persistently.
1408
1409       --refresh
1410              Refreshes  an  active device with new set of parameters. See ac‐
1411              tion refresh description for more details.
1412
1413       --label <LABEL>
1414              --subsystem <SUBSYSTEM> Set label and subsystem description  for
1415              LUKS2 device, can be used in config and format actions.  The la‐
1416              bel and subsystem are optional fields and can be later  used  in
1417              udev  scripts  for triggering user actions once device marked by
1418              these labels is detected.
1419
1420       --integrity <integrity algorithm>
1421              Specify integrity algorithm to be used  for  authenticated  disk
1422              encryption in LUKS2.
1423
1424              WARNING:  This  extension is EXPERIMENTAL and requires dm-integ‐
1425              rity kernel target (available since kernel version  4.12).   For
1426              native  AEAD  modes,  also enable "User-space interface for AEAD
1427              cipher  algorithms"  in  "Cryptographic   API"   section   (CON‐
1428              FIG_CRYPTO_USER_API_AEAD .config option).
1429
1430              For more info, see AUTHENTICATED DISK ENCRYPTION section.
1431
1432       --luks2-metadata-size <size>
1433              This  option  can  be  used to enlarge the LUKS2 metadata (JSON)
1434              area.  The size includes 4096 bytes for binary metadata  (usable
1435              JSON  area  is  smaller of the binary area).  According to LUKS2
1436              specification, only these values are valid:  16,  32,  64,  128,
1437              256,  512,  1024,  2048  and 4096 kB The <size> can be specified
1438              with unit suffix (for example 128k).
1439
1440       --luks2-keyslots-size <size>
1441              This option can be used to set specific size of the LUKS2 binary
1442              keyslot  area  (key material is encrypted there). The value must
1443              be aligned to multiple of 4096 bytes with  maximum  size  128MB.
1444              The <size> can be specified with unit suffix (for example 128k).
1445
1446       --keyslot-cipher <cipher-spec>
1447              This  option  can  be used to set specific cipher encryption for
1448              the LUKS2 keyslot area.
1449
1450       --keyslot-key-size <bits>
1451              This option can be used to set specific key size for  the  LUKS2
1452              keyslot area.
1453
1454       --integrity-no-journal
1455              Activate  device  with  integrity  protection without using data
1456              journal (direct write of data and integrity  tags).   Note  that
1457              without  journal  power fail can cause non-atomic write and data
1458              corruption.  Use only if journalling is performed on a different
1459              storage layer.
1460
1461       --integrity-no-wipe
1462              Skip  wiping  of  device authentication (integrity) tags. If you
1463              skip this step, sectors will report invalid integrity tag  until
1464              an application write to the sector.
1465
1466              NOTE:  Even  some  writes to the device can fail if the write is
1467              not aligned to page size and page-cache initiates read of a sec‐
1468              tor with invalid integrity tag.
1469
1470       --unbound
1471
1472              Creates new or dumps existing LUKS2 unbound keyslot. See luksAd‐
1473              dKey or luksDump actions for more details.
1474
1475
1476       --tcrypt-hidden
1477              --tcrypt-system --tcrypt-backup Specify which TrueCrypt  on-disk
1478              header  will be used to open the device.  See TCRYPT section for
1479              more info.
1480
1481       --veracrypt
1482              This option is ignored as VeraCrypt compatible mode is supported
1483              by default.
1484
1485       --disable-veracrypt
1486              This  option  can  be  used to disable VeraCrypt compatible mode
1487              (only TrueCrypt devices are recognized). Only for TCRYPT  exten‐
1488              sion. See TCRYPT section for more info.
1489
1490       --veracrypt-pim
1491              --veracrypt-query-pim Use a custom Personal Iteration Multiplier
1492              (PIM) for VeraCrypt device.  See TCRYPT section for more info.
1493
1494       --serialize-memory-hard-pbkdf
1495              Use a global lock to serialize unlocking of keyslots using  mem‐
1496              ory-hard PBKDF.
1497
1498              NOTE:  This  is  (ugly) workaround for a specific situation when
1499              multiple devices are activated in parallel and system instead of
1500              reporting  out  of  memory starts unconditionally stop processes
1501              using out-of-memory killer.
1502
1503              DO NOT USE this switch until you are implementing boot  environ‐
1504              ment with parallel devices activation!
1505
1506       --encrypt
1507              Initialize (and run) device encryption (reencrypt action parame‐
1508              ter)
1509
1510       --decrypt
1511              Initialize (and run) device decryption (reencrypt action parame‐
1512              ter)
1513
1514       --init-only
1515              Initialize  reencryption  (any variant) operation in LUKS2 meta‐
1516              data only and exit. If any reencrypt operation is  already  ini‐
1517              tialized  in  metadata,  the  command with --init-only parameter
1518              fails.
1519
1520       --resume-only
1521              Resume reencryption (any variant) operation already described in
1522              LUKS2  metadata.  If  no reencrypt operation is initialized, the
1523              command with --resume-only parameter fails. Useful for  resuming
1524              reencrypt  operation  without  accidentally triggering new reen‐
1525              cryption operation.
1526
1527       --resilience <mode>
1528              Reencryption resilience mode can be one of checksum, journal  or
1529              none.
1530
1531              checksum: default mode, where individual checksums of ciphertext
1532              hotzone sectors are stored, so the recovery process  can  detect
1533              which  sectors  were  already reencrypted.  It requires that the
1534              device sector write is atomic.
1535
1536              journal: the hotzone is journaled in the  binary  area  (so  the
1537              data are written twice).
1538
1539              none:  performance mode. There is no protection and the only way
1540              it's safe to interrupt the reencryption is similar to  old  off‐
1541              line reencryption utility. (ctrl+c).
1542
1543              The  option is ignored if reencryption with datashift mode is in
1544              progress.
1545
1546       --resilience-hash <hash>
1547              The hash algorithm used with "--resilience checksum" only.   The
1548              default  hash  is  sha256. With other resilience modes, the hash
1549              parameter is ignored.
1550
1551       --hotzone-size <size>
1552              This option can be used to set an upper limit  on  the  size  of
1553              reencryption  area  (hotzone).  The <size> can be specified with
1554              unit suffix (for example 50M). Note that actual hotzone size may
1555              be  less  than  specified  <size> due to other limitations (free
1556              space in keyslots area or available memory).
1557
1558       --reduce-device-size <size>
1559              Initialize LUKS2 reencryption with data  device  size  reduction
1560              (currently only --encrypt variant is supported).
1561
1562              Last  <size>  sectors  of <device> will be used to properly ini‐
1563              tialize device reencryption.  That means any data at last <size>
1564              sectors will be lost.
1565
1566              It  could be useful if you added some space to underlying parti‐
1567              tion or logical volume  (so  last  <size>  sectors  contains  no
1568              data).
1569
1570              Recommended  minimal size is twice the default LUKS2 header size
1571              (--reduce-device-size 32M) for --encrypt use case.  Be  sure  to
1572              have  enough  (at  least --reduce-device-size value      of free
1573              space at the end of <device>).
1574
1575              WARNING: This is a destructive operation and cannot be reverted.
1576              Use with extreme care - accidentally overwritten filesystems are
1577              usually unrecoverable.
1578
1579       --version
1580              Show the program version.
1581
1582       --usage
1583              Show short option help.
1584
1585       --help, -?
1586              Show help text and default parameters.
1587

EXAMPLE

1589       Example 1: Create LUKS 2 container on block device /dev/sdX.
1590              sudo cryptsetup --type luks2 luksFormat /dev/sdX
1591
1592       Example 2: Add an additional passphrase to key slot 5.
1593              sudo cryptsetup luksAddKey --key-slot 5 /dev/sdX
1594
1595       Example 3: Create LUKS header backup and save it to file.
1596              sudo cryptsetup luksHeaderBackup  /dev/sdX  --header-backup-file
1597              /var/tmp/NameOfBackupFile
1598
1599       Example 4: Open LUKS container on /dev/sdX and map it to sdX_crypt.
1600              sudo cryptsetup open /dev/sdX sdX_crypt
1601
1602       WARNING: The command in example 5 will erase all key slots.
1603              Your  cannot  use  your luks container afterwards anymore unless
1604              you have a backup to restore.
1605
1606       Example 5: Erase all key slots on /dev/sdX.
1607              sudo cryptsetup erase /dev/sdX
1608
1609       Example 6: Restore LUKS header from backup file.
1610              sudo cryptsetup luksHeaderRestore /dev/sdX  --header-backup-file
1611              /var/tmp/NameOfBackupFile
1612

RETURN CODES

1614       Cryptsetup returns 0 on success and a non-zero value on error.
1615
1616       Error  codes are: 1 wrong parameters, 2 no permission (bad passphrase),
1617       3 out of memory, 4 wrong device specified, 5 device already  exists  or
1618       device is busy.
1619

NOTES ON PASSPHRASE PROCESSING FOR PLAIN MODE

1621       Note  that  no  iterated  hashing or salting is done in plain mode.  If
1622       hashing is done, it is a single direct hash. This  means  that  low-en‐
1623       tropy passphrases are easy to attack in plain mode.
1624
1625       From  a  terminal: The passphrase is read until the first newline, i.e.
1626       '\n'.  The input without the newline character is  processed  with  the
1627       default  hash  or the hash specified with --hash.  The hash result will
1628       be truncated to the key size of the used cipher, or the size  specified
1629       with -s.
1630
1631       From stdin: Reading will continue until a newline (or until the maximum
1632       input size is reached), with the trailing newline stripped. The maximum
1633       input  size is defined by the same compiled-in default as for the maxi‐
1634       mum key file size and can be overwritten using --keyfile-size option.
1635
1636       The data read will be hashed with the default hash or the  hash  speci‐
1637       fied with --hash.  The hash result will be truncated to the key size of
1638       the used cipher, or the size specified with -s.
1639
1640       Note that if --key-file=- is used  for  reading  the  key  from  stdin,
1641       trailing newlines are not stripped from the input.
1642
1643       If  "plain"  is  used as argument to --hash, the input data will not be
1644       hashed. Instead, it will be zero padded (if shorter than the key  size)
1645       or truncated (if longer than the key size) and used directly as the bi‐
1646       nary key. This is useful for directly  specifying  a  binary  key.   No
1647       warning  will  be  given  if the amount of data read from stdin is less
1648       than the key size.
1649
1650       From a key file: It will be truncated to the key size of the  used  ci‐
1651       pher or the size given by -s and directly used as a binary key.
1652
1653       WARNING:  The  --hash  argument is being ignored.  The --hash option is
1654       usable only for stdin input in plain mode.
1655
1656       If the key file is shorter than the key, cryptsetup will quit  with  an
1657       error.   The  maximum input size is defined by the same compiled-in de‐
1658       fault as for the maximum key file size and  can  be  overwritten  using
1659       --keyfile-size option.
1660
1661
1662

NOTES ON PASSPHRASE PROCESSING FOR LUKS

1664       LUKS uses PBKDF2 to protect against dictionary attacks and to give some
1665       protection to low-entropy passphrases (see RFC 2898 and the  cryptsetup
1666       FAQ).
1667
1668       From  a  terminal:  The  passphrase is read until the first newline and
1669       then processed by PBKDF2 without the newline character.
1670
1671       From stdin: LUKS will read passphrases from stdin up to the first  new‐
1672       line  character  or  the compiled-in maximum key file length. If --key‐
1673       file-size is given, it is ignored.
1674
1675       From key file: The complete keyfile is read up to the compiled-in maxi‐
1676       mum  size.  Newline  characters  do not terminate the input. The --key‐
1677       file-size option can be used to limit what is read.
1678
1679       Passphrase processing: Whenever a passphrase is added to a LUKS  header
1680       (luksAddKey,  luksFormat),  the  user may specify how much the time the
1681       passphrase processing should consume. The time is used to determine the
1682       iteration  count  for PBKDF2 and higher times will offer better protec‐
1683       tion for low-entropy passphrases, but open will  take  longer  to  com‐
1684       plete.  For  passphrases  that  have  entropy  higher than the used key
1685       length, higher iteration times will not increase security.
1686
1687       The default setting of one or two seconds is sufficient for most  prac‐
1688       tical  cases.  The only exception is a low-entropy passphrase used on a
1689       device with a slow CPU, as this will result in a low  iteration  count.
1690       On  a  slow  device, it may be advisable to increase the iteration time
1691       using the --iter-time option in order  to  obtain  a  higher  iteration
1692       count. This does slow down all later luksOpen operations accordingly.
1693

INCOHERENT BEHAVIOR FOR INVALID PASSPHRASES/KEYS

1695       LUKS  checks  for a valid passphrase when an encrypted partition is un‐
1696       locked. The behavior of plain dm-crypt is different.   It  will  always
1697       decrypt  with  the  passphrase given. If the given passphrase is wrong,
1698       the device mapped by plain dm-crypt will essentially still contain  en‐
1699       crypted data and will be unreadable.
1700

NOTES ON SUPPORTED CIPHERS, MODES, HASHES AND KEY SIZES

1702       The  available combinations of ciphers, modes, hashes and key sizes de‐
1703       pend on kernel support. See /proc/crypto for a list  of  available  op‐
1704       tions. You might need to load additional kernel crypto modules in order
1705       to get more options.
1706
1707       For the --hash option, if the crypto backend is libgcrypt, then all al‐
1708       gorithms  supported  by  the  gcrypt  library are available.  For other
1709       crypto backends, some algorithms may be missing.
1710

NOTES ON PASSPHRASES

1712       Mathematics can't be bribed. Make sure you keep your passphrases  safe.
1713       There  are a few nice tricks for constructing a fallback, when suddenly
1714       out of the blue, your brain refuses to cooperate.  These fallbacks need
1715       LUKS,  as  it's  only  possible with LUKS to have multiple passphrases.
1716       Still, if your  attacker  model  does  not  prevent  it,  storing  your
1717       passphrase in a sealed envelope somewhere may be a good idea as well.
1718

NOTES ON RANDOM NUMBER GENERATORS

1720       Random Number Generators (RNG) used in cryptsetup are always the kernel
1721       RNGs without any modifications or additions to data stream produced.
1722
1723       There are two types  of  randomness  cryptsetup/LUKS  needs.  One  type
1724       (which always uses /dev/urandom) is used for salts, the AF splitter and
1725       for wiping deleted keyslots.
1726
1727       The second type is used for the volume (master) key. You can switch be‐
1728       tween  using  /dev/random  and /dev/urandom  here, see --use-random and
1729       --use-urandom options. Using /dev/random on a system without enough en‐
1730       tropy  sources can cause luksFormat to block until the requested amount
1731       of random data is gathered. In a low-entropy situation  (embedded  sys‐
1732       tem),  this  can  take a very long time and potentially forever. At the
1733       same time, using /dev/urandom in a low-entropy situation  will  produce
1734       low-quality  keys.  This is a serious problem, but solving it is out of
1735       scope for a mere man-page.  See urandom(4) for more information.
1736

AUTHENTICATED DISK ENCRYPTION (EXPERIMENTAL)

1738       Since Linux kernel version 4.12 dm-crypt  supports  authenticated  disk
1739       encryption.
1740
1741       Normal disk encryption modes are length-preserving (plaintext sector is
1742       of the same size as a ciphertext sector) and can provide only confiden‐
1743       tiality protection, but not cryptographically sound data integrity pro‐
1744       tection.
1745
1746       Authenticated modes require additional space per-sector for authentica‐
1747       tion  tag  and use Authenticated Encryption with Additional Data (AEAD)
1748       algorithms.
1749
1750       If you configure LUKS2 device with  data  integrity  protection,  there
1751       will  be  an  underlying dm-integrity device, which provides additional
1752       per-sector metadata space and also provide data journal  protection  to
1753       ensure  atomicity  of  data and metadata update.  Because there must be
1754       additional space for metadata and journal, the available space for  the
1755       device will be smaller than for length-preserving modes.
1756
1757       The  dm-crypt device then resides on top of such a dm-integrity device.
1758       All activation and deactivation of this device stack  is  performed  by
1759       cryptsetup, there is no difference in using luksOpen for integrity pro‐
1760       tected devices.  If you want to format LUKS2 device with data integrity
1761       protection, use --integrity option.
1762
1763       Since  dm-integrity doesn't support discards (TRIM), dm-crypt device on
1764       top of it inherits this, so integrity protection mode  doesn't  support
1765       discards either.
1766
1767       Some  integrity modes requires two independent keys (key for encryption
1768       and for authentication).  Both  these  keys  are  stored  in  one  LUKS
1769       keyslot.
1770
1771       WARNING:  All support for authenticated modes is experimental and there
1772       are only some modes available for now. Note that there are a  very  few
1773       authenticated  encryption algorithms that are suitable for disk encryp‐
1774       tion. You also cannot use CRC32 or any other  non-cryptographic  check‐
1775       sums (other than the special integrity mode "none"). If for some reason
1776       you want to have integrity control without using  authentication  mode,
1777       then  you  should  separately  configure  dm-integrity independently of
1778       LUKS2.
1779
1780

NOTES ON LOOPBACK DEVICE USE

1782       Cryptsetup is usually used directly on a block device  (disk  partition
1783       or  LVM  volume). However, if the device argument is a file, cryptsetup
1784       tries to allocate a loopback device and map it  into  this  file.  This
1785       mode  requires  Linux  kernel  2.6.25 or more recent which supports the
1786       loop autoclear flag (loop device is cleared on the last close automati‐
1787       cally). Of course, you can always map a file to a loop-device manually.
1788       See the cryptsetup FAQ for an example.
1789
1790       When device mapping is active, you can see the loop backing file in the
1791       status command output. Also see losetup(8).
1792

LUKS2 header locking

1794       The  LUKS2  on-disk metadata is updated in several steps and to achieve
1795       proper atomic update, there is a locking mechanism.  For  an  image  in
1796       file, code uses flock(2) system call.  For a block device, lock is per‐
1797       formed over a special file stored in a locking  directory  (by  default
1798       /run/lock/cryptsetup).   The  locking  directory should be created with
1799       the proper security context by  the  distribution  during  the  boot-up
1800       phase.  Only LUKS2 uses locks, other formats do not use this mechanism.
1801

DEPRECATED ACTIONS

1803       The reload action is no longer supported.  Please use dmsetup(8) if you
1804       need to directly manipulate with the device mapping table.
1805
1806       The luksDelKey was replaced with luksKillSlot.
1807

REPORTING BUGS

1809       Report bugs, including ones in the  documentation,  on  the  cryptsetup
1810       mailing  list at <dm-crypt@saout.de> or in the 'Issues' section on LUKS
1811       website.  Please attach the output of the failed command with the --de‐
1812       bug option added.
1813

AUTHORS

1815       cryptsetup originally written by Jana Saout <jana@saout.de>
1816       The LUKS extensions and original man page were written by Clemens Fruh‐
1817       wirth <clemens@endorphin.org>.
1818       Man page extensions by Milan Broz <gmazyland@gmail.com>.
1819       Man page rewrite and extension by Arno Wagner <arno@wagner.name>.
1820
1822       Copyright © 2004 Jana Saout
1823       Copyright © 2004-2006 Clemens Fruhwirth
1824       Copyright © 2012-2014 Arno Wagner
1825       Copyright © 2009-2021 Red Hat, Inc.
1826       Copyright © 2009-2021 Milan Broz
1827
1828       This is free software; see the source for copying conditions.  There is
1829       NO  warranty;  not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
1830       PURPOSE.
1831

SEE ALSO

1833       The LUKS website at https://gitlab.com/cryptsetup/cryptsetup/
1834
1835       The cryptsetup FAQ, contained in the distribution package and online at
1836       https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions
1837
1838       The cryptsetup mailing list and list archive, see FAQ entry 1.6.
1839
1840       The   LUKS   version   1  on-disk  format  specification  available  at
1841       https://gitlab.com/cryptsetup/cryptsetup/wikis/Specification  and  LUKS
1842       version 2 at https://gitlab.com/cryptsetup/LUKS2-docs.
1843
1844
1845
1846cryptsetup                       January 2021                    CRYPTSETUP(8)
Impressum