1DMSETUP(8) MAINTENANCE 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] [{ --addnodeonresume | --addnodeoncreate }]
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 rename device_name --setuuid uuid
21 dmsetup message device_name sector message
22 dmsetup ls [--target target_type] [--exec command] [--tree [-o
23 options]]
24 dmsetup info [device_name]
25 dmsetup info -c|-C|--columns [--noheadings] [--separator separator] [-o
26 fields] [-O|--sort sort_fields] [device_name]
27 dmsetup deps [device_name]
28 dmsetup status [--target target_type] [device_name]
29 dmsetup table [--target target_type] [--showkeys] [device_name]
30 dmsetup wait device_name [event_nr]
31 dmsetup mknodes [device_name]
32 dmsetup udevcreatecookie
33 dmsetup udevreleasecookie [cookie]
34 dmsetup udevflags cookie
35 dmsetup udevcomplete cookie
36 dmsetup udevcomplete_all
37 dmsetup udevcookies
38 dmsetup targets
39 dmsetup version
40 dmsetup setgeometry device_name cyl head sect start
41 dmsetup splitname device_name [subsystem]
42
43 devmap_name major minor
44 devmap_name major:minor
45
47 dmsetup manages logical devices that use the device-mapper driver.
48 Devices are created by loading a table that specifies a target for each
49 sector (512 bytes) in the logical device.
50
51 The first argument to dmsetup is a command. The second argument is the
52 logical device name or uuid.
53
54 Invoking the command as devmap_name is equivalent to
55 dmsetup info -c --noheadings -j major -m minor.
56
58 -c|-C|--columns
59 Display output in columns rather than as Field: Value lines.
60
61 -h|--help
62 Outputs a summary of the commands available, optionally includ‐
63 ing the list of report fields (synonym with help command).
64
65 --inactive
66 When returning any table information from the kernel report on
67 the inactive table instead of the live table. Requires kernel
68 driver version 4.16.0 or above.
69
70 -j|--major major
71 Specify the major number.
72
73 -m|--minor minor
74 Specify the minor number.
75
76 -n|--noheadings
77 Suppress the headings line when using columnar output.
78
79 --noopencount
80 Tell the kernel not to supply the open reference count for the
81 device.
82
83 --notable
84 When creating a device, don't load any table.
85
86 --addnodeonresume
87 Ensure /dev/mapper node exists after dmsetup resume (default
88 with udev).
89
90 --addnodeoncreate
91 Ensure /dev/mapper node exists after dmsetup create.
92
93 --udevcookie cookie
94 Use cookie for udev synchronisation.
95
96 --noudevrules
97 Do not allow udev to manage nodes for devices in device-mapper
98 directory.
99
100 --noudevsync
101 Do not synchronise with udev when creating, renaming or removing
102 devices.
103
104 -o|--options
105 Specify which fields to display.
106
107 -r|--readonly
108 Set the table being loaded read-only.
109
110 --readahead [+]<sectors>|auto|none
111 Specify read ahead size in units of sectors. The default value
112 is "auto" which allows the kernel to choose a suitable value
113 automatically. The + prefix lets you specify a minimum value
114 which will not be used if it is smaller than the value chosen by
115 the kernel. "None" is equivalent to specifying zero.
116
117 --table <table>
118 Specify a one-line table directly on the command line.
119
120 -u|--uuid
121 Specify the uuid.
122
123 -y|--yes
124 Answer yes to all prompts automatically.
125
126 -v|--verbose [-v|--verbose]
127 Produce additional output.
128
129 --version
130 Display the library and kernel driver version.
131
133 clear device_name
134 Destroys the table in the inactive table slot for device_name.
135
136 create device_name [-u uuid] [--notable | --table <table> | table_file]
137 Creates a device with the given name. If table_file or <table>
138 is supplied, the table is loaded and made live. Otherwise a ta‐
139 ble is read from standard input unless --notable is used. The
140 optional uuid can be used in place of device_name in subsequent
141 dmsetup commands. If successful a device will appear as
142 /dev/device-mapper/<device-name>. See below for information on
143 the table format.
144
145 deps [device_name]
146 Outputs a list of (major, minor) pairs for devices referenced by
147 the live table for the specified device.
148
149 help [-c|-C|--columns]
150 Outputs a summary of the commands available, optionally includ‐
151 ing the list of report fields.
152
153 info [device_name]
154 Outputs some brief information about the device in the form:
155 State: SUSPENDED|ACTIVE, READ-ONLY
156 Tables present: LIVE and/or INACTIVE
157 Open reference count
158 Last event sequence number (used by wait)
159 Major and minor device number
160 Number of targets in the live table
161 UUID
162
163 info -c|-C|--columns [--noheadings] [--separator separator] [-o
164 fields] [-O|--sort sort_fields] [device_name]
165 Output you can customise. Fields are comma-separated and chosen
166 from the following list: name, major, minor, attr, open, seg‐
167 ments, events, uuid. Attributes are: (L)ive, (I)nactive,
168 (s)uspended, (r)ead-only, read-(w)rite. Precede the list with
169 '+' to append to the default selection of columns instead of
170 replacing it. Precede any sort_field with - for a reverse sort
171 on that column.
172
173 ls [--target target_type] [--exec command] [--tree [-o options]]
174 List device names. Optionally only list devices that have at
175 least one target of the specified type. Optionally execute a
176 command for each device. The device name is appended to the
177 supplied command. --tree displays dependencies between devices
178 as a tree. It accepts a comma-separate list of options. Some
179 specify the information displayed against each node:
180 device/nodevice; active, open, rw, uuid. Others specify how the
181 tree is displayed: ascii, utf, vt100; compact, inverted,
182 notrunc.
183
184 load|reload
185 device_name [--table <table> | table_file]
186 Loads <table> or table_file into the inactive table slot for
187 device_name. If neither is supplied, reads a table from stan‐
188 dard input.
189
190 message
191 device_name sector message
192 Send message to target. If sector not needed use 0.
193
194 mknodes
195 [device_name]
196 Ensure that the node in /dev/mapper for device_name is correct.
197 If no device_name is supplied, ensure that all nodes in
198 /dev/mapper correspond to mapped devices currently loaded by the
199 device-mapper kernel driver, adding, changing or removing nodes
200 as necessary.
201
202 remove [-f|--force] device_name
203 Removes a device. It will no longer be visible to dmsetup.
204 Open devices cannot be removed except with older kernels that
205 contain a version of device-mapper prior to 4.8.0. In this case
206 the device will be deleted when its open_count drops to zero.
207 From version 4.8.0 onwards, if a device can't be removed because
208 an uninterruptible process is waiting for I/O to return from it,
209 adding --force will replace the table with one that fails all
210 I/O, which might allow the process to be killed.
211
212 remove_all
213 [-f|--force]
214 Attempts to remove all device definitions i.e. reset the driver.
215 Use with care! From version 4.8.0 onwards, if devices can't be
216 removed because uninterruptible processes are waiting for I/O to
217 return from them, adding --force will replace the table with one
218 that fails all I/O, which might allow the process to be killed.
219 This also runs mknodes afterwards.
220
221 rename device_name new_name
222 Renames a device.
223
224 rename device_name --setuuid uuid
225 Sets the uuid of a device that was created without a uuid.
226 After a uuid has been set it cannot be changed.
227
228 resume device_name
229 Un-suspends a device. If an inactive table has been loaded, it
230 becomes live. Postponed I/O then gets re-queued for processing.
231
232 setgeometry
233 device_name cyl head sect start
234 Sets the device geometry to C/H/S.
235
236 splitname
237 device_name [subsystem]
238 Splits given device name into subsystem constituents. Default
239 subsystem is LVM.
240
241 status [--target target_type] [device_name]
242 Outputs status information for each of the device's targets.
243 With --target, only information relating to the specified target
244 type is displayed.
245
246 suspend
247 [--nolockfs] [--noflush] device_name
248 Suspends a device. Any I/O that has already been mapped by the
249 device but has not yet completed will be flushed. Any further
250 I/O to that device will be postponed for as long as the device
251 is suspended. If there's a filesystem on the device which sup‐
252 ports the operation, an attempt will be made to sync it first
253 unless --nolockfs is specified. Some targets such as recent
254 (October 2006) versions of multipath may support the --noflush
255 option. This lets outstanding I/O that has not yet reached the
256 device to remain unflushed.
257
258 table [--target target_type] [--showkeys] [device_name]
259 Outputs the current table for the device in a format that can be
260 fed back in using the create or load commands. With --target,
261 only information relating to the specified target type is dis‐
262 played. Encryption keys are suppressed in the table output for
263 the crypt target unless the --showkeys parameter is supplied.
264
265 targets
266 Displays the names and versions of the currently-loaded targets.
267
268 udevcreatecookie
269 Creates a new cookie to synchronize actions with udev process‐
270 ing. The output is a cookie value. Normally we don't need to
271 create cookies since dmsetup creates and destroys them for each
272 action automatically. However, we can generate one explicitly to
273 group several actions together and use only one cookie instead.
274 We can define a cookie to use for each relevant command by using
275 --udevcookie option. Alternatively, we can export this value
276 into the environment of the dmsetup process as DM_UDEV_COOKIE
277 variable and it will be used automatically with all subsequent
278 commands until it is unset. Invoking this command will create
279 system-wide semaphore that needs to be cleaned up explicitly by
280 calling udevreleasecookie command.
281
282 udevreleasecookie
283 [cookie]
284 Waits for all pending udev processing bound to given cookie
285 value and clean up the cookie with underlying semaphore. If the
286 cookie is not given directly, the command will try to use a
287 value defined by DM_UDEV_COOKIE environment variable.
288
289 udevflags
290 cookie
291 Parses given cookie value and extracts any udev control flags
292 encoded. The output is in environment key format that is suit‐
293 able for use in udev rules. If the flag has its symbolic name
294 assigned then the ouput is DM_UDEV_FLAG_<flag_name>='1',
295 DM_UDEV_FLAG<flag_position>='1' otherwise. Subsystem udev flags
296 don't have symbolic names assigned and these ones are always
297 reported as DM_SUBSYSTEM_UDEV_FLAG<flag_position>='1'. There are
298 16 udev flags altogether.
299
300 udevcomplete
301 cookie
302 Wake any processes that are waiting for udev to complete pro‐
303 cessing the specified cookie.
304
305 udevcomplete_all
306 Remove all cookies. Any process waiting on a cookie will be
307 resumed immediately.
308
309 udevcookies
310 List all existing cookies. Cookies are system-wide semaphores
311 with keys prefixed by two predefined bytes (0x0D4D).
312
313 version
314 Outputs version information.
315
316 wait device_name [event_nr]
317 Sleeps until the event counter for device_name exceeds event_nr.
318 Use -v to see the event number returned. To wait until the next
319 event is triggered, use info to find the last event number.
320
322 Each line of the table specifies a single target and is of the form:
323 logical_start_sector num_sectors target_type target_args
324
325 There are currently three simple target types available together with
326 more complex optional ones that implement snapshots and mirrors.
327
328
329 linear destination_device start_sector
330 The traditional linear mapping.
331
332
333 striped
334 num_stripes chunk_size [destination start_sector]+
335 Creates a striped area.
336 e.g. striped 2 32 /dev/hda1 0 /dev/hdb1 0 will map the first
337 chunk (16k) as follows:
338 LV chunk 1 -> hda1, chunk 1
339 LV chunk 2 -> hdb1, chunk 1
340 LV chunk 3 -> hda1, chunk 2
341 LV chunk 4 -> hdb1, chunk 2
342 etc.
343
344
345 error
346 Errors any I/O that goes to this area. Useful for testing or
347 for creating devices with holes in them.
348
349
351 # A table to join two disks together
352 0 1028160 linear /dev/hda 0
353 1028160 3903762 linear /dev/hdb 0
354
355
356 # A table to stripe across the two disks,
357 # and add the spare space from
358 # hdb to the back of the volume
359
360 0 2056320 striped 2 32 /dev/hda 0 /dev/hdb 0
361 2056320 2875602 linear /dev/hdb 1028160
362
363
365 DM_DEV_DIR
366 The device directory name. Defaults to "/dev" and must be an
367 absolute path.
368
369 DM_UDEV_COOKIE
370 A cookie to use for all relevant commands to synchronize with
371 udev processing. It is an alternative to using --udevcookie
372 option.
373
374
376 Original version: Joe Thornber (thornber@sistina.com)
377
378
380 Device-mapper resource page: http://sources.redhat.com/dm/
381
382
383
384Linux Apr 06 2006 DMSETUP(8)