delay.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ========
  2. dm-delay
  3. ========
  4. Device-Mapper's "delay" target delays reads and/or writes
  5. and/or flushs and optionally maps them to different devices.
  6. Arguments::
  7. <device> <offset> <delay> [<write_device> <write_offset> <write_delay>
  8. [<flush_device> <flush_offset> <flush_delay>]]
  9. Table line has to either have 3, 6 or 9 arguments:
  10. 3: apply offset and delay to read, write and flush operations on device
  11. 6: apply offset and delay to device, also apply write_offset and write_delay
  12. to write and flush operations on optionally different write_device with
  13. optionally different sector offset
  14. 9: same as 6 arguments plus define flush_offset and flush_delay explicitely
  15. on/with optionally different flush_device/flush_offset.
  16. Offsets are specified in sectors.
  17. Delays are specified in milliseconds.
  18. Example scripts
  19. ===============
  20. ::
  21. #!/bin/sh
  22. #
  23. # Create mapped device named "delayed" delaying read, write and flush operations for 500ms.
  24. #
  25. dmsetup create delayed --table "0 `blockdev --getsz $1` delay $1 0 500"
  26. ::
  27. #!/bin/sh
  28. #
  29. # Create mapped device delaying write and flush operations for 400ms and
  30. # splitting reads to device $1 but writes and flushs to different device $2
  31. # to different offsets of 2048 and 4096 sectors respectively.
  32. #
  33. dmsetup create delayed --table "0 `blockdev --getsz $1` delay $1 2048 0 $2 4096 400"
  34. ::
  35. #!/bin/sh
  36. #
  37. # Create mapped device delaying reads for 50ms, writes for 100ms and flushs for 333ms
  38. # onto the same backing device at offset 0 sectors.
  39. #
  40. dmsetup create delayed --table "0 `blockdev --getsz $1` delay $1 0 50 $2 0 100 $1 0 333"