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