DRBD replication status reference

DRBD replication status reference

The SC//Reliantâ„¢ platform uses DRBD (Distributed Replicated Block Device) to keep the two nodes of an HA cluster holding identical data. Several cluster procedures ask you to check DRBD status before acting, for example, before performing maintenance on a node. This page explains which command to use on a given node and how to read the output, so you can confirm the nodes are in sync and tell a healthy state from one that needs attention.

Nodes across the fleet do not all offer the same command for this. Read Checking DRBD status before running anything, because the interface available depends on which version of the DRBD utilities the node has.

Checking DRBD status

Which command to use

cat /proc/drbd works on every node the platform currently runs and needs no privileges. Use it when you want one command that behaves the same everywhere, for example in a runbook or an escalation checklist.

cat /proc/drbd

sudo drbdadm status is available on nodes whose DRBD utilities are version 9.1.0 or later, which is the release that added the subcommand for 8.4 kernel modules. Where it is available it is easier to read, because it lists resources by name rather than by minor number.

sudo drbdadm status

To find out which you have, check the utility version. DRBDADM_VERSION is the one that determines whether status exists.

sudo drbdadm --version

The two versions in that output are independent of each other, and both matter:

  • DRBDADM_VERSION The version of the drbd-utils package, which supplies the drbdadm command table. On the platform this is either 8.9.x, where status against an 8.4 module returns drbdadm: Unknown command 'status', or 9.x, where it works.
  • DRBD_KERNEL_VERSION_CODE The version of the loaded kernel module, as a hexadecimal triplet. For example, 0x08040b is 8.4.11 and 0x080407 is 8.4.7. This determines which states the module can report, and it is also readable from the first line of /proc/drbd.

A node can have a 9.x utility on top of an 8.4 kernel module. On such a node drbdadm status works and prints the 9.x tree format even though the module is 8.4. Do not infer the utility version from the module version, or the reverse.

IMPORTANT: Some upstream DRBD documentation describes /proc/drbd as deprecated in favor of drbdadm status. Do not rewrite platform runbooks on that basis. /proc/drbd is present wherever the kernel module is 8.x, and it is the only interface available on nodes with 8.9.x utilities.

The two output formats

The same underlying information is reported under different field names depending on which command you ran.

Concept/proc/drbddrbdadm status
Resource identityMinor number, for example 50:Resource name, for example win1
Local roleFirst value of ro:role:
Peer roleSecond value of ro:The role: on the indented peer line
Local disk stateFirst value of ds:disk:
Peer disk stateSecond value of ds:peer-disk:
Link statecs:Split across connection: and replication:. See below.
Resync progresssync'ed: percentagedone: percentage
Out-of-sync volumeoos:, always presentout-of-sync:, only with --statistics

The one field that does not map cleanly is the connection state. /proc/drbd reports a single cs: value covering both whether the peer is reachable and whether data is flowing. The tree format splits that into two:

  • connection: Whether the nodes are talking. Values include Connected, Connecting, and StandAlone.
  • replication: Whether data is moving, and in which direction. Values include Established, SyncSource, SyncTarget, and Off.

So cs:Connected corresponds to connection:Connected together with replication:Established, while cs:StandAlone corresponds to connection:StandAlone. Fields at their default value are omitted from the output, which is why the healthy sample below shows no connection: line.

A healthy resource in the tree format looks like this:

win1 role:Primary
  disk:UpToDate
  peer role:Secondary
    replication:Established peer-disk:UpToDate

The equivalent in /proc/drbd, read from the node holding the secondary copy, is a single line plus a counters line:

50: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----
    ns:0 nr:14064 dw:14064 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0

The state tables below use the /proc/drbd field names. The state values themselves (Primary, UpToDate, StandAlone, and so on) are the same in both formats.

Roles (ro: local/peer)

A DRBD resource has a role on each node, written local/peer.

RoleMeaning
PrimaryThe active copy. The device is read/write, the filesystem is mounted, and the VMs run here. In a healthy cluster this is the node holding the Virtual IP (VIP).
SecondaryThe standby copy. The device receives replicated writes but is not mounted and cannot be written to directly. This is expected on the idle node; it is not a fault.
UnknownThe peer's role cannot be determined because the replication link is down. Only ever reported for the peer, never for the local node.

Only one node is Primary at a time. ro:Primary/Secondary means the local node is active and the peer is the standby. In the tree format the same state reads as role:Primary with peer role:Secondary.

A node reporting Primary locally and Unknown for its peer, on both nodes at once, is the signature of a split-brain. Each node is claiming the active role while unable to see its peer.

NOTE: All resources reporting Primary on the same node is the desired steady state, not a fault. It means the cluster has its workloads consolidated. Both nodes reporting Primary for the same resource is the problem.

Connection states (cs:)

The connection state describes the replication link to the peer.

StateMeaningAction
ConnectedBoth nodes are communicating and replicating normally.None. This is the steady state.
SyncSourceThe local node is sending resync data to the peer. The local copy holds the good data.Let the resync finish.
SyncTargetThe local node is receiving resync data from the peer and is catching up.Let the resync finish. Do not promote this node until it reaches UpToDate.
WFConnectionThe local node is waiting for an offline peer to become reachable.Expected while the peer is down or in standby. Investigate if the peer should be online.
StandAloneNo connection to the peer and not attempting one. Typically follows a detected split-brain or a manual disconnect.Investigate. The nodes are no longer replicating and may need split-brain recovery.

Disk states (ds: local/peer)

The disk state describes how current and consistent each copy of the data is, written local/peer.

StateMeaning
UpToDateThe data is current and consistent.
InconsistentThe data is not consistent, which is normal for a SyncTarget mid-resync, or before an initial sync completes. Not safe to promote.
OutdatedThe data is consistent but known to be older than the peer's. DRBD refuses to promote an Outdated disk, so Pacemaker will not fail over to it. This is a safety feature that prevents serving stale data.
DUnknownThe peer's disk state cannot be determined because the replication link is down.

Common combinations

ds: valueInterpretation
UpToDate/UpToDateBoth nodes fully in sync. Healthy steady state.
UpToDate/InconsistentLocal copy current, peer still catching up (peer is the SyncTarget).
Inconsistent/UpToDateLocal copy catching up from the peer (local is the SyncTarget).
UpToDate/DUnknownLocal copy current, peer unreachable (offline or in standby). Expected while a node is down for maintenance.

How a resync works

DRBD does not re-copy the whole disk after a disconnect. While the peer is away, the Primary marks each written extent "dirty" in its out-of-sync bitmap. On reconnect, only those dirty extents are resynced.

NodeRole in the resyncTypical status
SyncSourceReads the dirty extents and transmits them to the peer.cs:SyncSource, ds:UpToDate/Inconsistent
SyncTargetReceives the extents and writes them to its local disk.cs:SyncTarget, ds:Inconsistent/UpToDate

DRBD tracks what needs resyncing using three pieces of metadata:

  • Generation Identifiers (GI). Markers that let both nodes agree which side has the fresher data after a disconnect.
  • Out-of-sync bitmap. Tracks exactly which extents changed while the peer was unreachable, so only those extents resync.
  • Activity log. A circular log of recently written extents that enables a fast resync after a clean disconnect.

Reading a live sync

During a resync, the /proc/drbd view for a resource looks like this:

2: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r-----
    ns:162850608 nr:0 dw:162843319 dr:1044 al:411567 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:98304
    [=============>......] sync'ed: 78.1% (98304/450560)K
    finish: 0:02:41 speed: 29,752 (29,108) K/sec

The first line reports the resource state:

  • 2: The DRBD resource (minor) number.
  • cs:SyncSource Connection state. This node is supplying resync data, so the peer is the SyncTarget.
  • ro:Primary/Secondary Roles. This node is Primary, the peer is Secondary.
  • ds:UpToDate/Inconsistent Disk states. This node is current, the peer is still incomplete.
  • C The replication protocol. Protocol C is fully synchronous, meaning a write is acknowledged only after it has reached both nodes' disks.

The remaining lines appear only while a resync is running:

  • sync'ed: 78.1% (98304/450560)K Resync progress. The parenthetical is the data still to copy out of the total, here 98,304 KB of 450,560 KB remaining. It matches oos on the counters line, in the same unit. The progress bar is identical on both nodes.
  • finish: 0:02:41 speed: 29,752 (29,108) K/sec The estimated time remaining, the current transfer rate, and, in parentheses, the average rate since the resync started.

The counters line reports cumulative activity in KB, or as a count where noted:

CounterMeaning
nsNetwork send, total data sent to the peer.
nrNetwork receive, total data received from the peer.
dwDisk write, total data written to local disk.
drDisk read, total data read from local disk.
alActivity-log updates (count).
bmBitmap updates (count).
loLocal count, reference count on local device requests (count).
pePending, requests sent to the peer but not yet answered (count).
uaUnacknowledged, requests received from the peer but not yet answered (count).
apApplication pending, block I/O requests forwarded to DRBD but not yet answered (count).
epEpochs, number of epoch objects (count).
woWrite order, currently used method: b (barrier), f (flush), d (drain), or n (none).
oosOut of sync, data still to be synchronized. Matches the "remaining" figure in the progress line and should fall to 0 as the resync completes.

Quick interpretation

  • Healthy: cs:Connected with ds:UpToDate/UpToDate on both nodes.
  • Expected during maintenance: the surviving node shows the peer as WFConnection and/or ds:...DUnknown while the other node is in standby or powered off.
  • Wait, do not promote: a node showing ds:Inconsistent or a cs:SyncTarget resync in progress. Let oos reach 0 first.
  • Investigate: cs:StandAlone (possible split-brain), an Outdated disk (Pacemaker will not fail over to it), or an oos value that is not decreasing.