Back to home page

OSCL-LXR

 
 

    


0001 ================================
0002 Early creation of mapped devices
0003 ================================
0004 
0005 It is possible to configure a device-mapper device to act as the root device for
0006 your system in two ways.
0007 
0008 The first is to build an initial ramdisk which boots to a minimal userspace
0009 which configures the device, then pivot_root(8) in to it.
0010 
0011 The second is to create one or more device-mappers using the module parameter
0012 "dm-mod.create=" through the kernel boot command line argument.
0013 
0014 The format is specified as a string of data separated by commas and optionally
0015 semi-colons, where:
0016 
0017  - a comma is used to separate fields like name, uuid, flags and table
0018    (specifies one device)
0019  - a semi-colon is used to separate devices.
0020 
0021 So the format will look like this::
0022 
0023  dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+]
0024 
0025 Where::
0026 
0027         <name>          ::= The device name.
0028         <uuid>          ::= xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ""
0029         <minor>         ::= The device minor number | ""
0030         <flags>         ::= "ro" | "rw"
0031         <table>         ::= <start_sector> <num_sectors> <target_type> <target_args>
0032         <target_type>   ::= "verity" | "linear" | ... (see list below)
0033 
0034 The dm line should be equivalent to the one used by the dmsetup tool with the
0035 `--concise` argument.
0036 
0037 Target types
0038 ============
0039 
0040 Not all target types are available as there are serious risks in allowing
0041 activation of certain DM targets without first using userspace tools to check
0042 the validity of associated metadata.
0043 
0044 ======================= =======================================================
0045 `cache`                 constrained, userspace should verify cache device
0046 `crypt`                 allowed
0047 `delay`                 allowed
0048 `era`                   constrained, userspace should verify metadata device
0049 `flakey`                constrained, meant for test
0050 `linear`                allowed
0051 `log-writes`            constrained, userspace should verify metadata device
0052 `mirror`                constrained, userspace should verify main/mirror device
0053 `raid`                  constrained, userspace should verify metadata device
0054 `snapshot`              constrained, userspace should verify src/dst device
0055 `snapshot-origin`       allowed
0056 `snapshot-merge`        constrained, userspace should verify src/dst device
0057 `striped`               allowed
0058 `switch`                constrained, userspace should verify dev path
0059 `thin`                  constrained, requires dm target message from userspace
0060 `thin-pool`             constrained, requires dm target message from userspace
0061 `verity`                allowed
0062 `writecache`            constrained, userspace should verify cache device
0063 `zero`                  constrained, not meant for rootfs
0064 ======================= =======================================================
0065 
0066 If the target is not listed above, it is constrained by default (not tested).
0067 
0068 Examples
0069 ========
0070 An example of booting to a linear array made up of user-mode linux block
0071 devices::
0072 
0073   dm-mod.create="lroot,,,rw, 0 4096 linear 98:16 0, 4096 4096 linear 98:32 0" root=/dev/dm-0
0074 
0075 This will boot to a rw dm-linear target of 8192 sectors split across two block
0076 devices identified by their major:minor numbers.  After boot, udev will rename
0077 this target to /dev/mapper/lroot (depending on the rules). No uuid was assigned.
0078 
0079 An example of multiple device-mappers, with the dm-mod.create="..." contents
0080 is shown here split on multiple lines for readability::
0081 
0082   dm-linear,,1,rw,
0083     0 32768 linear 8:1 0,
0084     32768 1024000 linear 8:2 0;
0085   dm-verity,,3,ro,
0086     0 1638400 verity 1 /dev/sdc1 /dev/sdc2 4096 4096 204800 1 sha256
0087     ac87db56303c9c1da433d7209b5a6ef3e4779df141200cbd7c157dcb8dd89c42
0088     5ebfe87f7df3235b80a117ebc4078e44f55045487ad4a96581d1adb564615b51
0089 
0090 Other examples (per target):
0091 
0092 "crypt"::
0093 
0094   dm-crypt,,8,ro,
0095     0 1048576 crypt aes-xts-plain64
0096     babebabebabebabebabebabebabebabebabebabebabebabebabebabebabebabe 0
0097     /dev/sda 0 1 allow_discards
0098 
0099 "delay"::
0100 
0101   dm-delay,,4,ro,0 409600 delay /dev/sda1 0 500
0102 
0103 "linear"::
0104 
0105   dm-linear,,,rw,
0106     0 32768 linear /dev/sda1 0,
0107     32768 1024000 linear /dev/sda2 0,
0108     1056768 204800 linear /dev/sda3 0,
0109     1261568 512000 linear /dev/sda4 0
0110 
0111 "snapshot-origin"::
0112 
0113   dm-snap-orig,,4,ro,0 409600 snapshot-origin 8:2
0114 
0115 "striped"::
0116 
0117   dm-striped,,4,ro,0 1638400 striped 4 4096
0118   /dev/sda1 0 /dev/sda2 0 /dev/sda3 0 /dev/sda4 0
0119 
0120 "verity"::
0121 
0122   dm-verity,,4,ro,
0123     0 1638400 verity 1 8:1 8:2 4096 4096 204800 1 sha256
0124     fb1a5a0f00deb908d8b53cb270858975e76cf64105d412ce764225d53b8f3cfd
0125     51934789604d1b92399c52e7cb149d1b3a1b74bbbcb103b2a0aaacbed5c08584