906461fc4b7a771f274977acc19b21dbd39adb34
[dragonfly.git] / share / man / man4 / dm.4
1 .\"     $NetBSD: dm.4,v 1.2 2008/12/22 08:52:37 wiz Exp $
2 .\"
3 .\" Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
5 .\"
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Adam Hamsik
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
29 .Dd July 28, 2010
30 .Dt DM 4
31 .Os
32 .Sh NAME
33 .Nm dm
34 .Nd Device-mapper disk driver
35 .Sh SYNOPSIS
36 .Cd "device dm"
37 .Sh DESCRIPTION
38 The
39 .Nm
40 driver provides the capability of creating one or more virtual disks
41 based on the target mapping.
42 .Pp
43 This document assumes that you're familiar with how to generate
44 kernels, how to properly configure disks and devices in a
45 kernel configuration file, and how to partition disks.
46 This driver is used by the Linux lvm2tools to create and manage
47 lvm in
48 .Dx .
49 .Pp
50 Currently, the
51 .Pa linear , zero , error , crypt ,
52 and
53 .Pa stripe
54 targets are implemented.
55 .\"Each component partition should be offset at least 2 sectors
56 .\"from the beginning of the component disk.
57 .\"This avoids potential conflicts between the component disk's
58 .\"disklabel and
59 .\".Nm Ap s
60 .\"disklabel.
61 .\"In i386 it is offset by 65 sectors, where 63 sectors are the initial
62 .\"boot sectors and 2 sectors are used for the disklabel which is set
63 .\"to be read-only.
64 .\".Pp
65 In order to compile in support for
66 .Nm ,
67 you must add a line similar to the following to your kernel
68 configuration file:
69 .Bd -unfilled -offset indent
70 device  dm       #device-mapper disk device
71 .Ed
72 .Pp
73 .Nm
74 may create linear mapped devices, zero, and error block devices.
75 Zero and error block devices are used mostly for testing.
76 .Pa Linear
77 devices are used to create virtual disks with linearly mapped virtual
78 blocks to blocks on real disk.
79 .Nm
80 Device-mapper devices are controlled through the
81 .Pa /dev/mapper/control
82 device.
83 For controlling this device
84 .Xr ioctl 2
85 calls are used.
86 For the implementation of the communication channel,
87 the
88 .Xr proplib 3
89 library is used.
90 The protocol channel is defined as a proplib dictionary with needed
91 values.
92 For more details, look at
93 .Pa sys/dev/disk/dm/netbsd-dm.h .
94 Before any device can be used, every device-mapper disk device must
95 be initialized.
96 For initialization one line must be passed to the kernel driver in
97 the form of a proplib dictionary.
98 Every device can have more than one table active.
99 An example for such a line is:
100 .Bd -unfilled -offset indent
101 0 10240 linear /dev/da0s1a 384
102 .Ed
103 .Pp
104 .Nm
105 The first parameter is the start sector for the table defined with
106 this line, the second is the length in sectors which is described
107 with this table.
108 The third parameter is the target name.
109 All other parts of this line depend on the chosen target.
110 .Nm
111 For the linear target, there are two additional parameters:
112 The first parameter describes the disk device to which the
113 device-mapper disk is mapped.
114 The second parameter is the offset on this disk from the start of
115 the disk/partition.
116 .Sh SEE ALSO
117 .Xr proplib 3 ,
118 .Xr config 8 ,
119 .Xr dmsetup 8 ,
120 .Xr fsck 8 ,
121 .Xr lvm 8 ,
122 .Xr mount 8 ,
123 .Xr newfs 8
124 .Sh HISTORY
125 The device-mapper disk driver first appeared in
126 .Nx 6.0 .
127 .Pp
128 It was then brought into
129 .Dx 2.7
130 by
131 .An Alex Hornung .
132 .Sh AUTHORS
133 .An Adam Hamsik Aq haad@NetBSD.org
134 implemented the device-mapper driver for
135 .Nx .
136 .Pp
137 .An Brett Blymn Aq blymn@NetBSD.org ,
138 .An Reinoud Zandijk Aq reinoud@NetBSD.org ,
139 and
140 .An Bill Stouder-Studenmund Aq wrstuden@NetBSD.org
141 provided guidance and answered questions about the
142 .Nx
143 implementation.
144 .Sh BUGS
145 This driver is still work-in-progress\(emthere can be bugs.