Skip to content

54. dm-writeboost


This sample configuration does not use DRBD, it's just a simple dm-writeboost setup.

54.1 Installation on Centos 7

54.1.1 DKMS

yum install dkms -y

54.1.2 Writeboost DKMS module

Clone repository:

git clone
cd dm-writeboost && make && make install

Check that Writeboost DKMS is installed:

dkms status
lsmod | grep dm_writeboost

54.1.3 Writeboost tools

git clone
yum install cargo
cargo install
cp /root/.cargo/bin/* /usr/sbin/

Reboot and check module install

54.1.4 Create new Writeboost Cache

wbcreate --reformat --read_cache_threshold=127  --writeback_threshold=80 storage /dev/md0 /dev/nvme0n1
  • storage: new cache device name
  • md0: slow disks
  • nvme0n1: fast disks (cache device)

54.1.5 Crete writeboosttab and service

vi /etc/writeboosttab

## dm-writeboost "tab" (mappings) file, see writeboosttab(5).
##{DM target name}    {cached block device e.g. HDD}    {caching block device e.g. SSD}    [options]
## wb_hdd     /dev/disk/by-uuid/2e8260bc-024c-4252-a695-a73898c974c7     /dev/disk/by-partuuid/43372b68-3407-45fa-9b2f-61afe9c26a68    writeback_threshold=70,sync_data_interval=3600
storage     /dev/md0     /dev/nvme0n1    writeback_threshold=80,read_cache_threshold=127

This is a sample writeboost systemd unit file:

systemctl daemon-reload systemctl enable writeboost

54.1.6 DRBD9 over Writeboost

To use writeboost in a drbd setup we should create a writeboost cache device on each drbd node and then use that cache device as a pv for drbd9 drbdpool volume group. So drbd9 will be run over a mounted cache device on each node. And this is the modified writeboost service file that we use when drbd9 is used over writeboost:

Description=(dm-)writeboost mapper

## "Before=local-fs-pre" is significant as it influences correct order
## of stopping (after unmount). drbd.service drbdmanaged.service


## Must remain after exit to prevent stopping right after start
## and to stop on shutdown.

## Scannong caching devices may take long time after unclean shutdown.

ExecStart=/usr/bin/bash -c '/usr/sbin/writeboost; lvscan; lvchange -ay /dev/drbdpool/data_00'
ExecStop=/usr/sbin/writeboost -u

## Long "TimeoutStop" is essential as deadlock may happen if writeboost
## is killed during flushing of caches on shutdown, etc.