Skip to content

DMPD

thin_check, thin_dump, thin_repair, cache_check and related tools for inspecting and repairing device-mapper persistent data (dm-thin metadata, dm-cache metadata).

sts.dmpd

Wrappers for Device Mapper Persistent Data (DMPD) CLI tools.

Covers cache_, thin_, and era_* utilities for inspecting and repairing device-mapper target metadata on block devices or dump files.

CacheCheck

Bases: DmpdTool

Check cache metadata integrity.

Usage: cache_check [options] {device|file}

For available options, see: cache_check --help

Source code in sts_libs/src/sts/dmpd.py
73
74
75
76
77
78
79
80
81
class CacheCheck(DmpdTool):
    """Check cache metadata integrity.

    Usage: cache_check [options] {device|file}

    For available options, see: cache_check --help
    """

    TOOL_NAME = 'cache_check'

CacheDump

Bases: DmpdTool

Dump cache metadata to stdout or file.

Usage: cache_dump [options] {device|file}

For available options, see: cache_dump --help

Source code in sts_libs/src/sts/dmpd.py
84
85
86
87
88
89
90
91
92
class CacheDump(DmpdTool):
    """Dump cache metadata to stdout or file.

    Usage: cache_dump [options] {device|file}

    For available options, see: cache_dump --help
    """

    TOOL_NAME = 'cache_dump'

CacheMetadataSize

Bases: DmpdTool

Calculate cache metadata size requirements.

Usage: cache_metadata_size [options]

For available options, see: cache_metadata_size --help

Source code in sts_libs/src/sts/dmpd.py
117
118
119
120
121
122
123
124
125
class CacheMetadataSize(DmpdTool):
    """Calculate cache metadata size requirements.

    Usage: cache_metadata_size [options]

    For available options, see: cache_metadata_size --help
    """

    TOOL_NAME = 'cache_metadata_size'

CacheRepair

Bases: DmpdTool

Repair corrupted cache metadata.

Usage: cache_repair [options] --input {device|file} --output {device|file}

For available options, see: cache_repair --help

Source code in sts_libs/src/sts/dmpd.py
 95
 96
 97
 98
 99
100
101
102
103
class CacheRepair(DmpdTool):
    """Repair corrupted cache metadata.

    Usage: cache_repair [options] --input {device|file} --output {device|file}

    For available options, see: cache_repair --help
    """

    TOOL_NAME = 'cache_repair'

CacheRestore

Bases: DmpdTool

Restore cache metadata from backup.

Usage: cache_restore [options] --input --output {device|file}

For available options, see: cache_restore --help

Source code in sts_libs/src/sts/dmpd.py
106
107
108
109
110
111
112
113
114
class CacheRestore(DmpdTool):
    """Restore cache metadata from backup.

    Usage: cache_restore [options] --input <file> --output {device|file}

    For available options, see: cache_restore --help
    """

    TOOL_NAME = 'cache_restore'

DmpdTool

Bases: ABC

Base class for DMPD command-line tools.

Source code in sts_libs/src/sts/dmpd.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
class DmpdTool(ABC):
    """Base class for DMPD command-line tools."""

    # Tool name (must be set by subclasses)
    TOOL_NAME: ClassVar[str]

    @staticmethod
    def _build_command(cmd: str, device_or_file: str | Path | None = None, **options: CommandOption) -> str:
        """Build DMPD command string with options."""
        command_parts = [cmd]

        # Add device/file path if provided
        if device_or_file:
            command_parts.append(str(device_or_file))

        # Add options
        for option_key, value in options.items():
            if value is not None:
                key = option_key.replace('_', '-')
                if isinstance(value, bool):
                    if value:
                        command_parts.append(f'--{key}')
                else:
                    command_parts.append(f'--{key}={value!s}')

        return ' '.join(command_parts)

    @classmethod
    def run(cls, device_or_file: str | Path | None = None, **options: CommandOption) -> CommandResult:
        """Run the DMPD tool with specified options."""
        cmd = cls._build_command(cls.TOOL_NAME, device_or_file, **options)
        return run(cmd)

    @classmethod
    def help(cls) -> CommandResult:
        """Get help information for the tool."""
        return run(f'{cls.TOOL_NAME} --help')

    @classmethod
    def version(cls) -> CommandResult:
        """Get version information for the tool."""
        return run(f'{cls.TOOL_NAME} --version')

help() classmethod

Get help information for the tool.

Source code in sts_libs/src/sts/dmpd.py
59
60
61
62
@classmethod
def help(cls) -> CommandResult:
    """Get help information for the tool."""
    return run(f'{cls.TOOL_NAME} --help')

run(device_or_file=None, **options) classmethod

Run the DMPD tool with specified options.

Source code in sts_libs/src/sts/dmpd.py
53
54
55
56
57
@classmethod
def run(cls, device_or_file: str | Path | None = None, **options: CommandOption) -> CommandResult:
    """Run the DMPD tool with specified options."""
    cmd = cls._build_command(cls.TOOL_NAME, device_or_file, **options)
    return run(cmd)

version() classmethod

Get version information for the tool.

Source code in sts_libs/src/sts/dmpd.py
64
65
66
67
@classmethod
def version(cls) -> CommandResult:
    """Get version information for the tool."""
    return run(f'{cls.TOOL_NAME} --version')

EraCheck

Bases: DmpdTool

Check era metadata integrity.

Usage: era_check [options] {device|file}

For available options, see: era_check --help

Source code in sts_libs/src/sts/dmpd.py
222
223
224
225
226
227
228
229
230
class EraCheck(DmpdTool):
    """Check era metadata integrity.

    Usage: era_check [options] {device|file}

    For available options, see: era_check --help
    """

    TOOL_NAME = 'era_check'

EraDump

Bases: DmpdTool

Dump era metadata to stdout or file.

Usage: era_dump [options] {device|file}

For available options, see: era_dump --help

Source code in sts_libs/src/sts/dmpd.py
233
234
235
236
237
238
239
240
241
class EraDump(DmpdTool):
    """Dump era metadata to stdout or file.

    Usage: era_dump [options] {device|file}

    For available options, see: era_dump --help
    """

    TOOL_NAME = 'era_dump'

EraRepair

Bases: DmpdTool

Repair corrupted era metadata.

Usage: era_repair [options] --input {device|file} --output {device|file}

For available options, see: era_repair --help

Source code in sts_libs/src/sts/dmpd.py
244
245
246
247
248
249
250
251
252
class EraRepair(DmpdTool):
    """Repair corrupted era metadata.

    Usage: era_repair [options] --input {device|file} --output {device|file}

    For available options, see: era_repair --help
    """

    TOOL_NAME = 'era_repair'

EraRestore

Bases: DmpdTool

Restore era metadata from backup.

Usage: era_restore [options] --input --output {device|file}

For available options, see: era_restore --help

Source code in sts_libs/src/sts/dmpd.py
255
256
257
258
259
260
261
262
263
class EraRestore(DmpdTool):
    """Restore era metadata from backup.

    Usage: era_restore [options] --input <file> --output {device|file}

    For available options, see: era_restore --help
    """

    TOOL_NAME = 'era_restore'

ThinCheck

Bases: DmpdTool

Check thin provisioning metadata integrity.

Usage: thin_check [options] {device|file}

For available options, see: thin_check --help

Source code in sts_libs/src/sts/dmpd.py
131
132
133
134
135
136
137
138
139
class ThinCheck(DmpdTool):
    """Check thin provisioning metadata integrity.

    Usage: thin_check [options] {device|file}

    For available options, see: thin_check --help
    """

    TOOL_NAME = 'thin_check'

ThinDelta

Bases: DmpdTool

Print differences between thin devices.

Usage: thin_delta [options]

For available options, see: thin_delta --help

Source code in sts_libs/src/sts/dmpd.py
208
209
210
211
212
213
214
215
216
class ThinDelta(DmpdTool):
    """Print differences between thin devices.

    Usage: thin_delta [options] <input>

    For available options, see: thin_delta --help
    """

    TOOL_NAME = 'thin_delta'

ThinDump

Bases: DmpdTool

Dump thin metadata to stdout or file.

Usage: thin_dump [options] {device|file}

For available options, see: thin_dump --help

Source code in sts_libs/src/sts/dmpd.py
142
143
144
145
146
147
148
149
150
class ThinDump(DmpdTool):
    """Dump thin metadata to stdout or file.

    Usage: thin_dump [options] {device|file}

    For available options, see: thin_dump --help
    """

    TOOL_NAME = 'thin_dump'

ThinLs

Bases: DmpdTool

List thin devices.

Usage: thin_ls [options] {device|file}

For available options, see: thin_ls --help

Source code in sts_libs/src/sts/dmpd.py
197
198
199
200
201
202
203
204
205
class ThinLs(DmpdTool):
    """List thin devices.

    Usage: thin_ls [options] {device|file}

    For available options, see: thin_ls --help
    """

    TOOL_NAME = 'thin_ls'

ThinMetadataSize

Bases: DmpdTool

Calculate thin metadata size requirements.

Usage: thin_metadata_size [options]

For available options, see: thin_metadata_size --help

Source code in sts_libs/src/sts/dmpd.py
175
176
177
178
179
180
181
182
183
class ThinMetadataSize(DmpdTool):
    """Calculate thin metadata size requirements.

    Usage: thin_metadata_size [options]

    For available options, see: thin_metadata_size --help
    """

    TOOL_NAME = 'thin_metadata_size'

ThinRepair

Bases: DmpdTool

Repair corrupted thin metadata.

Usage: thin_repair [options] --input {device|file} --output {device|file}

For available options, see: thin_repair --help

Source code in sts_libs/src/sts/dmpd.py
153
154
155
156
157
158
159
160
161
class ThinRepair(DmpdTool):
    """Repair corrupted thin metadata.

    Usage: thin_repair [options] --input {device|file} --output {device|file}

    For available options, see: thin_repair --help
    """

    TOOL_NAME = 'thin_repair'

ThinRestore

Bases: DmpdTool

Restore thin metadata from backup.

Usage: thin_restore [options] --input --output {device|file}

For available options, see: thin_restore --help

Source code in sts_libs/src/sts/dmpd.py
164
165
166
167
168
169
170
171
172
class ThinRestore(DmpdTool):
    """Restore thin metadata from backup.

    Usage: thin_restore [options] --input <file> --output {device|file}

    For available options, see: thin_restore --help
    """

    TOOL_NAME = 'thin_restore'

ThinTrim

Bases: DmpdTool

Trim thin metadata.

Usage: thin_trim [options] --data-dev {device} --metadata-dev {device}

For available options, see: thin_trim --help

Source code in sts_libs/src/sts/dmpd.py
186
187
188
189
190
191
192
193
194
class ThinTrim(DmpdTool):
    """Trim thin metadata.

    Usage: thin_trim [options] --data-dev {device} --metadata-dev {device}

    For available options, see: thin_trim --help
    """

    TOOL_NAME = 'thin_trim'

cache_check(device_or_file, **options)

Check cache metadata integrity.

Source code in sts_libs/src/sts/dmpd.py
269
270
271
def cache_check(device_or_file: str | Path, **options: CommandOption) -> CommandResult:
    """Check cache metadata integrity."""
    return CacheCheck.run(device_or_file, **options)

cache_dump(device_or_file, **options)

Dump cache metadata.

Source code in sts_libs/src/sts/dmpd.py
274
275
276
def cache_dump(device_or_file: str | Path, **options: CommandOption) -> CommandResult:
    """Dump cache metadata."""
    return CacheDump.run(device_or_file, **options)

cache_metadata_size(**options)

Calculate cache metadata size.

Source code in sts_libs/src/sts/dmpd.py
289
290
291
def cache_metadata_size(**options: CommandOption) -> CommandResult:
    """Calculate cache metadata size."""
    return CacheMetadataSize.run(None, **options)

cache_repair(**options)

Repair cache metadata.

Source code in sts_libs/src/sts/dmpd.py
279
280
281
def cache_repair(**options: CommandOption) -> CommandResult:
    """Repair cache metadata."""
    return CacheRepair.run(None, **options)

cache_restore(**options)

Restore cache metadata.

Source code in sts_libs/src/sts/dmpd.py
284
285
286
def cache_restore(**options: CommandOption) -> CommandResult:
    """Restore cache metadata."""
    return CacheRestore.run(None, **options)

era_check(device_or_file, **options)

Check era metadata integrity.

Source code in sts_libs/src/sts/dmpd.py
334
335
336
def era_check(device_or_file: str | Path, **options: CommandOption) -> CommandResult:
    """Check era metadata integrity."""
    return EraCheck.run(device_or_file, **options)

era_dump(device_or_file, **options)

Dump era metadata.

Source code in sts_libs/src/sts/dmpd.py
339
340
341
def era_dump(device_or_file: str | Path, **options: CommandOption) -> CommandResult:
    """Dump era metadata."""
    return EraDump.run(device_or_file, **options)

era_repair(**options)

Repair era metadata.

Source code in sts_libs/src/sts/dmpd.py
344
345
346
def era_repair(**options: CommandOption) -> CommandResult:
    """Repair era metadata."""
    return EraRepair.run(None, **options)

era_restore(**options)

Restore era metadata.

Source code in sts_libs/src/sts/dmpd.py
349
350
351
def era_restore(**options: CommandOption) -> CommandResult:
    """Restore era metadata."""
    return EraRestore.run(None, **options)

get_help(tool_name)

Get help for any DMPD tool.

Source code in sts_libs/src/sts/dmpd.py
354
355
356
def get_help(tool_name: str) -> CommandResult:
    """Get help for any DMPD tool."""
    return run(f'{tool_name} --help')

get_version(tool_name)

Get version for any DMPD tool.

Source code in sts_libs/src/sts/dmpd.py
359
360
361
def get_version(tool_name: str) -> CommandResult:
    """Get version for any DMPD tool."""
    return run(f'{tool_name} --version')

thin_check(device_or_file, **options)

Check thin metadata integrity.

Source code in sts_libs/src/sts/dmpd.py
294
295
296
def thin_check(device_or_file: str | Path, **options: CommandOption) -> CommandResult:
    """Check thin metadata integrity."""
    return ThinCheck.run(device_or_file, **options)

thin_delta(device_or_file, **options)

Print differences between thin devices.

Source code in sts_libs/src/sts/dmpd.py
329
330
331
def thin_delta(device_or_file: str | Path, **options: CommandOption) -> CommandResult:
    """Print differences between thin devices."""
    return ThinDelta.run(device_or_file, **options)

thin_dump(device_or_file, **options)

Dump thin metadata.

Source code in sts_libs/src/sts/dmpd.py
299
300
301
def thin_dump(device_or_file: str | Path, **options: CommandOption) -> CommandResult:
    """Dump thin metadata."""
    return ThinDump.run(device_or_file, **options)

thin_ls(device_or_file, **options)

List thin devices.

Source code in sts_libs/src/sts/dmpd.py
324
325
326
def thin_ls(device_or_file: str | Path, **options: CommandOption) -> CommandResult:
    """List thin devices."""
    return ThinLs.run(device_or_file, **options)

thin_metadata_size(**options)

Calculate thin metadata size.

Source code in sts_libs/src/sts/dmpd.py
314
315
316
def thin_metadata_size(**options: CommandOption) -> CommandResult:
    """Calculate thin metadata size."""
    return ThinMetadataSize.run(None, **options)

thin_repair(**options)

Repair thin metadata.

Source code in sts_libs/src/sts/dmpd.py
304
305
306
def thin_repair(**options: CommandOption) -> CommandResult:
    """Repair thin metadata."""
    return ThinRepair.run(None, **options)

thin_restore(**options)

Restore thin metadata.

Source code in sts_libs/src/sts/dmpd.py
309
310
311
def thin_restore(**options: CommandOption) -> CommandResult:
    """Restore thin metadata."""
    return ThinRestore.run(None, **options)

thin_trim(**options)

Trim thin metadata.

Source code in sts_libs/src/sts/dmpd.py
319
320
321
def thin_trim(**options: CommandOption) -> CommandResult:
    """Trim thin metadata."""
    return ThinTrim.run(None, **options)