updated
[platform/upstream/cryptsetup.git] / FAQ
1 Sections 
2
3 1. General Questions
4 2. Setup
5 3. Common Problems
6 4. Troubleshooting
7 5. Security Aspects
8 6. Backup and Data Recovery
9 7. Issues with Specific Versions of cryptsetup
10 A. Contributors
11
12
13 1. General Questions 
14
15
16   * What is this?
17
18   This is the FAQ (Frequently Asked Questions) for cryptsetup. It
19   covers Linux disk encryption with plain dm-crypt (one passphrase,
20   no management, no descriptor on disk) and LUKS (multiple user keys
21   with one master key, anti-forensics, descriptor block at start of
22   device, ...). The latest version should usually be available at
23   http://code.google.com/p/cryptsetup/wiki/FrequentlyAskedQuestions
24
25   ATTENTION: If you are going to read just one thing, make it the
26   section on Backup and Data Recovery. By far the most questions on
27   the cryptsetup mailing list are from people that just managed to
28   somehow format or overwrite the start of their LUKS partitions.
29   Usually, there is nothing that can be done to help these poor souls
30   recover their data. Make sure you understand the problem and
31   limitations imposed by the LUKS security model BEFORE you face such
32   a disaster!
33
34
35   * Who wrote this?
36
37   Current FAQ maintainer is Arno Wagner <arno@wagner.name>. Other
38   contributors are listed at the end. If you want to contribute, send
39   your article, including a descriptive headline, to the maintainer,
40   or the dm-crypt mailing list with something like "FAQ ..." in the
41   subject. Please note that by contributing to this FAQ, you accept
42   the license described below.
43
44   This work is under the "Attribution-Share Alike 3.0 Unported"
45   license, which means distribution is unlimited, you may create
46   derived works, but attributions to original authors and this
47   license statement must be retained and the derived work must be
48   under the same license. See
49   http://creativecommons.org/licenses/by-sa/3.0/ for more details of
50   the license.
51
52   Side note: I did text license research some time ago and I think
53   this license is best suited for the purpose at hand and creates the
54   least problems.
55
56
57 2. Setup 
58
59
60   * Can I encrypt an already existing, non-empty partition to use
61   LUKS?
62
63   There is no converter, and it is not really needed. The way to do
64   this is to make a backup of the device in question, securely wipe
65   the device (as LUKS device initialization does not clear away old
66   data), do a luksFormat, optionally overwrite the encrypted device,
67   create a new filesystem and restore your backup on the now
68   encrypted device. Also refer to sections "Security Aspects" and
69   "Backup and Data Recovery".
70
71   For backup, plain GNU tar works well and backs up anything likely
72   to be in a filesystem.
73
74
75   * How do I use LUKS with a loop-device?
76
77   Just the same as with any block device. If you want, for example,
78   to use a 100MiB file as LUKS container, do something like this:
79
80       head -c 100M /dev/zero > luksfile   # create empty file
81       losetup /dev/loop0 luksfile         # map luksfile to /dev/loop0
82       cryptsetup luksFormat /dev/loop0    # create LUKS on the loop device
83  
84   Afterwards just use /dev/loop0 as a you would use a LUKS partition.
85   To unmap the file when done, use "losetup -d /dev/loop0".
86
87
88   * When I add a new key-slot to LUKS, it asks for a passphrase but
89   then complains about there not being a key-slot with that
90   passphrase?
91
92   That is as intended. You are asked a passphrase of an existing
93   key-slot first, before you can enter the passphrase for the new
94   key-slot. Otherwise you could break the encryption by just adding a
95   new key-slot. This way, you have to know the passphrase of one of
96   the already configured key-slots in order to be able to configure a
97   new key-slot.
98
99
100   * How do I read a dm-crypt key from file?
101
102   Note that the file will still be hashed first, just like keyboard
103   input. Use the --key-file option, like this:
104
105       cryptsetup create --key-file keyfile e1 /dev/loop0
106  
107
108   * How do I read a LUKS slot key from file?
109
110   What you really do here is to read a passphrase from file, just as
111   you would with manual entry of a passphrase for a key-slot. You can
112   add a new passphrase to a free key-slot, set the passphrase of an
113   specific key-slot or put an already configured passphrase into a
114   file. In the last case make sure no trailing newline (0x0a) is
115   contained in the key file, or the passphrase will not work because
116   the whole file is used as input.
117
118   To add a new passphrase to a free key slot from file, use something
119   like this:
120
121       cryptsetup luksAddKey /dev/loop0 keyfile
122  
123   To add a new passphrase to a specific key-slot, use something like
124   this:
125
126       cryptsetup luksAddKey --key-slot 7 /dev/loop0 keyfile
127  
128   To supply a key from file to any LUKS command, use the --key-file
129   option, e.g. like this:
130
131       cryptsetup luksOpen --key-file keyfile /dev/loop0 e1
132  
133
134   * How do I read the LUKS master key from file?
135
136   The question you should ask yourself first, is why you would want
137   to do this. The only legitimate reason I can think of is if you
138   want to have two LUKS devices with the same master key. Even then,
139   I think it would be preferable to just use key-slots with the same
140   passphrase, or to use plain dm-crypt instead. If you really have a
141   good reason, please tell me. If I am convinced, I will add how to
142   do this here.
143
144
145   * What are the security requirements for a key read from file?
146
147   A file-stored key or passphrase has the same security requirements
148   as one entered interactively, however you can use random bytes and
149   thereby use bytes you cannot type on the keyboard. You can use any
150   file you like as key file, for example a plain text file with a
151   human readable passphrase. To generate a file with random bytes,
152   use something like this:
153
154       head -c 256 /dev/random > keyfile
155  
156
157   * If I map a journaled file system using dm-crypt/LUKS, does it
158   still provide its usual transactional guarantees?
159
160   As far as I know you do (but I may be wrong), but please note that
161   these "guarantees" are far weaker than they appear to be. For
162   example, you not not get a hard flush to disk surface even on a
163   call to fsync. In addition, the HDD itself may do independent
164   write reordering. Some other things can go wrong as well. The
165   filesystem developers are aware of these problems and typically
166   can make it work anyways. That said, dm-crypt/LUKS should not make
167   things worse.
168
169   Personally, I have several instances of ext3 on dm-crypt and have
170   not noticed any specific issues so far.
171
172   Update: I did run into frequent small freezes (1-2 sec) when putting
173   a vmware image on ext3 over dm-crypt. This does indicate that the
174   transactional guarantees are in place, but at a cost. When I went
175   back to ext2, the problem went away.
176
177
178   * Can I use LUKS or cryptsetup with a more secure (external) medium
179   for key storage, e.g. TPM or a smartcard?
180
181   Yes, see the answers on using a file-supplied key. You do have to
182   write the glue-logic yourself though. Basically you can have
183   cryptsetup read the key from STDIN and write it there with your
184   own tool that in turn gets the key from the more secure key
185   storage.
186
187
188   * Can I resize a dm-crypt or LUKS partition?
189
190   Yes, you can, as neither dm-crypt nor LUKS stores partition size.
191   Whether you should is a different question. Personally I recommend
192   backup, recreation of the encrypted partition with new size,
193   recreation of the filesystem and restore. This gets around the
194   tricky business of resizing the filesystem. The backup is really
195   non-optional here, as a lot can go wrong, resulting in partial or
196   complete data loss. Using something like gparted to resize an
197   encrypted partition is slow, but pretty safe and should be fine.
198   This will not change the size of the filesystem hidden under the
199   encryption though.
200
201   You also need to be aware of size-based limitations. The one
202   currently relevant is that aes-xts-plain should not be used for
203   encrypted container sizes larger than 2TiB. Use aes-xts-plain64
204   for that.
205
206
207 3. Common Problems 
208
209
210   * My dm-crypt/LUKS mapping does not work! What general steps are
211   there to investigate the problem?
212
213   If you get a specific error message, investigate what it claims
214   first. If not, you may want to check the following things.
215
216   - Check that "/dev", including "/dev/mapper/control" is there. If it is 
217   missing, you may have a problem with the "/dev" tree itself or you
218   may have broken udev rules.
219
220   - Check that you have the device mapper and the crypt target in your kernel.
221   The output of "dmsetup targets" should list a "crypt" target. If it
222   is not there or the command fails, add device mapper and
223   crypt-target to the kernel.
224
225   - Check that the hash-functions and ciphers you want to use are in the kernel.
226   The output of "cat /proc/crypto" needs to list them.
227
228
229   * My dm-crypt mapping suddenly stopped when upgrading cryptsetup.
230
231   The default cipher, hash or mode may have changed (the mode changed
232   from 1.0.x to 1.1.x). See under "Issues With Specific Versions of
233   cryptsetup".
234
235
236   * When I call cryptsetup from cron/CGI, I get errors about unknown
237   features?
238
239   If you get errors about unknown parameters or the like that are not
240   present when cryptsetup is called from the shell, make sure you
241   have no older version of cryptsetup on your system that then gets
242   called by cron/CGI.For example some distributions install
243   cryptsetup into /usr/sbin, while a manual install could go to
244   /usr/local/sbin. As a debugging aid, call "cryptsetup --version"
245   from cron/CGI or the non-shell mechanism to be sure you have the
246   right version.
247
248
249   * Unlocking a LUKS device takes very long. Why?
250
251   The iteration time for every key-slot (iteration is needed to
252   prevent dictionary attacks) is calculated during the luksFormat
253   operation. By default it is 1 second on the machine where the
254   format operation is done. If you format a device on a fast machine
255   and then unlock it on a slow machine, the unlocking time can be
256   much more longer. Also take into account that up to 8 key-slots
257   have to be tried in order to find the right one.
258
259   If this is problem, you can add another key-slot using the slow
260   machine with the same passphrase and then remove the old key-slot.
261   The new key-slot will have an iteration count adjusted to 1 second
262   on the slow machine. Use luksKeyAdd and then luksKillSlot or
263   luksRemoveKey. However, this operation will not change volume key
264   iteration count. In order to change that, you will have to backup
265   the data in the LUKS container, luksFormat on the slow machine and
266   restore the data.
267
268
269   * "blkid" sees a LUKS UUID and an ext2/swap UUID on the same device.
270   What is wrong?
271
272   Some old versions of cryptsetup have a bug where the header does
273   not get completely wiped during LUKS format and an older ext2/swap
274   signature remains on the device. This confuses blkid.
275
276   Fix: Wipe the unused header areas by doing a backup and restore of
277   the header with cryptsetup 1.1.x:
278
279       cryptsetup luksHeaderBackup --header-backup-file <file> <device>
280       cryptsetup luksHeaderRestore --header-backup-file <file> <device>
281  
282   If you cannot use a 1.1.x cryptsetup, you can also do a manual wipe
283   of the area in question with the command below. Be very, VERY,
284   careful and make sure to do a backup of the header before. If you
285   get this wrong, your device may become permanently inaccessible.
286
287       dd if=/dev/zero of=<device> bs=512 seek=2 count=6
288    
289
290   * cryptsetup segfaults on Gentoo amd64 hardened ...
291
292   There seems to be some inteference between the hardening and and
293   the way cryptsetup benchmarks PBKDF2. The solution to this is
294   currently not quite clear for an encrypted root filesystem.     For
295   other uses, you can apparently specify USE="dynamic" as compile
296   flag, see http://bugs.gentoo.org/show_bug.cgi?id=283470
297
298
299 4. Troubleshooting 
300
301
302   * Can a bad RAM module cause problems?
303
304   LUKS and dm-crypt can give the RAM quite a workout, especially when
305   combined with software RAID. In particular the combination RAID5 +
306   LUKS + XFS seems to uncover RAM problems that never caused obvious
307   problems before. Symptoms vary, but often the problem manifest
308   itself when copying large amounts of data, typically several times
309   larger than your main memory.
310
311   Side note: One thing you should always do on large data movements is
312   to run a verify, for example with the "-d" option of "tar" or by
313   doing a set of MD5 checksums on the source or target with
314
315       find . -type f -exec md5sum \{\} \; > checksum-file
316  
317   and then a "md5sum -c checksum-file" on the other side. If you get
318   mismatches here, RAM is the primary suspect. A lesser suspect is
319   an overclocked CPU. I have found countless hardware problems in
320   verify runs after copying or making backups. Bit errors are much
321   more common than most people think.
322
323   Some RAM issues are even worse and corrupt structures in one of the
324   layers. This typically results in lockups, CPU state dumps in the
325   system logs, kernel panic or other things. It is quite possible to
326   have the problem with an encrypted device, but not with an
327   otherwise the same unencrypted device. The reason for that is that
328   encryption has an error amplification property: You flip one bit
329   in an encrypted data block, and the decrypted version has half of
330   its bits flipped. This is an important security property for modern
331   ciphers. With the usual modes in cryptsetup (CBC, ESSIV, XTS), you
332   get up to a completely changed 512 byte block per bit error. A
333   corrupt block causes a lot more havoc than the occasionally
334   flipped single bit and can result various obscure errors.
335
336   Note however that a verify run on copying between encrypted or
337   unencrypted devices can also show you corruption when the copying
338   itself did not report any problems. If you find defect RAM, assume
339   all backups and copied data to be suspect, unless you did a verify.
340
341
342   * How do I test RAM?
343
344   First you should know that overclocking often makes memory problems
345   worse. So if you overclock (which I strongly recommend against in a
346   system holding data that has some worth), run the tests with the
347   overclocking active.
348
349   There are two good options. One is Memtest86+ and the other is
350   "memtester" by Charles Cazabon. Memtest86+ requires a reboot and
351   then takes over the machine, while memtester runs from a
352   root-shell. Both use different testing methods and I have found
353   problems fast with each one that the other needed long to find. I
354   recommend running the following procedure until the first error is
355   found:
356
357   - Run Memtest86+ for one cycle 
358   - Run memterster for one cycle (shut down as many other applications as possible)
359   - Run Memtest86+ for 24h or more
360   - Run memtester for 24h or more  
361   If all that does not produce error messages, your RAM may be sound,
362   but I have had one weak bit that Memtest86+ needed around 60 hours
363   to find. If you can reproduce the original problem reliably, a good
364   additional test may be to remove half of the RAM (if you have more
365   than one module) and try whether the problem is still there and if
366   so, try with the other half. If you just have one module, get a
367   different one and try with that. If you do overclocking, reduce
368   the settings to the most conservative ones available and try with
369   that.
370
371
372 5. Security Aspects 
373
374
375   * Should I initialize (overwrite) a new LUKS/dm-crypt partition?
376
377   If you just create a filesystem on it, most of the old data will
378   still be there. If the old data is sensitive, you should overwrite
379   it before encrypting. In any case, not initializing will leave the
380   old data there until the specific sector gets written. That may
381   enable an attacker to determine how much and where on the
382   partition data was written. If you think this is a risk, you can
383   prevent this by overwriting the encrypted device (here assumed to
384   be named "e1") with zeros like this:
385
386       dd_rescue -w /dev/zero /dev/mapper/e1
387  
388  or alternatively with one of the following more standard commands:
389
390       cat /dev/zero > /dev/mapper/e1
391       dd if=/dev/zero of=/dev/mapper/e1
392        
393
394   * How do I securely erase a LUKS (or other) partition?
395
396   For LUKS, if you are in a desperate hurry, overwrite the first few
397   kilobytes of the LUKS partition. This erases the salts and makes
398   access impossible. However a LUKS header backup or full backup will
399   still grant access to most or all data.
400
401   To do this right, overwrite the whole LUKS partition with a single
402   pass of zeros. This is enough for current HDDs. For SDDs you may
403   want to erase the whole drive several times to be sure data is not
404   retained by wear leveling. This is possibly insecure as SDD
405   technology is not fully understood in this regard. Still, due to
406   the anti-forensic properties of the LUKS key-slots, a single
407   overwrite of an SSD could be enough. If in doubt, use physical
408   destruction in addition. Keep in mind to also erase all backups.
409
410   Example for a zero-overwrite erase of partition sda10 done with
411   dd_rescue:
412
413       dd_rescue -w /dev/zero /dev/sda10   
414  
415
416   * How do I securely erase a backup of a LUKS partition or header?
417
418   That depends on the medium it is stored on. For HDD and SSD, use
419   overwrite with zeros. For an SSD, you may want to overwrite the
420   complete SSD several times and use physical destruction in addition,
421   see last item. Treat USB flash drives the same as SSDs. For
422   re-writable CD/DVD, a single overwrite should also be enough, due
423   to the anti-forensic properties of the LUKS keyslots. For
424   write-once media, use physical destruction. For low security
425   requirements, just cut the CD/DVD into several parts. For high
426   security needs, shred or burn the medium. If your backup is on
427   magnetic tape, I advise physical destruction by shredding or
428   burning. The problem with magnetic tape is that it has a higher
429   dynamic range than HDDs and older data may well be recoverable
430   after overwrites. Also write-head alignment issues can lead to
431   data not actually being deleted at all during overwrites.
432
433
434   * What about backup? Does it compromise security?
435
436   That depends. See next section.
437
438
439   * Why was the default aes-cbc-plain replaced with aes-cbc-essiv?
440
441   The problem is that cbc-plain has a fingerprint vulnerability, where
442   a specially crafted file placed into the crypto-container can be
443   recognized from the outside. The issue here is that for cbc-plain
444   the initialization vector (IV) is the sector number. The IV gets
445   XORed to the first data chunk of the sector to be encrypted. If you
446   make sure that the first data block to be stored in a sector
447   contains the sector number as well, the first data block to be
448   encrypted is all zeros and always encrypted to the same ciphertext.
449   This also works if the first data chunk just has a constant XOR
450   with the sector number. By having several shifted patterns you can
451   take care of the case of a non-power-of-two start sector number of
452   the file.
453
454   This mechanism allows you to create a pattern of sectors that have
455   the same first ciphertext block and signal one bit per sector to the
456   outside, allowing you to e.g. mark media files that way for
457   recognition without decryption. For large files this is a
458   practical attack. For small ones, you do not have enough blocks to
459   signal and take care of different file starting offsets.
460
461   In order to prevent this attack, the default was changed to
462   cbc-essiv. ESSIV uses a keyed hash of the sector number, with the
463   encryption key as key. This makes the IV unpredictable without
464   knowing the encryption key and the watermarking attack fails.
465
466
467   * Are there any problems with "plain" IV? What is "plain64"?
468
469   First, "plain" and "plain64" are both not safe to use with CBC, see
470   previous FAQ item.
471
472   However there are modes, like XTS, that are secure with "plain" IV.
473   The next limit is that "plain" is 64 bit, with the upper 32 bit set
474   to zero. This means that on volumes larger than 2TiB, the IV
475   repeats, creating a vulnerability that potentially leaks some
476   data. To avoid this, use "plain64", which uses the full sector
477   number up to 64 bit. Note that "plain64" requires a kernel >=
478   2.6.33. Also note that "plain64" is backwards compatible for
479   volume sizes <= 2TiB, but not for those > 2TiB. Finally, "plain64"
480   does not cause any performance penalty compared to "plain".
481
482
483   * What about XTS mode?
484
485   XTS mode is potentially even more secure than cbc-essiv (but only if
486   cbc-essiv is insecure in your scenario). It is a NIST standard and
487   used, e.g. in Truecrypt. At the moment, if you want to use it, you
488   have to specify it manually as "aes-xts-plain", i.e.
489
490       cryptsetup -c aes-xts-plain luksFormat <device>
491  
492   For volumes >2TiB and kernels >= 2.6.33 use "plain64" (see FAQ
493   item on "plain" and "plain64"):
494
495       cryptsetup -c aes-xts-plain64 luksFormat <device>
496  
497   There is a potential security issue with XTS mode and large blocks.
498   LUKS and dm-crypt always use 512B blocks and the issue does not
499   apply.
500
501
502 6. Backup and Data Recovery 
503
504
505   * Does a backup compromise security?
506
507   Depends on how you do it. First, a backup is non-optional with
508   encrypted data just the same way it is with non-encrypted data.
509   Disks do break and they do not care whether they make plain or
510   encrypted data inaccessible.
511
512   However there are risks introduced by backups. For example if you
513   change/disable a key-slot in LUKS, a binary backup of the partition
514   will still have the old key-slot. To deal with this, you have to
515   be able to change the key-slot on the backup as well, or use a
516   different set-up. One option is to have a different passphrase on
517   the backup and to make the backup with both containers open.
518   Another one is to make a backup of the original, opened container to
519   a single file, e.g. with tar, and to encrypt that file with
520   public-key-cryptography, e.g. with GnuPG. You can then keep the
521   secret key in a safe place, because it is only used to decrypt a
522   backup. The key the backup is encrypted with can be stored without
523   special security measures, as long as an attacker cannot replace
524   it with his own key.
525
526   If you use dm-crypt, backup is simpler: As there is no key
527   management, the main risk is that you cannot wipe the backup when
528   wiping the original. However wiping the original for dm-crypt
529   should consist of forgetting the passphrase and that you can do
530   without actual access to the backup.
531
532   In both cases, there is an additional (usually small) risk: An
533   attacker can see how many sectors and which ones have been changed
534   since the backup. This is not possible with the public-key method
535   though.
536
537   My personal advice is to use one USB disk (low value date) or three
538   disks (high value data) in rotating order for backups, and either
539   use different passphrases or keep them easily accessible in case
540   you need to disable a key-slot. If you do network-backup or
541   tape-backup, I strongly recommend to go the public-key path,
542   especially as you typically cannot reliably delete data in these
543   scenarios. (Well, you can burn the tape if it is under your
544   control...)
545
546
547   * What happens if I overwrite the start of a LUKS partition or
548   damage the LUKS header or key-slots?
549
550   There are two critical components for decryption: The salt values
551   in the header itself and the key-slots. If the salt values are
552   overwritten or changed, nothing (in the cryptographically strong
553   sense) can be done to access the data, unless there is a backup of
554   the LUKS header. If a key-slot is damaged, the data can still be
555   read with a different key-slot, if there is a remaining undamaged
556   and used key-slot. Note that in order to make a key-slot
557   unrecoverable in a cryptographically strong sense, changing about
558   4-6 bits in random locations of its 128kiB size is quite enough.
559
560
561   * What happens if I (quick) format a LUKS partition?
562
563   I have not tried the different ways to do this, but very likely you
564   will have written a new boot-sector, which in turn overwrites the
565   LUKS header, including the salts. You may also damage the key-slots
566   in part or in full. See also last item.
567
568
569   * What does the on-disk structure of dm-crypt look like?
570
571   There is none. dm-crypt takes a block device and gives encrypted
572   access to each of its blocks with a key derived from the passphrase
573   given. If you use a cipher different than the default, you have to
574   specify that as a parameter to cryptsetup too. If you want to
575   change the password, you basically have to create a second
576   encrypted device with the new passphrase and copy your data over.
577   On the plus side, if you accidentally overwrite any part of a
578   dm-crypt device, the damage will be limited to the are you
579   overwrote.
580
581
582   * What does the on-disk structure of LUKS look like?
583
584   A LUKS partition consists of a header, followed by 8 key-slot
585   descriptors, followed by 8 key slots, followed by the encrypted
586   data area.
587
588   Header and key-slot descriptors fill the first 592 bytes. The
589   key-slot size depends on the creation parameters, namely on the
590   number of anti-forensic stripes and on key block alignment.
591
592   With 4000 stripes (the default), each key-slot is a bit less than
593   128kiB in size. Due to sector alignment of the key-slot start,
594   that means the key block 0 is at offset 0x1000-0x20400, key block
595   1 at offset 0x21000-0x40400, and key block 7 at offset
596   0xc1000-0xe0400. The space to the next full sector address is
597   padded with zeros. Never used key-slots are filled with what the
598   disk originally contained there, a key-slot removed with
599   "luksRemoveKey" or "luksKillSlot" gets filled with 0xff. Start of
600   bulk data (with the default 4000 stripes and 8 key-slots) is at
601   0x101000, i.e. at 1'052'672 bytes, i.e. at 1MiB + 4096 bytes from
602   the start of the partition. This is also the value given by command
603   "luksDump" with "Payload offset: 2056", just multiply by the sector
604   size (512 bytes). Incidentally, "luksHeaderBackup" dumps exactly
605   the first 1'052'672 bytes to file and "luksHeaderRestore" restores
606   them.
607
608   The exact specification of the format is here:
609   http://code.google.com/p/cryptsetup/wiki/Specification
610
611
612   * How do I backup a LUKS header?
613
614   While you could just copy the appropriate number of bytes from the
615   start of the LUKS partition, the best way is to use command option
616   "luksHeaderBackup" of cryptsetup. This protects also against errors
617   when non-standard parameters have been used in LUKS partition
618   creation. Example:
619
620  
621       cryptsetup luksHeaderBackup --header-backup-file h_bak /dev/mapper/c1
622  
623
624   * How do I backup a LUKS partition?
625
626   You do a sector-image of the whole partition. This will contain the
627   LUKS header, the keys-slots and the data ares. It can be done
628   under Linux e.g. with dd_rescue (for a direct image copy) and with
629   "cat" or "dd". Example:
630
631       cat /dev/sda10 > sda10.img
632       dd_rescue /dev/sda10 sda10.img 
633  
634   You can also use any other backup software that is capable of making
635   a sector image of a partition. Note that compression is
636   ineffective for encrypted data, hence it does not sense to use it.
637
638
639   * Do I need a backup of the full partition? Would the header and
640   key-slots not be enough?
641
642   Backup protects you against two things: Disk loss or corruption and
643   user error. By far the most questions on the dm-crypt mailing list
644   about how to recover a damaged LUKS partition are related to user
645   error. For example, if you create a new filesystem on a LUKS
646   partition, chances are good that all data is lost permanently.
647
648   For this case, a header+key-slot backup would often be enough. But
649   keep in mind that a HDD has roughly a failure risk of 5% per year.
650   It is highly advisable to have a complete backup to protect against
651   this case.
652
653
654   * Are there security risks from a backup of the LUKS header or a
655   whole LUKS partition?
656
657   Yes. One risk is that if you remove access rights for specific
658   key-slots by deleting their contents, the data can still be
659   accessed with invalidated passphrase and the backup. The other risk
660   is that if you erase a LUKS partition, a backup could still grant
661   access, especially if you only erased the LUKS header and not the
662   whole partition.
663
664
665   * I think this is overly complicated. Is there an alternative?
666
667   Yes, you can use plain dm-crypt. It does not allow multiple
668   passphrases, but on the plus side, it has zero on disk description
669   and if you overwrite some part of a plain dm-crypt partition,
670   exactly the overwritten parts are lost (rounded up to sector
671   borders).
672
673
674 7. Issues with Specific Versions of cryptsetup 
675
676
677   * When using the create command for plain dm-crypt with cryptsetup
678   1.1.x, the mapping is incompatible and my data is not accessible
679   anymore!
680
681   With cryptsetup 1.1.x, the distro maintainer can define different
682   default encryption modes for LUKS and plain devices. You can check
683   these compiled-in defaults using "cryptsetup --help". Moreover, the
684   plain device default changed because the old IV mode was
685   vulnerable to a watermarking attack.
686
687   If you are using a plain device and you need a compatible mode, just
688   specify cipher, key size and hash algorithm explicitly. For
689   compatibility with cryptsetup 1.0.x defaults, simple use the
690   following:
691
692       cryptsetup create -c aes-cbc-plain -s 256 -h ripemd160 <name> <device>
693  
694    LUKS stores cipher and mode in the metadata on disk, avoiding this
695   problem.
696
697
698   * cryptsetup on SLED 10 has problems...
699
700   SLED 10 is missing an essential kernel patch for dm-crypt, which
701   is broken in its kernel as a result. There may be a very old
702   version of cryptsetup (1.0.x) provided by SLED, which should also
703   not be used anymore as well. My advice would be to drop SLED 10.
704
705  A. Contributors In no particular order:
706
707   - Arno Wagner
708   - Milan Broz