1DMSETUP(8) MAINTENTANCE COMMANDS DMSETUP(8)
2
3
4
6 dmsetup - low level logical volume management
7
9 dmsetup help [-c|-C|--columns]
10 dmsetup create device_name [-u uuid] [--notable | --table <table> | ta‐
11 ble_file]
12 dmsetup remove [-f|--force] device_name
13 dmsetup remove_all [-f|--force]
14 dmsetup suspend [--nolockfs] [--noflush] device_name
15 dmsetup resume device_name
16 dmsetup load device_name [--table <table> | table_file]
17 dmsetup clear device_name
18 dmsetup reload device_name [--table <table> | table_file]
19 dmsetup rename device_name new_name
20 dmsetup message device_name sector message
21 dmsetup ls [--target target_type] [--exec command] [--tree [-o
22 options]]
23 dmsetup info [device_name]
24 dmsetup info -c|-C|--columns [--noheadings] [--separator separator] [-o
25 fields] [-O|--sort sort_fields] [device_name]
26 dmsetup deps [device_name]
27 dmsetup status [--target target_type] [device_name]
28 dmsetup table [--target target_type] [device_name]
29 dmsetup wait device_name [event_nr]
30 dmsetup mknodes [device_name]
31 dmsetup targets
32 dmsetup version
33 dmsetup setgeometry device_name cyl head sect start
34
35 devmap_name major minor
36 devmap_name major:minor
37
39 dmsetup manages logical devices that use the device-mapper driver.
40 Devices are created by loading a table that specifies a target for each
41 sector (512 bytes) in the logical device.
42
43 The first argument to dmsetup is a command. The second argument is the
44 logical device name or uuid.
45
46 Invoking the command as devmap_name is equivalent to
47 dmsetup info -c --noheadings -j major -m minor.
48
50 -c|-C|--columns
51 Display output in columns rather than as Field: Value lines.
52
53 -j|--major major
54 Specify the major number.
55
56 -m|--minor minor
57 Specify the minor number.
58
59 -n|--noheadings
60 Suppress the headings line when using columnar output.
61
62 --noopencount
63 Tell the kernel not to supply the open reference count for the
64 device.
65
66 --notable
67 When creating a device, don't load any table.
68
69 -o|--options
70 Specify which fields to display.
71
72 -r|--readonly
73 Set the table being loaded read-only.
74
75 --table <table>
76 Specify a one-line table directly on the command line.
77
78 -u|--uuid
79 Specify the uuid.
80
81 -v|--verbose [-v|--verbose]
82 Produce additional output.
83
84 --version
85 Display the library and kernel driver version.
86
88 create device_name [-u uuid] [--notable | --table <table> | table_file]
89 Creates a device with the given name. If table_file or <table>
90 is supplied, the table is loaded and made live. Otherwise a ta‐
91 ble is read from standard input unless --notable is used. The
92 optional uuid can be used in place of device_name in subsequent
93 dmsetup commands. If successful a device will appear as
94 /dev/device-mapper/<device-name>. See below for information on
95 the table format.
96
97 deps [device_name]
98 Outputs a list of (major, minor) pairs for devices referenced by
99 the live table for the specified device.
100
101 help [-c|-C|--columns]
102 Outputs a summary of the commands available, optionally includ‐
103 ing the list of report fields.
104
105 info [device_name]
106 Outputs some brief information about the device in the form:
107 State: SUSPENDED|ACTIVE, READ-ONLY
108 Tables present: LIVE and/or INACTIVE
109 Open reference count
110 Last event sequence number (used by wait)
111 Major and minor device number
112 Number of targets in the live table
113 UUID
114
115 info [--noheadings] [--separator separator] [-o fields] [-O|--sort
116 sort_fields] [device_name]
117 Output you can customise. Fields are comma-separated and chosen
118 from the following list: name, major, minor, attr, open, seg‐
119 ments, events, uuid. Attributes are: (L)ive, (I)nactive,
120 (s)uspended, (r)ead-only, read-(w)rite. Precede the list with
121 '+' to append to the default selection of columns instead of
122 replacing it. Precede any sort_field with - for a reverse sort
123 on that column.
124
125 ls [--target target_type] [--exec command] [--tree [-o options]]
126 List device names. Optionally only list devices that have at
127 least one target of the specified type. Optionally execute a
128 command for each device. The device name is appended to the
129 supplied command. --tree displays dependencies between devices
130 as a tree. It accepts a comma-separate list of options. Some
131 specify the information displayed against each node:
132 device/nodevice; active, open, rw, uuid. Others specify how the
133 tree is displayed: ascii, utf, vt100; compact, inverted,
134 notrunc.
135
136 load|reload
137 device_name [--table <table> | table_file]
138 Loads <table> or table_file into the inactive table slot for
139 device_name. If neither is supplied, reads a table from stan‐
140 dard input.
141
142 message
143 device_name sector message
144 Send message to target. If sector not needed use 0.
145
146 mknodes
147 [device_name]
148 Ensure that the node in /dev/mapper for device_name is correct.
149 If no device_name is supplied, ensure that all nodes in
150 /dev/mapper correspond to mapped devices currently loaded by the
151 device-mapper kernel driver, adding, changing or removing nodes
152 as necessary.
153
154 remove [-f|--force] device_name
155 Removes a device. It will no longer be visible to dmsetup.
156 Open devices cannot be removed except with older kernels that
157 contain a version of device-mapper prior to 4.8.0. In this case
158 the device will be deleted when its open_count drops to zero.
159 From version 4.8.0 onwards, if a device can't be removed because
160 an uninterruptible process is waiting for I/O to return from it,
161 adding --force will replace the table with one that fails all
162 I/O, which might allow the process to be killed.
163
164 remove_all
165 [-f|--force]
166 Attempts to remove all device definitions i.e. reset the driver.
167 Use with care! From version 4.8.0 onwards, if devices can't be
168 removed because uninterruptible processess are waiting for I/O
169 to return from them, adding --force will replace the table with
170 one that fails all I/O, which might allow the process to be
171 killed. This also runs mknodes afterwards.
172
173 rename device_name new_name
174 Renames a device.
175
176 resume device_name
177 Un-suspends a device. If an inactive table has been loaded, it
178 becomes live. Postponed I/O then gets re-queued for processing.
179
180 setgeometry
181 device_name cyl head sect start
182 Sets the device geometry to C/H/S.
183
184 status [--target target_type] [device_name]
185 Outputs status information for each of the device's targets.
186 With --target, only information relating to the specified target
187 type is displayed.
188
189 suspend
190 [--nolockfs] [--noflush] device_name
191 Suspends a device. Any I/O that has already been mapped by the
192 device but has not yet completed will be flushed. Any further
193 I/O to that device will be postponed for as long as the device
194 is suspended. If there's a filesystem on the device which sup‐
195 ports the operation, an attempt will be made to sync it first
196 unless --nolockfs is specified. Some targets such as recent
197 (October 2006) versions of multipath may support the --noflush
198 option. This lets outstanding I/O that has not yet reached the
199 device to remain unflushed.
200
201 table [--target target_type] [device_name]
202 Outputs the current table for the device in a format that can be
203 fed back in using the create or load commands. With --target,
204 only information relating to the specified target type is dis‐
205 played.
206
207 targets
208 Displays the names and versions of the currently-loaded targets.
209
210 version
211 Outputs version information.
212
213 wait device_name [event_nr]
214 Sleeps until the event counter for device_name exceeds event_nr.
215 Use -v to see the event number returned. To wait until the next
216 event is triggered, use info to find the last event number.
217
219 Each line of the table specifies a single target and is of the form:
220 logical_start_sector num_sectors target_type target_args
221
222 There are currently three simple target types available together with
223 more complex optional ones that implement snapshots and mirrors.
224
225
226 linear destination_device start_sector
227 The traditional linear mapping.
228
229
230 striped
231 num_stripes chunk_size [destination start_sector]+
232 Creates a striped area.
233 e.g. striped 2 32 /dev/hda1 0 /dev/hdb1 0 will map the first
234 chunk (16k) as follows:
235 LV chunk 1 -> hda1, chunk 1
236 LV chunk 2 -> hdb1, chunk 1
237 LV chunk 3 -> hda1, chunk 2
238 LV chunk 4 -> hdb1, chunk 2
239 etc.
240
241
242 error
243 Errors any I/O that goes to this area. Useful for testing or
244 for creating devices with holes in them.
245
246
248 # A table to join two disks together
249 0 1028160 linear /dev/hda 0
250 1028160 3903762 linear /dev/hdb 0
251
252
253 # A table to stripe across the two disks,
254 # and add the spare space from
255 # hdb to the back of the volume
256
257 0 2056320 striped 2 32 /dev/hda 0 /dev/hdb 0
258 2056320 2875602 linear /dev/hdb 1028160
259
260
262 Original version: Joe Thornber (thornber@sistina.com)
263
264
266 Device-mapper resource page: http://sources.redhat.com/dm/
267
268
269
270Linux Apr 06 2006 DMSETUP(8)