1 .TH DMSETUP 8 "Apr 06 2006" "Linux" "MAINTENANCE COMMANDS"
3 dmsetup \- low level logical volume management
13 .RB [ \-\-notable | \-\-table
17 .RB [{ \-\-addnodeoncreate | \-\-addnodeonresume }]
19 .RI [ \+ ]< sectors >| auto | none ]
28 .RB [ \-c | \-C | \-\-columns ]
34 .BR \-c | \-C | \-\-columns
35 .RB [ \-\-noheadings ]
49 .RI < table >| table_file ]
62 .I device_name sector message
73 .RI < table >| table_file ]
79 .RB [ \-f | \-\-force ]
84 .RB [ \-f | \-\-force ]
87 .I device_name new_name
96 .RB [{ \-\-addnodeoncreate | \-\-addnodeonresume }]
99 .RI [ \+ ]< sectors >| auto | none ]
102 .B dmsetup setgeometry
103 .I device_name cyl head sect start
127 .B dmsetup udevcomplete
130 .B dmsetup udevcomplete_all
131 .RI [ age_in_minutes ]
133 .B dmsetup udevcookies
135 .B dmsetup udevcreatecookie
140 .B dmsetup udevreleasecookie
157 dmsetup manages logical devices that use the device-mapper driver.
158 Devices are created by loading a table that specifies a target for
159 each sector (512 bytes) in the logical device.
161 The first argument to dmsetup is a command.
162 The second argument is the logical device name or uuid.
164 Invoking the command as \fBdevmap_name\fP is equivalent to
166 \fBdmsetup info \-c \-\-noheadings \-j \fImajor\fB \-m \fIminor\fP.
169 .B \-\-addnodeoncreate
170 Ensure /dev/mapper node exists after dmsetup create.
172 .B \-\-addnodeonresume
173 Ensure /dev/mapper node exists after dmsetup resume (default with udev).
176 Perform additional checks on the operations requested and report
177 potential problems. Useful when debugging scripts.
178 In some cases these checks may slow down operations noticeably.
180 .BR \-c | \-C | \-\-columns
181 Display output in columns rather than as Field: Value lines.
184 Outputs a summary of the commands available, optionally including
185 the list of report fields (synonym with \fBhelp\fP command).
188 When returning any table information from the kernel report on the
189 inactive table instead of the live table.
190 Requires kernel driver version 4.16.0 or above.
192 .IR \fB\-\-manglename \ < mangling_mode >
193 Mangle any character not on a whitelist using mangling_mode when
194 processing device-mapper device names. The names are mangled on
195 input and unmangled on output where the mangling_mode is one of:
196 none (no mangling), hex (always do the mangling) and auto
197 (only do the mangling if not mangled yet, do nothing if already
198 mangled, error on mixed; this is used by default).
199 Character whitelist: 0-9, A-Z, a-z, #+-.:=@_. This whitelist is
200 also supported by udev. Any character not on a whitelist is replaced
201 with its hex value (two digits) prefixed by \\x.
203 .BR \-j | \-\-major\ \fImajor
204 Specify the major number.
206 .BR \-m | \-\-minor\ \fIminor
207 Specify the minor number.
209 .BR \-n | \-\-noheadings
210 Suppress the headings line when using columnar output.
213 Tell the kernel not to supply the open reference count for the device.
216 When creating a device, don't load any table.
219 Do not allow udev to manage nodes for devices in device-mapper directory.
222 Do not synchronise with udev when creating, renaming or removing devices.
224 .BR \-o | \-\-options
225 Specify which fields to display.
227 .IR \fB\-\-readahead \ [ \+ ]< sectors >| auto | none
228 Specify read ahead size in units of sectors.
229 The default value is \fIauto\fP which allows the kernel to choose
230 a suitable value automatically. The \fI\+\fP prefix lets you
231 specify a minimum value which will not be used if it is
232 smaller than the value chosen by the kernel.
233 The value \fInone\fP is equivalent to specifying zero.
235 .BR \-r | \-\-readonly
236 Set the table being loaded read-only.
238 .IR \fB\-\-table \ < table >
239 Specify a one-line table directly on the command line.
241 .B \-\-udevcookie \fIcookie
242 Use cookie for udev synchronisation.
248 Answer yes to all prompts automatically.
250 .BR \-v | \-\-verbose \ [ \-v | \-\-verbose ]
251 Produce additional output.
254 If udev synchronisation is enabled, verify that udev operations get performed
255 correctly and try to fix up the device nodes afterwards if not.
258 Display the library and kernel driver version.
265 Destroys the table in the inactive table slot for device_name.
272 .RB [ \-\-notable | \-\-table
273 .RI < \fItable >| table_file ]
274 .RB [{ \-\-addnodeoncreate | \-\-addnodeonresume }]
276 .RI [ + ]< sectors >| auto | none ]
278 Creates a device with the given name.
279 If table_file or <table> is supplied, the table is loaded and made live.
280 Otherwise a table is read from standard input unless \-\-notable is used.
281 The optional uuid can be used in place of
282 device_name in subsequent dmsetup commands.
283 If successful a device will appear as
284 /dev/mapper/<device-name>.
285 See below for information on the table format.
293 Outputs a list of devices referenced by the live table for the specified
294 device. Device names on output can be customised by following options:
295 devno (major and minor pair, used by default), blkdevname (block device name),
296 devname (map name for device-mapper devices, equal to blkdevname otherwise).
300 .RB [ \-c | \-C | \-\-columns ]
302 Outputs a summary of the commands available, optionally including
303 the list of report fields.
309 Outputs some brief information about the device in the form:
312 State: SUSPENDED|ACTIVE, READ-ONLY
313 Tables present: LIVE and/or INACTIVE
315 Last event sequence number (used by \fBwait\fP)
316 Major and minor device number
317 Number of targets in the live table
324 .BR \-c | \-C | \-\-columns
325 .RB [ \-\-noheadings ]
334 Output you can customise.
335 Fields are comma-separated and chosen from the following list:
336 name, major, minor, attr, open, segments, events, uuid.
337 Attributes are: (L)ive, (I)nactive, (s)uspended, (r)ead-only, read-(w)rite.
338 Precede the list with '+' to append
339 to the default selection of columns instead of replacing it.
340 Precede any sort_field with - for a reverse sort on that column.
352 List device names. Optionally only list devices that have at least
353 one target of the specified type. Optionally execute a command for
354 each device. The device name is appended to the supplied command.
355 Device names on output can be customised by following options: devno (major
356 and minor pair, used by default), blkdevname (block device name),
357 devname (map name for device-mapper devices, equal to blkdevname otherwise).
358 --tree displays dependencies between devices as a tree.
359 It accepts a comma-separate list of options.
360 Some specify the information displayed against each node:
361 device/nodevice; blkdevname; active, open, rw, uuid.
362 Others specify how the tree is displayed:
363 ascii, utf, vt100; compact, inverted, notrunc.
369 .RI < table >| table_file ]
371 Loads <table> or table_file into the inactive table slot for device_name.
372 If neither is supplied, reads a table from standard input.
378 Wait for any I/O in-flight through the device to complete, then
379 replace the table with a new table that fails any new I/O
380 sent to the device. If successful, this should release any devices
381 held open by the device's table(s).
385 .I device_name sector message
387 Send message to target. If sector not needed use 0.
393 Ensure that the node in /dev/mapper for device_name is correct.
394 If no device_name is supplied, ensure that all nodes in /dev/mapper
395 correspond to mapped devices currently loaded by the device-mapper kernel
396 driver, adding, changing or removing nodes as necessary.
402 Ensure existing device-mapper device name is in the correct mangled
403 form containing only whitelisted characters (supported by udev) and do
404 a rename if necessary. Any character not on the whitelist will be mangled
405 based on the --manglename settting.
409 .RB [ \-f | \-\-force ]
413 Removes a device. It will no longer be visible to dmsetup.
414 Open devices cannot be removed except with older kernels
415 that contain a version of device-mapper prior to 4.8.0.
416 In this case the device will be deleted when its open_count
417 drops to zero. From version 4.8.0 onwards, if a device can't
418 be removed because an uninterruptible process is waiting for
419 I/O to return from it, adding \-\-force will replace the table
420 with one that fails all I/O, which might allow the
421 process to be killed. If an attempt to remove a device fails,
422 perhaps because a process run from a quick udev rule
423 temporarily opened the device, the \-\-retry option will cause
424 the operation to be retried for a few seconds before failing.
428 .RB [ \-f | \-\-force ]
430 Attempts to remove all device definitions i.e. reset the driver.
431 Use with care! From version 4.8.0 onwards, if devices can't
432 be removed because uninterruptible processes are waiting for
433 I/O to return from them, adding \-\-force will replace the table
434 with one that fails all I/O, which might allow the
435 process to be killed. This also runs \fBmknodes\fP afterwards.
439 .I device_name new_name
449 Sets the uuid of a device that was created without a uuid.
450 After a uuid has been set it cannot be changed.
455 .RB [{ \-\-addnodeoncreate | \-\-addnodeonresume }]
457 .RI [ + ]< sectors >| auto | none ]
459 Un-suspends a device.
460 If an inactive table has been loaded, it becomes live.
461 Postponed I/O then gets re-queued for processing.
464 .B setgeometry \fIdevice_name cyl head sect start
466 Sets the device geometry to C/H/S.
473 Splits given device name into subsystem constituents.
474 Default subsystem is LVM.
482 Outputs status information for each of the device's targets.
483 With \-\-target, only information relating to the specified target type
492 Suspends a device. Any I/O that has already been mapped by the device
493 but has not yet completed will be flushed. Any further I/O to that
494 device will be postponed for as long as the device is suspended.
495 If there's a filesystem on the device which supports the operation,
496 an attempt will be made to sync it first unless \-\-nolockfs is specified.
497 Some targets such as recent (October 2006) versions of multipath may support
498 the \-\-noflush option. This lets outstanding I/O that has not yet reached the
499 device to remain unflushed.
508 Outputs the current table for the device in a format that can be fed
509 back in using the create or load commands.
510 With \-\-target, only information relating to the specified target type
512 Encryption keys are suppressed in the table output for the crypt
513 target unless the \-\-showkeys parameter is supplied.
518 Displays the names and versions of the currently-loaded targets.
524 Wake any processes that are waiting for udev to complete processing the specified cookie.
528 .RI [ age_in_minutes ]
530 Remove all cookies older than the specified number of minutes.
531 Any process waiting on a cookie will be resumed immediately.
536 List all existing cookies. Cookies are system-wide semaphores with keys
537 prefixed by two predefined bytes (0x0D4D).
542 Creates a new cookie to synchronize actions with udev processing.
543 The output is a cookie value. Normally we don't need to create cookies since
544 dmsetup creates and destroys them for each action automatically. However, we can
545 generate one explicitly to group several actions together and use only one
546 cookie instead. We can define a cookie to use for each relevant command by using
547 \-\-udevcookie option. Alternatively, we can export this value into the environment
548 of the dmsetup process as DM_UDEV_COOKIE variable and it will be used automatically
549 with all subsequent commands until it is unset.
550 Invoking this command will create system-wide semaphore that needs to be cleaned
551 up explicitly by calling udevreleasecookie command.
557 Parses given cookie value and extracts any udev control flags encoded.
558 The output is in environment key format that is suitable for use in udev
559 rules. If the flag has its symbolic name assigned then the output is
560 DM_UDEV_FLAG_<flag_name>='1', DM_UDEV_FLAG<flag_position>='1' otherwise.
561 Subsystem udev flags don't have symbolic names assigned and these ones are
562 always reported as DM_SUBSYSTEM_UDEV_FLAG<flag_position>='1'. There are
563 16 udev flags altogether.
569 Waits for all pending udev processing bound to given cookie value and clean up
570 the cookie with underlying semaphore. If the cookie is not given directly,
571 the command will try to use a value defined by DM_UDEV_COOKIE environment variable.
576 Outputs version information.
583 Sleeps until the event counter for device_name exceeds event_nr.
584 Use \-v to see the event number returned.
585 To wait until the next event is triggered, use \fBinfo\fP to find
586 the last event number.
588 Each line of the table specifies a single target and is of the form:
590 .I logical_start_sector num_sectors
594 Simple target types and <target_args> include:
597 .I destination_device start_sector
599 The traditional linear mapping.
602 .I num_stripes chunk_size
606 Creates a striped area.
608 e.g. striped 2 32 /dev/hda1 0 /dev/hdb1 0
609 will map the first chunk (16k) as follows:
612 LV chunk 1 -> hda1, chunk 1
613 LV chunk 2 -> hdb1, chunk 1
614 LV chunk 3 -> hda1, chunk 2
615 LV chunk 4 -> hdb1, chunk 2
622 Errors any I/O that goes to this area. Useful for testing or
623 for creating devices with holes in them.
627 Returns blocks of zeroes on reads. Any data written is discarded silently.
628 This is a block-device equivalent of the /dev/zero character-device data sink
629 described in \fBnull(4)\fP.
631 More complex targets include:
635 Transparent encryption of block devices using the kernel crypto API.
639 Delays reads and/or writes to different devices. Useful for testing.
643 Creates a similar mapping to the linear target but
644 exhibits unreliable behaviour periodically.
645 Useful for simulating failing devices when testing.
649 Mirrors data across two or more devices.
653 Mediates access through multiple paths to the same device.
657 Offers an interface to the kernel's software raid driver, md.
661 Supports snapshots of devices.
663 To find out more about the various targets and their table formats and status
664 lines, please read the files in the Documentation/device-mapper directory in
665 the kernel source tree.
666 (Your distribution might include a copy of this information in the
667 documentation directory for the device-mapper package.)
671 # A table to join two disks together
674 0 1028160 linear /dev/hda 0
676 1028160 3903762 linear /dev/hdb 0
679 # A table to stripe across the two disks,
681 # and add the spare space from
683 # hdb to the back of the volume
685 0 2056320 striped 2 32 /dev/hda 0 /dev/hdb 0
687 2056320 2875602 linear /dev/hdb 1028160
689 .SH ENVIRONMENT VARIABLES
692 The device directory name.
693 Defaults to "/dev" and must be an absolute path.
696 A cookie to use for all relevant commands to synchronize with udev processing.
697 It is an alternative to using \-\-udevcookie option.
700 Original version: Joe Thornber (thornber@sistina.com)
703 Device-mapper resource page: http://sources.redhat.com/dm/