dm-init.rst 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. ================================
  2. Early creation of mapped devices
  3. ================================
  4. It is possible to configure a device-mapper device to act as the root device for
  5. your system in two ways.
  6. The first is to build an initial ramdisk which boots to a minimal userspace
  7. which configures the device, then pivot_root(8) in to it.
  8. The second is to create one or more device-mappers using the module parameter
  9. "dm-mod.create=" through the kernel boot command line argument.
  10. The format is specified as a string of data separated by commas and optionally
  11. semi-colons, where:
  12. - a comma is used to separate fields like name, uuid, flags and table
  13. (specifies one device)
  14. - a semi-colon is used to separate devices.
  15. So the format will look like this::
  16. dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+]
  17. Where::
  18. <name> ::= The device name.
  19. <uuid> ::= xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ""
  20. <minor> ::= The device minor number | ""
  21. <flags> ::= "ro" | "rw"
  22. <table> ::= <start_sector> <num_sectors> <target_type> <target_args>
  23. <target_type> ::= "verity" | "linear" | ... (see list below)
  24. The dm line should be equivalent to the one used by the dmsetup tool with the
  25. `--concise` argument.
  26. Target types
  27. ============
  28. Not all target types are available as there are serious risks in allowing
  29. activation of certain DM targets without first using userspace tools to check
  30. the validity of associated metadata.
  31. ======================= =======================================================
  32. `cache` constrained, userspace should verify cache device
  33. `crypt` allowed
  34. `delay` allowed
  35. `era` constrained, userspace should verify metadata device
  36. `flakey` constrained, meant for test
  37. `linear` allowed
  38. `log-writes` constrained, userspace should verify metadata device
  39. `mirror` constrained, userspace should verify main/mirror device
  40. `raid` constrained, userspace should verify metadata device
  41. `snapshot` constrained, userspace should verify src/dst device
  42. `snapshot-origin` allowed
  43. `snapshot-merge` constrained, userspace should verify src/dst device
  44. `striped` allowed
  45. `switch` constrained, userspace should verify dev path
  46. `thin` constrained, requires dm target message from userspace
  47. `thin-pool` constrained, requires dm target message from userspace
  48. `verity` allowed
  49. `writecache` constrained, userspace should verify cache device
  50. `zero` constrained, not meant for rootfs
  51. ======================= =======================================================
  52. If the target is not listed above, it is constrained by default (not tested).
  53. Examples
  54. ========
  55. An example of booting to a linear array made up of user-mode linux block
  56. devices::
  57. dm-mod.create="lroot,,,rw, 0 4096 linear 98:16 0, 4096 4096 linear 98:32 0" root=/dev/dm-0
  58. This will boot to a rw dm-linear target of 8192 sectors split across two block
  59. devices identified by their major:minor numbers. After boot, udev will rename
  60. this target to /dev/mapper/lroot (depending on the rules). No uuid was assigned.
  61. An example of multiple device-mappers, with the dm-mod.create="..." contents
  62. is shown here split on multiple lines for readability::
  63. dm-linear,,1,rw,
  64. 0 32768 linear 8:1 0,
  65. 32768 1024000 linear 8:2 0;
  66. dm-verity,,3,ro,
  67. 0 1638400 verity 1 /dev/sdc1 /dev/sdc2 4096 4096 204800 1 sha256
  68. ac87db56303c9c1da433d7209b5a6ef3e4779df141200cbd7c157dcb8dd89c42
  69. 5ebfe87f7df3235b80a117ebc4078e44f55045487ad4a96581d1adb564615b51
  70. Other examples (per target):
  71. "crypt"::
  72. dm-crypt,,8,ro,
  73. 0 1048576 crypt aes-xts-plain64
  74. babebabebabebabebabebabebabebabebabebabebabebabebabebabebabebabe 0
  75. /dev/sda 0 1 allow_discards
  76. "delay"::
  77. dm-delay,,4,ro,0 409600 delay /dev/sda1 0 500
  78. "linear"::
  79. dm-linear,,,rw,
  80. 0 32768 linear /dev/sda1 0,
  81. 32768 1024000 linear /dev/sda2 0,
  82. 1056768 204800 linear /dev/sda3 0,
  83. 1261568 512000 linear /dev/sda4 0
  84. "snapshot-origin"::
  85. dm-snap-orig,,4,ro,0 409600 snapshot-origin 8:2
  86. "striped"::
  87. dm-striped,,4,ro,0 1638400 striped 4 4096
  88. /dev/sda1 0 /dev/sda2 0 /dev/sda3 0 /dev/sda4 0
  89. "verity"::
  90. dm-verity,,4,ro,
  91. 0 1638400 verity 1 8:1 8:2 4096 4096 204800 1 sha256
  92. fb1a5a0f00deb908d8b53cb270858975e76cf64105d412ce764225d53b8f3cfd
  93. 51934789604d1b92399c52e7cb149d1b3a1b74bbbcb103b2a0aaacbed5c08584