Skip to main content
linbit.com linbit.com Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Automatically Mount a DRBD Device at Boot

There might be occasions where it is required to mount the DRBD® device at boot outside of a cluster resource manager (CRM) such as Pacemaker or DRBD Reactor. You can accomplish this using systemd.

In this example you will mount the DRBD resource r0 with a device path of /dev/drbd0 at the mount point /mnt/drbd/r0 at boot.

It is usually a good idea to wait for DRBD to connect to its peers before promoting a resource to primary status on a node. To do this, you should enable and use the templated drbd-wait-promotable systemd unit for the r0 resource.

systemctl enable drbd-wait-promotable@r0.service

Create a systemd unit file named /etc/systemd/system/mnt-drbd-r0.mount. You must name the unit file with the mount path as the name, substituting dashes for slashes. The contents of this unit file should look similar to the example below:

[Unit]
Description=Mount DRBD device

[Mount]
What=/dev/drbd0
Where=/mnt/drbd/r0
Type=xfs
Options=defaults

[Unit]
DefaultDependencies=no

BindsTo = drbd-promote@r0.service
After = drbd-promote@r0.service

[Install]
WantedBy=multi-user.target

Lastly, load this new until into systemd and set this custom systemd unit to start at boot.

 # systemctl daemon-reload
 # systemctl enable mnt-drbd-r0.mount

Reviewed 2026/01/18 – MDK