# We open sourced dm-cdp: a device mapper target for block level continuous data protection on Linux

## Introduction

The KVMDR team has released **dm-cdp**, a device mapper target that records every write at the Linux block layer, under GPL v2. We have also started developing **kvmdr_fs** on GitHub, a filesystem for sharing SAN LUNs across multiple KVM hosts.

This post explains how dm-cdp works and how to try it.

## What is dm-cdp?

dm-cdp is a kernel module for in guest continuous data protection (CDP). Wrap a block device with the device mapper `cdp` target, and every write to that device becomes available as a journal.

* **Block level capture**: every write that reaches the disk is recorded, whatever the filesystem.
* **Ring plus bitmap**: writes are drained through a ring buffer; if the ring overflows, the target falls back to a changed block bitmap so nothing is lost.
* **Userspace tools**: `tools/cdp-drain` pulls records from the ring, and `tools/cdp-apply` replays that stream onto another disk.
* **DKMS support**: `dkms.conf` is included, so the module rebuilds automatically after kernel updates.

## Tested environments

* Build verified (W=1, no warnings): 6.1 (Debian 12), 6.8 (Ubuntu 24.04), 6.12 (Debian 13)
* Runtime verified: 6.1 (smoke test, overflow, point in time restore with fio, real virtual disk)

It is still at the development stage, so we do not recommend it for production yet.

## Try it

```plaintext
make            # build module and tools (needs linux-headers for the running kernel)
make load       # insmod
tests/smoke.sh  # loop device: write, drain, replay, compare (run as root)
```

Full details of the target are in `Documentation/admin-guide/device-mapper/dm-cdp.rst`.

## kvmdr_fs (in development)

A FUSE based filesystem for sharing iSCSI and FC LUNs across KVM hosts, the way NFS shares are used. It is at an early stage and licensed under GPL v3.

## Links

* dm-cdp: https://github.com/ravi-gitprime/IO-Filter-Driver-for-Linux
* kvmdr_fs: https://github.com/ravi-gitprime/kvmdr_fs

Issues and pull requests are welcome. We collect these projects and our video guides on our community page: https://kvmdr.ai/community
