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 38The 39.Nm 40driver provides the capability of creating one or more virtual disks 41based on the target mapping. 42.Pp 43This document assumes that you're familiar with how to generate 44kernels, how to properly configure disks and devices in a 45kernel configuration file, and how to partition disks. 46This driver is used by the Linux lvm2tools to create and manage 47lvm in 48.Dx . 49.Pp 50Currently, the 51.Pa linear , zero , error , crypt , 52and 53.Pa stripe 54targets 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 65In order to compile in support for 66.Nm , 67you must add a line similar to the following to your kernel 68configuration file: 69.Bd -unfilled -offset indent 70device dm #device-mapper disk device 71.Ed 72.Pp 73.Nm 74may create linear mapped devices, zero, and error block devices. 75Zero and error block devices are used mostly for testing. 76.Pa Linear 77devices are used to create virtual disks with linearly mapped virtual 78blocks to blocks on real disk. 79.Nm 80Device-mapper devices are controlled through the 81.Pa /dev/mapper/control 82device. 83For controlling this device 84.Xr ioctl 2 85calls are used. 86For the implementation of the communication channel, 87the 88.Xr proplib 3 89library is used. 90The protocol channel is defined as a proplib dictionary with needed 91values. 92For more details, look at 93.Pa sys/dev/disk/dm/netbsd-dm.h . 94Before any device can be used, every device-mapper disk device must 95be initialized. 96For initialization one line must be passed to the kernel driver in 97the form of a proplib dictionary. 98Every device can have more than one table active. 99An example for such a line is: 100.Bd -unfilled -offset indent 1010 10240 linear /dev/da0s1a 384 102.Ed 103.Pp 104.Nm 105The first parameter is the start sector for the table defined with 106this line, the second is the length in sectors which is described 107with this table. 108The third parameter is the target name. 109All other parts of this line depend on the chosen target. 110.Nm 111For the linear target, there are two additional parameters: 112The first parameter describes the disk device to which the 113device-mapper disk is mapped. 114The second parameter is the offset on this disk from the start of 115the 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 125The device-mapper disk driver first appeared in 126.Nx 6.0 . 127.Pp 128It was then brought into 129.Dx 2.7 130by 131.An Alex Hornung . 132.Sh AUTHORS 133.An Adam Hamsik Aq haad@NetBSD.org 134implemented 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 , 139and 140.An Bill Stouder-Studenmund Aq wrstuden@NetBSD.org 141provided guidance and answered questions about the 142.Nx 143implementation. 144.Sh BUGS 145This driver is still work-in-progress\(emthere can be bugs. 146