dm-crypt.txt 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. dm-crypt
  2. =========
  3. Device-Mapper's "crypt" target provides transparent encryption of block devices
  4. using the kernel crypto API.
  5. Parameters: <cipher> <key> <iv_offset> <device path> \
  6. <offset> [<#opt_params> <opt_params>]
  7. <cipher>
  8. Encryption cipher and an optional IV generation mode.
  9. (In format cipher[:keycount]-chainmode-ivopts:ivmode).
  10. Examples:
  11. des
  12. aes-cbc-essiv:sha256
  13. twofish-ecb
  14. /proc/crypto contains supported crypto modes
  15. <key>
  16. Key used for encryption. It is encoded as a hexadecimal number.
  17. You can only use key sizes that are valid for the selected cipher.
  18. <keycount>
  19. Multi-key compatibility mode. You can define <keycount> keys and
  20. then sectors are encrypted according to their offsets (sector 0 uses key0;
  21. sector 1 uses key1 etc.). <keycount> must be a power of two.
  22. <iv_offset>
  23. The IV offset is a sector count that is added to the sector number
  24. before creating the IV.
  25. <device path>
  26. This is the device that is going to be used as backend and contains the
  27. encrypted data. You can specify it as a path like /dev/xxx or a device
  28. number <major>:<minor>.
  29. <offset>
  30. Starting sector within the device where the encrypted data begins.
  31. <#opt_params>
  32. Number of optional parameters. If there are no optional parameters,
  33. the optional paramaters section can be skipped or #opt_params can be zero.
  34. Otherwise #opt_params is the number of following arguments.
  35. Example of optional parameters section:
  36. 1 allow_discards
  37. allow_discards
  38. Block discard requests (a.k.a. TRIM) are passed through the crypt device.
  39. The default is to ignore discard requests.
  40. WARNING: Assess the specific security risks carefully before enabling this
  41. option. For example, allowing discards on encrypted devices may lead to
  42. the leak of information about the ciphertext device (filesystem type,
  43. used space etc.) if the discarded blocks can be located easily on the
  44. device later.
  45. Example scripts
  46. ===============
  47. LUKS (Linux Unified Key Setup) is now the preferred way to set up disk
  48. encryption with dm-crypt using the 'cryptsetup' utility, see
  49. http://code.google.com/p/cryptsetup/
  50. [[
  51. #!/bin/sh
  52. # Create a crypt device using dmsetup
  53. dmsetup create crypt1 --table "0 `blockdev --getsize $1` crypt aes-cbc-essiv:sha256 babebabebabebabebabebabebabebabe 0 $1 0"
  54. ]]
  55. [[
  56. #!/bin/sh
  57. # Create a crypt device using cryptsetup and LUKS header with default cipher
  58. cryptsetup luksFormat $1
  59. cryptsetup luksOpen $1 crypt1
  60. ]]