Device Mapper
dm-create
dm-reload
dm-rename
dm-remove
dm-get-table
dm-target
dm-list
dm-get-info
dm-info
dm-suspend
dm-resume
8.12

Device Mapper🔗ℹ

Jan Dvorak <mordae@anilinux.org>

Linux Device Mapper bindings using "libdevmapper.so.1.02".

 (require dm) package: dm

Linux Device Mapper works with mappings and targets.

Every mapping have a named block device in "/dev/mapper" and a table of targets that together represent surface of the block device. For example a mapping "vg_mordae-lv_root" may represent a logical volume that maps 10 GiB of space in the middle of my laptop’s only disk drive using a linear mapping.

procedure

(dm-create name [#:uuid uuid] target ...)  void?

  name : string?
  uuid : (or/c #f string?) = #f
  target : dm-target?
Create new mapping from list of targets. You can supply an uuid or have it automatically generated.

procedure

(dm-reload name target ...)  void?

  name : string?
  target : dm-target?
Atomically replace table of specified mapping.

procedure

(dm-rename name    
  new-name    
  [#:new-uuid new-uuid])  void?
  name : string?
  new-name : string?
  new-uuid : (or/c #f string?) = #f
Rename specified mapping, possibly with uuid (if needed).

procedure

(dm-remove name)  void?

  name : string?
Destroy specified mapping.

procedure

(dm-get-table name)  (listof dm-target?)

  name : string?
Query current table (that is a list of targets) of specified mapping.

struct

(struct dm-target (start length type params)
    #:extra-constructor-name make-dm-target
    #:transparent)
  start : integer?
  length : integer?
  type : symbol?
  params : (listof (or/c string? integer?))
Single row of a device map table. For example when creating a mapping:

(dm-create "test"
  (dm-target    0 1024 'linear "253:1" 2048)
  (dm-target 1024 1024 'linear "253:2" 2048))

procedure

(dm-list)  (listof string?)

List names of mappings defined on this machine.

procedure

(dm-get-info name)  dm-info?

  name : string?
Query information about a mapping.

struct

(struct dm-info (exists
    suspended
    live-table
    inactive-table
    open-count
    event-nr
    major
    minor
    read-only
    target-count)
    #:extra-constructor-name make-dm-info
    #:transparent)
  exists : boolean?
  suspended : boolean?
  live-table : boolean?
  inactive-table : boolean?
  open-count : integer?
  event-nr : integer?
  major : integer?
  minor : integer?
  read-only : boolean?
  target-count : integer?
Mapping information that can be obtained with dm-get-info.

procedure

(dm-suspend name)  void?

  name : string?
Suspend specified mapping, that is: flush pending requests and block new ones.

procedure

(dm-resume name)  void?

  name : string?
Cancel suspension of specified mapping.