Crate devicemapper [−] [src]
Low-level devicemapper configuration of the running kernel.
Overview
Linux's devicemapper allows the creation of block devices whose storage is mapped to other block devices in useful ways, either by changing the location of its data blocks, or performing some operation on the data itself. This is a low-level facility that is used by higher-level volume managers such as LVM2. Uses may include:
- Dividing a large block device into smaller logical volumes (dm-linear)
- Combining several separate block devices into a single block device with better performance and/or redundancy (dm-raid)
- Encrypting a block device (dm-crypt)
- Performing Copy-on-Write (COW) allocation of a volume's blocks enabling fast volume cloning and snapshots (dm-thin)
- Configuring a smaller, faster block device to act as a cache for a larger, slower one (dm-cache)
- Verifying the contents of a read-only volume (dm-verity)
Usage
Before they can be used, DM devices must be created using
DM::device_create()
, have a mapping table loaded using
DM::table_load()
, and then activated with
DM::device_suspend()
. (This function is used for both suspending
and activating a device.) Once activated, they can be used as a
regular block device, including having other DM devices map to
them.
Devices have "active" and "inactive" mapping tables. See function descriptions for which table they affect.
Modules
IEC |
International Electrotechnical Commission Units Standards |
Structs
Bytes |
Structure to represent bytes |
DM |
Context needed for communicating with devicemapper. |
DataBlocks |
A type for Data Blocks as used by the thin pool. |
Device |
A struct containing the device's major and minor numbers |
DmFlags |
Flags used by devicemapper. |
DmName |
The borrowed version of the DM identifier. |
DmNameBuf |
The owned version of the DM identifier. |
DmUuid |
The borrowed version of the DM identifier. |
DmUuidBuf |
The owned version of the DM identifier. |
LinearDev |
A DM construct of combined Segments |
MetaBlocks |
A type for Meta Data blocks as used by the thin pool. MetaBlocks have a kernel defined constant size of META_BLOCK_SIZE |
Sectors |
A separate type to store counts and offsets expressed in 512-byte sectors. |
Segment |
struct to represent a continuous set of sectors on a disk |
TargetLine |
One line of a device mapper table. |
TargetType |
The borrowed version of the DM identifier. |
TargetTypeBuf |
The owned version of the DM identifier. |
ThinDev |
DM construct for a thin block device |
ThinDevId |
A thindev id is a 24 bit number, i.e., its bit width is not a power of 2. |
ThinPoolBlockUsage |
Contains values indicating the thinpool's used vs total allocations for metadata and data blocks. |
ThinPoolDev |
DM construct to contain thin provisioned devices |
Enums
DevId |
Used as a parameter for functions that take either a Device name or a Device UUID. |
DmError |
Super error type, with constructors distinguishing outer errors from core errors. |
ErrorEnum |
A very simple breakdown of outer layer errors. |
ThinPoolStatus |
Top-level thinpool status that indicates if it is working or failed. |
ThinPoolWorkingStatus |
Indicates if a working thinpool is working optimally, or is experiencing a non-fatal error condition. |
ThinStatus |
Thin device status. |
Constants
DM_ACTIVE_PRESENT |
Out: Active table is present. |
DM_BUFFER_FULL |
Out: Passed-in buffer was too small. |
DM_DATA_OUT |
Out: A message generated output data. |
DM_DEFERRED_REMOVE |
In: Do not remove in-use devices. Out: Device scheduled to be removed when closed. |
DM_INACTIVE_PRESENT |
Out: Inactive table is present. |
DM_INTERNAL_SUSPEND |
Out: Device is suspended internally. |
DM_NOFLUSH |
In: Suspend without flushing queued I/Os. |
DM_PERSISTENT_DEV |
In: Use passed-in minor number. |
DM_QUERY_INACTIVE_TABLE |
In: Query inactive table instead of active. |
DM_READONLY |
In: Device should be read-only. Out: Device is read-only. |
DM_SECURE_DATA |
In: All buffers are wiped after use. Use when handling crypto keys. |
DM_SKIP_BDGET |
Obsolete. |
DM_SKIP_LOCKFS |
In: Avoid freezing filesystem when suspending. |
DM_STATUS_TABLE |
In: STATUS command returns table info instead of status. |
DM_SUSPEND |
In: Device should be suspended. Out: Device is suspended. |
DM_UEVENT_GENERATED |
Out: A uevent was generated, the caller may need to wait for it. |
DM_UUID |
In: Rename affects UUID field, not name field. |
SECTOR_SIZE |
disk sector size in bytes |
Traits
DmDevice |
A trait capturing some shared properties of DM devices. |
Functions
device_exists |
Check if a device of the given name exists. |
Type Definitions
DmResult |
return result for DM functions |