linuxdocumentationdmdevice-mapper

Where can I find documentation on the raw dm_mirror interface?


I'd like to use dm_mirror directly, rather than through LVM or MD, but I've had trouble finding clear documentation on the table format it expects. Is such a document available somewhere?

Note that I want to use this to mirror one partition to another while in use - I can't add metadata to it, so using dm-raid1 probably isn't going to work.


Solution

  • Based on examination of the source and experimentation, it seems to have this syntax:

    MIRROR_ENTRY ::= LOG_CONFIG nr_mirrors MIRROR_ENTRY*nr_mirrors [num_features FEATURE*]
    FEATURE ::= handle_errors
    LOG_CONFIG ::= "core" param_ct BASE_LOG_CONFIG | "disk" param_ct device_name BASE_LOG_CONFIG
    MIRROR_ENTRY ::= device_name device_offset
    BASE_LOG_CONFIG ::= region_size ["sync" | "nosync"]
    

    Note that setting num_features to 0 causes an OOPS in v3.0 - leave it out entirely unless passing the handle_errors feature.

    The param_ct in LOG_CONFIG counts the number of words in the BASE_LOG_CONFIG and (for disk logs) device_name. Set to 1 for core to leave sync/nosync on the default, for example.