Installs and configures the Distributed Replicated Block Device (DRBD) service for mirroring block devices between a pair of hosts. Right now it simply works in pairs, multiple hosts could be supported with a few small changes.
This cookbook now exposes a resource-first API for the core DRBD workflow:
drbd_installinstalls the DRBD packagesdrbd_pairrenders pair configuration and exposes initialization, promotion, formatting, and mounting as explicit actions
The legacy drbd::default and drbd::pair recipes remain as compatibility wrappers in this incremental modernization slice.
The drbd cookbook does not partition drives. It will format partitions given a filesystem type, but it does not explicitly depend on the xfs cookbook if you want that type of filesystem, but you can put it in your run list and set the node['drbd']['fs_type'] to 'xfs' or 'ext4' or whatever.
This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.
- Debian
- Fedora
- openSUSE Leap
- Oracle Linux
- Red Hat Enterprise Linux
- AlmaLinux
- Ubuntu
- Chef 15.3+
- yum-elrepo
Current x86_64 Kitchen verification in this migration branch covers AlmaLinux 9, Debian 12, and Ubuntu 24.04. On EL9 x86_64, the cookbook installs drbd9x-utils and kmod-drbd9x from ELRepo. RHEL support remains declared through the same ELRepo path, and ChefSpec covers that package-selection flow explicitly. EL9 aarch64 and Amazon Linux 2023 remain outside the verified matrix for this release line.
Installs DRBD packages. On the RHEL path it bootstraps yum-elrepo by default. EL9 x86_64 installs drbd9x-utils and kmod-drbd9x; older EL releases continue using drbd-utils and kmod-drbd.
drbd_install 'default'Renders pair configuration and keeps the stateful replication steps explicit.
drbd_pair 'pair' do
local_ip '192.0.2.10'
remote_host 'node-b'
remote_ip '192.0.2.11'
disk '/dev/sdb1'
mount_point '/srv/drbd'
primary true
action %i(configure initialize promote format mount)
endThis replaces the old configured node flag with runtime checks against DRBD and the block device. Initial convergence may still be multi-step on real hardware, but the resource no longer relies on persisted node state to reach the mount step.
The compatibility recipes still map the historical attributes into the new resources. The required attributes are:
node['drbd']['remote_host']- Remote host to pair with.node['drbd']['remote_ip']- Remote host to pair with.node['drbd']['local_ip']- Remote host to pair with.node['drbd']['disk']- Disk partition to mirror.node['drbd']['mount']- Mount point to mirror.node['drbd']['fs_type']- Disk format for the mirrored disk, defaults toext3.node['drbd']['master']- Whether this node is master between the pair, defaults tofalse.
The optional attributes are:
node['drbd']['packages']- Optional explicit package override for the compatibility recipes. When unset, the custom resource resolves platform-specific defaults.
There are a pair of example roles drbd-pair.rb and drbd-pair-master.rb with the cookbook source.
This project exists thanks to all the people who contribute.
Thank you to all our backers!
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.