how to use dmsetup command and know its examples

The “dmsetup” command is used to manage device mapper devices, by which we can create and manage virtual block devices on top of physical storage devices. It can also be used to create, modify, and remove device mapper devices, as well as to view information about existing physical devices.

  • It is a command using which we can do low level logical volume management.
  • It comes from “device-mapper-1.02.53” package.
  • Path: /sbin/dmsetup

Examples:

1. To list the device mapper devices

# dmsetup ls

2. To get information about any DM device

# dmsetup info /dev/VG00/LV00

3. To get DM device info in column wise

# dmsetup info -c /dev/VG00/LV00

4. To list the DM device dependencies

# dmsetup deps /dev/VG00/LV00

5. To get the status of a DM device

# dmsetup status /dev/VG00/LV00

6. To destroy the inactive table for a device

# dmsetup clear /dev/VG00/LV00

7. To send message to target.

# dmsetup device_name sector message
# dmsetup /dev/VG00/LV00 0 “My Logical device”

8. To remove a device

# dmsetup remove /dev/VG00/LV00

9. To remove all the devices

# dmsetup remove_all

10 To rename the device

# dmsetup /dev/VG00/LV00 /dev/VG00/LV04

11. To suspend a device

# dmsetup suspend –nolockfs /dev/VG00/LV00
# dmsetup suspend –noflush /dev/VG00/LV00

12. To un-suspend a device

# dmsetup resume /dev/VG00/LV00

13. To output the table for a device

# dmsetup table /dev/VG00/LV00

14. To get the dmsetup version info

# dmsetup version

15. To display the help information

# dmsetup -h

Leave a Reply

Your email address will not be published. Required fields are marked *