Deleting a DRBD resource permanently removes a replicated block-device definition from the nodes that know about it. Use it when a resource such as wwwdata has been retired, moved elsewhere, or rebuilt under a different name and must not start again after a reboot.
drbdadm reads resource definitions from the DRBD configuration and translates resource operations into drbdsetup and drbdmeta actions. The resource definition must stay in place until the resource is down and any metadata that should be removed has been wiped, because wipe-md needs the resource's device and backing-disk mapping.
The process must run on every node that has the resource definition. Stop applications or cluster managers first, keep any data backup or metadata dump needed for rollback, and leave other DRBD resources and package files in place unless the whole DRBD stack is being removed.
Related: How to disable a DRBD resource
Related: How to back up DRBD metadata before a change
Related: How to back up and restore DRBD metadata
$ sudo drbdadm dump wwwdata resource wwwdata { on node-a { device /dev/drbd0 minor 0; disk /dev/vg0/wwwdata; meta-disk internal; address ipv4 192.0.2.10:7789; } on node-b { device /dev/drbd0 minor 0; disk /dev/vg0/wwwdata; meta-disk internal; address ipv4 192.0.2.11:7789; } }
Use the actual resource name and device paths from the local configuration. Keep this output or a metadata dump outside the backing device if rollback might be needed.
$ sudo systemctl stop wwwdata.service
If Pacemaker or another cluster manager owns the resource, disable or remove the cluster resource first so it does not restart DRBD while the deletion is in progress.
$ findmnt /dev/drbd0
No output means no filesystem is mounted from that device. Unmount the filesystem before continuing if findmnt prints a mount point.
$ sudo drbdadm status wwwdata
wwwdata role:Secondary
disk:UpToDate
node-b role:Secondary
peer-disk:UpToDate
$ sudo drbdadm secondary wwwdata
The demotion fails if an application, filesystem, or cluster resource is still using the replicated device.
$ sudo drbdadm --dry-run down wwwdata drbdsetup down wwwdata
$ sudo drbdadm down wwwdata
drbdadm down removes the resource's volumes, connections, and runtime resource object. It does not remove the configuration file or application data on the backing device.
$ sudo drbdadm wipe-md wwwdata Do you really want to wipe out the DRBD meta data? [need to type 'yes' to confirm] yes Wiping meta data... DRBD meta data block successfully wiped out.
This removes the DRBD metadata from the backing device. It does not replace an application backup and is hard to reverse.
$ sudo rm /etc/drbd.d/wwwdata.res
Remove only the resource file for the retired resource. Leave /etc/drbd.conf, /etc/drbd.d/global_common.conf, and other resource files in place when other DRBD resources still run on the node.
$ sudo drbdadm dump wwwdata no resources defined!
The exact failure text can vary by drbd-utils version and local include layout. A successful final state is that the retired resource no longer appears in drbdadm dump all or drbdadm status output.