요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
Target 제약과 예제
dm-init.rst:37-126부팅 시 허용되거나 제약되는 target을 구분하고 linear, verity, crypt 등 실제 선언 예제를 풀이합니다.
비동기 장치 대기
dm-init.rst:127-133`dm-mod.waitfor=`로 MMC·USB 같은 비동기 backing 장치를 기다린 뒤 table을 설정합니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
================================
Early 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 create one or more device-mappers using the module parameter
"dm-mod.create=" through the kernel boot command line argument.
The format is specified as a string of data separated by commas and optionally
semi-colons, where:
- a comma is used to separate fields like name, uuid, flags and table
(specifies one device)
- a semi-colon is used to separate devices.
So the format will look like this::
dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+]
Where::
<name> ::= The device name.
<uuid> ::= xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ""
<minor> ::= The device minor number | ""
<flags> ::= "ro" | "rw"
<table> ::= <start_sector> <num_sectors> <target_type> <target_args>
<target_type> ::= "verity" | "linear" | ... (see list below)
The dm line should be equivalent to the one used by the dmsetup tool with the
`--concise` argument.
Target types
============
Not all target types are available as there are serious risks in allowing
activation of certain DM targets without first using userspace tools to check
the validity of associated metadata.
======================= =======================================================
`cache` constrained, userspace should verify cache device
`crypt` allowed
`delay` allowed
`era` constrained, userspace should verify metadata device
`flakey` constrained, meant for test
`linear` allowed
`log-writes` constrained, userspace should verify metadata device
`mirror` constrained, userspace should verify main/mirror device
`raid` constrained, userspace should verify metadata device
`snapshot` constrained, userspace should verify src/dst device
`snapshot-origin` allowed
`snapshot-merge` constrained, userspace should verify src/dst device
`striped` allowed
`switch` constrained, userspace should verify dev path
`thin` constrained, requires dm target message from userspace
`thin-pool` constrained, requires dm target message from userspace
`verity` allowed
`writecache` constrained, userspace should verify cache device
`zero` constrained, not meant for rootfs
======================= =======================================================
If the target is not listed above, it is constrained by default (not tested).
Examples
========
An example of booting to a linear array made up of user-mode linux block
devices::
dm-mod.create="lroot,,,rw, 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-mod.create="..." contents
is shown here split on multiple lines for readability::
dm-linear,,1,rw,
0 32768 linear 8:1 0,
32768 1024000 linear 8:2 0;
dm-verity,,3,ro,
0 1638400 verity 1 /dev/sdc1 /dev/sdc2 4096 4096 204800 1 sha256
ac87db56303c9c1da433d7209b5a6ef3e4779df141200cbd7c157dcb8dd89c42
5ebfe87f7df3235b80a117ebc4078e44f55045487ad4a96581d1adb564615b51
Other examples (per target):
"crypt"::
dm-crypt,,8,ro,
0 1048576 crypt aes-xts-plain64
babebabebabebabebabebabebabebabebabebabebabebabebabebabebabebabe 0
/dev/sda 0 1 allow_discards
"delay"::
dm-delay,,4,ro,0 409600 delay /dev/sda1 0 500
"linear"::
dm-linear,,,rw,
0 32768 linear /dev/sda1 0,
32768 1024000 linear /dev/sda2 0,
1056768 204800 linear /dev/sda3 0,
1261568 512000 linear /dev/sda4 0
"snapshot-origin"::
dm-snap-orig,,4,ro,0 409600 snapshot-origin 8:2
"striped"::
dm-striped,,4,ro,0 1638400 striped 4 4096
/dev/sda1 0 /dev/sda2 0 /dev/sda3 0 /dev/sda4 0
"verity"::
dm-verity,,4,ro,
0 1638400 verity 1 8:1 8:2 4096 4096 204800 1 sha256
fb1a5a0f00deb908d8b53cb270858975e76cf64105d412ce764225d53b8f3cfd
51934789604d1b92399c52e7cb149d1b3a1b74bbbcb103b2a0aaacbed5c08584
For setups using device-mapper on top of asynchronously probed block
devices (MMC, USB, ..), it may be necessary to tell dm-init to
explicitly wait for them to become available before setting up the
device-mapper tables. This can be done with the "dm-mod.waitfor="
module parameter, which takes a list of devices to wait for::
dm-mod.waitfor=<device1>[,..,<deviceN>]
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
매핑 장치의 조기 생성 방식과 dm-mod.create 문법
1-36시스템의 루트 장치로 동작할 device-mapper 장치를 구성하는 방법은 두 가지입니다.
첫 번째 방법은 최소 userspace로 부팅하는 initial ramdisk를 만들고, 그 환경에서 장치를 구성한 다음 `pivot_root(8)`로 해당 장치에 루트 파일시스템을 전환하는 것입니다.
두 번째 방법은 커널 부팅 명령줄에서 `dm-mod.create=` 모듈 매개변수를 사용해 하나 이상의 device-mapper 장치를 만드는 것입니다.
이 문자열은 쉼표와 선택적인 세미콜론으로 구분합니다. 쉼표는 한 장치 안의 `name`, `uuid`, `minor`, `flags`, `table` 필드를 나누고, 세미콜론은 서로 다른 장치를 나눕니다. 따라서 전체 형식은 다음과 같습니다.
dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+]
한 장치의 식별 정보와 table을 쉼표로 연결하고 여러 장치는 세미콜론으로 분리합니다.
<name> ::= The device name.
<uuid> ::= xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ""
<minor> ::= The device minor number | ""
<flags> ::= "ro" | "rw"
<table> ::= <start_sector> <num_sectors> <target_type> <target_args>
<target_type> ::= "verity" | "linear" | ... (see list below)
이 DM 행은 `dmsetup --concise`에서 사용하는 행과 동등해야 합니다.
부팅 시 사용할 수 있는 target 종류와 제약
37-67모든 target을 조기 활성화할 수 있는 것은 아닙니다. 일부 DM target은 userspace 도구가 관련 metadata의 유효성을 먼저 검사하지 않은 채 활성화하면 심각한 위험이 있으므로 제약됩니다.
허용 target은 바로 만들 수 있고, 제약 target은 userspace 검증이나 후속 메시지가 필요합니다.
======================= =======================================================
`cache` constrained, userspace should verify cache device
`crypt` allowed
`delay` allowed
`era` constrained, userspace should verify metadata device
`flakey` constrained, meant for test
`linear` allowed
`log-writes` constrained, userspace should verify metadata device
`mirror` constrained, userspace should verify main/mirror device
`raid` constrained, userspace should verify metadata device
`snapshot` constrained, userspace should verify src/dst device
`snapshot-origin` allowed
`snapshot-merge` constrained, userspace should verify src/dst device
`striped` allowed
`switch` constrained, userspace should verify dev path
`thin` constrained, requires dm target message from userspace
`thin-pool` constrained, requires dm target message from userspace
`verity` allowed
`writecache` constrained, userspace should verify cache device
`zero` constrained, not meant for rootfs
======================= =======================================================
위 목록에 없는 target은 테스트되지 않았으므로 기본적으로 제약된 것으로 취급합니다.
단일 linear 루트와 여러 매핑 장치 예제
68-89다음은 user-mode Linux block 장치로 구성한 linear 배열을 루트 장치로 부팅하는 예입니다.
dm-mod.create="lroot,,,rw, 0 4096 linear 98:16 0, 4096 4096 linear 98:32 0" root=/dev/dm-0
이 명령은 major:minor 번호가 `98:16`과 `98:32`인 두 block 장치에 각각 4096 sector를 배치해 총 8192 sector인 읽기/쓰기 `dm-linear` target으로 부팅합니다. 부팅 후 udev 규칙에 따라 이 target의 이름은 `/dev/mapper/lroot`로 바뀔 수 있습니다. UUID는 지정하지 않았습니다.
여러 device-mapper 장치를 한 번에 선언할 수도 있습니다. 다음 `dm-mod.create="..."` 내용은 읽기 쉽도록 여러 줄로 나눈 것이며, 실제 장치 정의는 세미콜론으로 구분됩니다.
dm-linear,,1,rw,
0 32768 linear 8:1 0,
32768 1024000 linear 8:2 0;
dm-verity,,3,ro,
0 1638400 verity 1 /dev/sdc1 /dev/sdc2 4096 4096 204800 1 sha256
ac87db56303c9c1da433d7209b5a6ef3e4779df141200cbd7c157dcb8dd89c42
5ebfe87f7df3235b80a117ebc4078e44f55045487ad4a96581d1adb564615b51
부팅 문자열에서 장치 정의를 분리하고 각 table을 적재한 뒤 지정 minor에 장치를 생성합니다.
target별 dm-mod.create 예제
90-126다음은 지원 target별 장치 정의 예입니다. 각 예는 장치 이름, 선택적인 UUID와 minor, `ro` 또는 `rw` flag, 그리고 해당 target의 table 인자를 차례로 제공합니다.
`crypt` 예는 `aes-xts-plain64` cipher, 512-bit key 문자열, `/dev/sda`, `allow_discards` 옵션으로 읽기 전용 암호화 매핑을 만듭니다.
dm-crypt,,8,ro,
0 1048576 crypt aes-xts-plain64
babebabebabebabebabebabebabebabebabebabebabebabebabebabebabebabe 0
/dev/sda 0 1 allow_discards
`delay` 예는 `/dev/sda1`의 sector 0부터 읽고 500 ms 지연을 적용하는 409600-sector 매핑을 만듭니다.
dm-delay,,4,ro,0 409600 delay /dev/sda1 0 500
`linear` 예는 `/dev/sda1`부터 `/dev/sda4`까지 네 구간을 연속적인 읽기/쓰기 논리 장치로 연결합니다.
dm-linear,,,rw,
0 32768 linear /dev/sda1 0,
32768 1024000 linear /dev/sda2 0,
1056768 204800 linear /dev/sda3 0,
1261568 512000 linear /dev/sda4 0
`snapshot-origin` 예는 `8:2` 장치를 origin으로 사용하는 409600-sector 읽기 전용 매핑을 만듭니다.
dm-snap-orig,,4,ro,0 409600 snapshot-origin 8:2
`striped` 예는 네 장치와 4096-sector chunk 크기를 사용해 1638400 sector를 stripe합니다.
dm-striped,,4,ro,0 1638400 striped 4 4096
/dev/sda1 0 /dev/sda2 0 /dev/sda3 0 /dev/sda4 0
`verity` 예는 data 장치 `8:1`, hash 장치 `8:2`, 4096-byte block 크기, SHA-256 root digest와 salt를 사용해 읽기 전용 검증 장치를 만듭니다.
dm-verity,,4,ro,
0 1638400 verity 1 8:1 8:2 4096 4096 204800 1 sha256
fb1a5a0f00deb908d8b53cb270858975e76cf64105d412ce764225d53b8f3cfd
51934789604d1b92399c52e7cb149d1b3a1b74bbbcb103b2a0aaacbed5c08584
각 예제가 보여 주는 table 인자와 부팅 시 용도를 비교합니다.
비동기 probe 장치를 기다리는 dm-mod.waitfor
127-133MMC나 USB처럼 비동기로 probe되는 block 장치 위에 device-mapper를 구성하면, backing 장치가 나타나기 전에 table 설정이 시작될 수 있습니다. 이 경우 `dm-init`에 장치가 준비될 때까지 명시적으로 기다리도록 지시해야 할 수 있습니다.
`dm-mod.waitfor=` 모듈 매개변수는 기다릴 장치 목록을 쉼표로 구분해 받습니다.
dm-mod.waitfor=<device1>[,..,<deviceN>]
필요한 block 장치가 준비된 뒤에만 device-mapper table을 설정합니다.
조기 생성 문법
dm-init.rst:1-36Initial ramdisk 방식과 `dm-mod.create=` 방식, 장치·table 구분 문법을 설명합니다.