1711a30fcSSascha Wildner.\" $NetBSD: dm.4,v 1.2 2008/12/22 08:52:37 wiz Exp $ 2711a30fcSSascha Wildner.\" 3711a30fcSSascha Wildner.\" Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. 4711a30fcSSascha Wildner.\" All rights reserved. 5711a30fcSSascha Wildner.\" 6711a30fcSSascha Wildner.\" This code is derived from software contributed to The NetBSD Foundation 7711a30fcSSascha Wildner.\" by Adam Hamsik 8711a30fcSSascha Wildner.\" 9711a30fcSSascha Wildner.\" Redistribution and use in source and binary forms, with or without 10711a30fcSSascha Wildner.\" modification, are permitted provided that the following conditions 11711a30fcSSascha Wildner.\" are met: 12711a30fcSSascha Wildner.\" 1. Redistributions of source code must retain the above copyright 13711a30fcSSascha Wildner.\" notice, this list of conditions and the following disclaimer. 14711a30fcSSascha Wildner.\" 2. Redistributions in binary form must reproduce the above copyright 15711a30fcSSascha Wildner.\" notice, this list of conditions and the following disclaimer in the 16711a30fcSSascha Wildner.\" documentation and/or other materials provided with the distribution. 17711a30fcSSascha Wildner.\" 18711a30fcSSascha Wildner.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19711a30fcSSascha Wildner.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20711a30fcSSascha Wildner.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21711a30fcSSascha Wildner.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22711a30fcSSascha Wildner.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23711a30fcSSascha Wildner.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24711a30fcSSascha Wildner.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25711a30fcSSascha Wildner.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26711a30fcSSascha Wildner.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27711a30fcSSascha Wildner.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28711a30fcSSascha Wildner.\" POSSIBILITY OF SUCH DAMAGE. 29711a30fcSSascha Wildner.Dd July 28, 2010 30711a30fcSSascha Wildner.Dt DM 4 31711a30fcSSascha Wildner.Os 32711a30fcSSascha Wildner.Sh NAME 33711a30fcSSascha Wildner.Nm dm 34711a30fcSSascha Wildner.Nd Device-mapper disk driver 35711a30fcSSascha Wildner.Sh SYNOPSIS 36711a30fcSSascha Wildner.Cd "device dm" 37711a30fcSSascha Wildner.Sh DESCRIPTION 38711a30fcSSascha WildnerThe 39711a30fcSSascha Wildner.Nm 40711a30fcSSascha Wildnerdriver provides the capability of creating one or more virtual disks 41711a30fcSSascha Wildnerbased on the target mapping. 42711a30fcSSascha Wildner.Pp 43711a30fcSSascha WildnerThis document assumes that you're familiar with how to generate 44711a30fcSSascha Wildnerkernels, how to properly configure disks and devices in a 45711a30fcSSascha Wildnerkernel configuration file, and how to partition disks. 46711a30fcSSascha WildnerThis driver is used by the Linux lvm2tools to create and manage 47711a30fcSSascha Wildnerlvm in 48711a30fcSSascha Wildner.Dx . 49711a30fcSSascha Wildner.Pp 50711a30fcSSascha WildnerCurrently, the 51711a30fcSSascha Wildner.Pa linear , zero , error , crypt , 52711a30fcSSascha Wildnerand 53711a30fcSSascha Wildner.Pa stripe 54711a30fcSSascha Wildnertargets are implemented. 55711a30fcSSascha Wildner.\"Each component partition should be offset at least 2 sectors 56711a30fcSSascha Wildner.\"from the beginning of the component disk. 57711a30fcSSascha Wildner.\"This avoids potential conflicts between the component disk's 58711a30fcSSascha Wildner.\"disklabel and 59711a30fcSSascha Wildner.\".Nm Ap s 60711a30fcSSascha Wildner.\"disklabel. 61711a30fcSSascha Wildner.\"In i386 it is offset by 65 sectors, where 63 sectors are the initial 62711a30fcSSascha Wildner.\"boot sectors and 2 sectors are used for the disklabel which is set 63711a30fcSSascha Wildner.\"to be read-only. 64711a30fcSSascha Wildner.\".Pp 65711a30fcSSascha WildnerIn order to compile in support for 66711a30fcSSascha Wildner.Nm , 67711a30fcSSascha Wildneryou must add a line similar to the following to your kernel 68711a30fcSSascha Wildnerconfiguration file: 69711a30fcSSascha Wildner.Bd -unfilled -offset indent 70711a30fcSSascha Wildnerdevice dm #device-mapper disk device 71711a30fcSSascha Wildner.Ed 72711a30fcSSascha Wildner.Pp 73711a30fcSSascha Wildner.Nm 74711a30fcSSascha Wildnermay create linear mapped devices, zero, and error block devices. 75711a30fcSSascha WildnerZero and error block devices are used mostly for testing. 76711a30fcSSascha Wildner.Pa Linear 77711a30fcSSascha Wildnerdevices are used to create virtual disks with linearly mapped virtual 78711a30fcSSascha Wildnerblocks to blocks on real disk. 79711a30fcSSascha Wildner.Nm 80711a30fcSSascha WildnerDevice-mapper devices are controlled through the 81711a30fcSSascha Wildner.Pa /dev/mapper/control 82711a30fcSSascha Wildnerdevice. 83711a30fcSSascha WildnerFor controlling this device 84711a30fcSSascha Wildner.Xr ioctl 2 85711a30fcSSascha Wildnercalls are used. 86711a30fcSSascha WildnerFor the implementation of the communication channel, 87711a30fcSSascha Wildnerthe 88711a30fcSSascha Wildner.Xr proplib 3 89711a30fcSSascha Wildnerlibrary is used. 90711a30fcSSascha WildnerThe protocol channel is defined as a proplib dictionary with needed 91711a30fcSSascha Wildnervalues. 92711a30fcSSascha WildnerFor more details, look at 93711a30fcSSascha Wildner.Pa sys/dev/disk/dm/netbsd-dm.h . 94711a30fcSSascha WildnerBefore any device can be used, every device-mapper disk device must 95711a30fcSSascha Wildnerbe initialized. 96711a30fcSSascha WildnerFor initialization one line must be passed to the kernel driver in 97711a30fcSSascha Wildnerthe form of a proplib dictionary. 98711a30fcSSascha WildnerEvery device can have more than one table active. 99711a30fcSSascha WildnerAn example for such a line is: 100711a30fcSSascha Wildner.Bd -unfilled -offset indent 101711a30fcSSascha Wildner0 10240 linear /dev/da0s1a 384 102711a30fcSSascha Wildner.Ed 103711a30fcSSascha Wildner.Pp 104711a30fcSSascha Wildner.Nm 105711a30fcSSascha WildnerThe first parameter is the start sector for the table defined with 106711a30fcSSascha Wildnerthis line, the second is the length in sectors which is described 107711a30fcSSascha Wildnerwith this table. 108711a30fcSSascha WildnerThe third parameter is the target name. 109711a30fcSSascha WildnerAll other parts of this line depend on the chosen target. 110711a30fcSSascha Wildner.Nm 111711a30fcSSascha WildnerFor the linear target, there are two additional parameters: 112711a30fcSSascha WildnerThe first parameter describes the disk device to which the 113711a30fcSSascha Wildnerdevice-mapper disk is mapped. 114711a30fcSSascha WildnerThe second parameter is the offset on this disk from the start of 115711a30fcSSascha Wildnerthe disk/partition. 116711a30fcSSascha Wildner.Sh SEE ALSO 117711a30fcSSascha Wildner.Xr proplib 3 , 118711a30fcSSascha Wildner.Xr dmsetup 8 , 119711a30fcSSascha Wildner.Xr fsck 8 , 120711a30fcSSascha Wildner.Xr lvm 8 , 121711a30fcSSascha Wildner.Xr mount 8 , 122711a30fcSSascha Wildner.Xr newfs 8 123711a30fcSSascha Wildner.Sh HISTORY 124711a30fcSSascha WildnerThe device-mapper disk driver first appeared in 125711a30fcSSascha Wildner.Nx 6.0 . 126711a30fcSSascha Wildner.Pp 127711a30fcSSascha WildnerIt was then brought into 128711a30fcSSascha Wildner.Dx 2.7 129711a30fcSSascha Wildnerby 130711a30fcSSascha Wildner.An Alex Hornung . 131711a30fcSSascha Wildner.Sh AUTHORS 132*b2a6f486SFranco Fichtner.An -nosplit 133*b2a6f486SFranco Fichtner.An Adam Hamsik Aq Mt haad@NetBSD.org 134*b2a6f486SFranco Fichtnerimplemented the 135*b2a6f486SFranco Fichtner.Nm 136*b2a6f486SFranco Fichtnerdriver for 137711a30fcSSascha Wildner.Nx . 138711a30fcSSascha Wildner.Pp 139*b2a6f486SFranco Fichtner.An Brett Blymn Aq Mt blymn@NetBSD.org , 140*b2a6f486SFranco Fichtner.An Reinoud Zandijk Aq Mt reinoud@NetBSD.org , 141711a30fcSSascha Wildnerand 142*b2a6f486SFranco Fichtner.An Bill Stouder-Studenmund Aq Mt wrstuden@NetBSD.org 143711a30fcSSascha Wildnerprovided guidance and answered questions about the 144711a30fcSSascha Wildner.Nx 145711a30fcSSascha Wildnerimplementation. 146711a30fcSSascha Wildner.Sh BUGS 147711a30fcSSascha WildnerThis driver is still work-in-progress\(emthere can be bugs. 148