HTTPS SSH
* How to build the kernel module

Basic steps as outlined, for example, here
https://help.ubuntu.com/community/Kernel/Compile

$ cd /usr/src/linux-source-3.2.0/linux-source-3.2.0
$ patch -p1 < devicemapper/code/dsync.diff

CONFIG_BLK_DEV_DM=m maye be best for testing. Otherwise you cannot
reload the code w/o rebooting; Compiling it as a module, has other
problems though. Ubuntu, for example, does not build it as a module.

Install and reboot.

* Test with loopback device

If you built as module, do "modprobe dm_mod" first.

# dd if=/dev/zero of=/tmp/128MB bs=1M count=128
# losetup /dev/loop0 /tmp/128MB
# echo 0 $(blockdev --getsz /dev/loop0) linear /dev/loop0 0 | dmsetup create loop0

You will now have a device named loop0 in /dev/mapper/

Check that no blocks have been modified

# cat /proc/loop0

Should return nothing. Now we modify a single block

# dd if=/dev/zero of=/dev/mapper/loop0 bs=4k count=1 seek=1336

# cat /proc/loop0

now returns 1337

Writing to /proc/loop0 resets the dirty vector

# echo 0 > /proc/loop0
# cat /proc/loop0

Again, returns nothing.

Next step could be to use /dev/mapper/loop0 as the backing store for a
virtual machine (VM). This way you can see which blocks the VM
modifies.

To dismantle everything

# dmsetup remove loop0
# losetup -d /dev/loop0