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              WARNING:  Always  create  a binary backup of the original header
840              before calling this command.
841
842       benchmark <options>
843
844              Benchmarks ciphers and KDF (key derivation  function).   Without
845              parameters, it tries to measure few common configurations.
846
847              To  benchmark  other ciphers or modes, you need to specify --ci‐
848              pher and --key-size options or --hash for KDF test.
849
850              NOTE: This benchmark is using memory only and is  only  informa‐
851              tive.  You cannot directly predict real storage encryption speed
852              from it.
853
854              For  testing  block  ciphers,  this  benchmark  requires  kernel
855              userspace crypto API to be available (introduced in Linux kernel
856              2.6.38).  If you are configuring kernel yourself, enable  "User-
857              space interface for symmetric key cipher algorithms" in "Crypto‐
858              graphic API" section (CRYPTO_USER_API_SKCIPHER .config option).
859
860              <options> can be [--cipher, --key-size, --hash].
861

OPTIONS

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

EXAMPLE

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

RETURN CODES

1607       Cryptsetup returns 0 on success and a non-zero value on error.
1608
1609       Error codes are: 1 wrong parameters, 2 no permission (bad  passphrase),
1610       3  out  of memory, 4 wrong device specified, 5 device already exists or
1611       device is busy.
1612

NOTES ON PASSPHRASE PROCESSING FOR PLAIN MODE

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

NOTES ON PASSPHRASE PROCESSING FOR LUKS

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

INCOHERENT BEHAVIOR FOR INVALID PASSPHRASES/KEYS

1688       LUKS checks for a valid passphrase when an encrypted partition  is  un‐
1689       locked.  The  behavior  of plain dm-crypt is different.  It will always
1690       decrypt with the passphrase given. If the given  passphrase  is  wrong,
1691       the  device mapped by plain dm-crypt will essentially still contain en‐
1692       crypted data and will be unreadable.
1693

NOTES ON SUPPORTED CIPHERS, MODES, HASHES AND KEY SIZES

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

NOTES ON PASSPHRASES

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

NOTES ON RANDOM NUMBER GENERATORS

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

AUTHENTICATED DISK ENCRYPTION (EXPERIMENTAL)

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

NOTES ON LOOPBACK DEVICE USE

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

LUKS2 header locking

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

DEPRECATED ACTIONS

1796       The reload action is no longer supported.  Please use dmsetup(8) if you
1797       need to directly manipulate with the device mapping table.
1798
1799       The luksDelKey was replaced with luksKillSlot.
1800

REPORTING BUGS

1802       Report  bugs,  including  ones  in the documentation, on the cryptsetup
1803       mailing list at <dm-crypt@saout.de> or in the 'Issues' section on  LUKS
1804       website.  Please attach the output of the failed command with the --de‐
1805       bug option added.
1806

AUTHORS

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

SEE ALSO

1826       The LUKS website at https://gitlab.com/cryptsetup/cryptsetup/
1827
1828       The cryptsetup FAQ, contained in the distribution package and online at
1829       https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions
1830
1831       The cryptsetup mailing list and list archive, see FAQ entry 1.6.
1832
1833       The  LUKS  version  1  on-disk  format   specification   available   at
1834       https://gitlab.com/cryptsetup/cryptsetup/wikis/Specification  and  LUKS
1835       version 2 at https://gitlab.com/cryptsetup/LUKS2-docs.
1836
1837
1838
1839cryptsetup                       January 2021                    CRYPTSETUP(8)
Impressum