| Boot time creation of mapped devices |
| ==================================== |
| It is possible to configure a device mapper device to act as the root |
| device for your system in two ways. |
| |
| The first is to build an initial ramdisk which boots to a minimal |
| userspace which configures the device, then pivot_root(8) in to it. |
| |
| The second is to possible when the device-mapper and any targets are |
| compiled into the kernel (not a module), one or more device-mappers may |
| be created and used as the root device at boot time with the parameters |
| given with the boot line dm=... |
| |
| Multiple device-mappers can be stacked by specifying the number of |
| devices. A device can have multiple tables if the the number of tables |
| is specified. |
| |
| <dm> ::= <num-mappers> <device-mapper>+ |
| <device-mapper> ::= <head> "," <table>+ |
| <head> ::= <name> <uuid> <mode> [<num-tables>] |
| <table> ::= <start> <length> <type> <options> "," |
| <mode> ::= "ro" | "rw" |
| <uuid> ::= xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | "none" |
| <type> ::= "verity" | "bootcache" | ... |
| |
| Each tables line may be as normal when using the dmsetup tool except for |
| two variations: |
| 1. Any use of commas will be interpreted as a newline |
| 2. Quotation marks cannot be escaped and cannot be used without |
| terminating the dm= argument. |
| |
| Unless renamed by udev, the device node created will be dm-0 as the |
| first minor number for the device-mapper is used during early creation. |
| |
| The <num-tables> field is optional and assumed to be 1. |
| |
| Examples |
| ======== |
| An example of booting to a linear array made up of user-mode linux block |
| devices: |
| |
| dm="1 lroot none rw 2, 0 4096 linear 98:16 0, 4096 4096 linear 98:32 0" \ |
| root=/dev/dm-0 |
| |
| This will boot to a rw dm-linear target of 8192 sectors split across two |
| block devices identified by their major:minor numbers. After boot, udev |
| will rename this target to /dev/mapper/lroot (depending on the rules). |
| No uuid was assigned. |
| |
| An example of multiple device-mappers, with the dm="..." contents shown |
| here split on multiple lines for readability: |
| |
| 3 vboot none ro, |
| 0 1768000 bootcache |
| device=aa55b119-2a47-8c45-946a-5ac57765011f+1 |
| signature=76e9be054b15884a9fa85973e9cb274c93afadb6 |
| cache_start=1768000 max_blocks=100000 size_limit=23 max_trace=20000, |
| vroot none ro, |
| 0 1740800 verity payload=254:0 hashtree=254:0 hashstart=1740800 alg=sha1 |
| root_hexdigest=76e9be054b15884a9fa85973e9cb274c93afadb6 |
| salt=5b3549d54d6c7a3837b9b81ed72e49463a64c03680c47835bef94d768e5646fe, |
| vram none rw 2, |
| 0 32768 linear 1:0 0, |
| 32768 32768 linear 1:1 0, |