DRBDSETUP(8)

πŸ“¦
version 9.22.0 Β· 2 versions
  • 9.22.0 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 9.15.0 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

drbdsetup β€” setup tool for DRBD, bestie ✨ (it's the drbdsetup(8) page, from the System Administration corner of the manual, and yes we're doing the whole thing, no skipping πŸ’…)


πŸŽ€ SYNOPSIS πŸŽ€

okay so here's the whole vibe, every invocation, verbatim:

drbdsetup {device} disk {lower_dev} {meta_data_dev} {meta_data_index}
          [-d {size}] [-e {err_handler}] [-f {fencing_policy}] [-b]
          [-t {disk_timeout}]

drbdsetup {device} net [af:] {local_addr} [:port] [af:] {remote_addr}
          [:port] {protocol} [-c {time}] [-i {time}] [-t {val}]
          [-S {size}] [-r {size}] [-k {count}] [-e {max_epoch_size}]
          [-b {max_buffers}] [-m] [-a {hash_alg}] [-x {shared_secret}]
          [-A {asb-0p-policy}] [-B {asb-1p-policy}] [-C {asb-2p-policy}]
          [-D] [-R {role-resync-conflict-policy}] [-p {ping_timeout}]
          [-u {val}] [-d {hash_alg}] [-o] [-n] [-g {congestion_policy}]
          [-f {val}] [-h {val}]

drbdsetup {device} syncer [-a {dev_minor}] [-r {rate}] [-e {extents}]
          [-v {verify-hash-alg}] [-c {cpu-mask}] [-C {csums-hash-alg}]
          [-R] [-p {plan_time}] [-s {fill_target}] [-d {delay_target}]
          [-m {max_rate}] [-n {ond-policy}]

drbdsetup {device} disconnect

drbdsetup {device} detach [-f]

drbdsetup {device} down

drbdsetup {device} primary [-f] [-o]

drbdsetup {device} secondary

drbdsetup {device} verify [-s {start-position}] [-S {stop-position}]

drbdsetup {device} invalidate

drbdsetup {device} invalidate-remote

drbdsetup {device} wait-connect [-t {wfc_timeout}]
          [-d {degr_wfc_timeout}] [-o {outdated_wfc_timeout}] [-w]

drbdsetup {device} wait-sync [-t {wfc_timeout}] [-d {degr_wfc_timeout}]
          [-o {outdated_wfc_timeout}] [-w]

drbdsetup {device} role

drbdsetup {device} cstate

drbdsetup {device} dstate

drbdsetup {device} status

drbdsetup {device} resize [-d {size}] [-f {assume-peer-has-space}]
          [-c {assume-clean}]

drbdsetup {device} check-resize

drbdsetup {device} pause-sync

drbdsetup {device} resume-sync

drbdsetup {device} outdate

drbdsetup {device} show-gi

drbdsetup {device} get-gi

drbdsetup {device} show

drbdsetup {device} suspend-io

drbdsetup {device} resume-io

drbdsetup {device} events [-u] [-a]

drbdsetup {device} new-current-uuid [-c]

🌸 DESCRIPTION 🌸

drbdsetup is the tool you use to associate DRBD devices with their backing block devices 🫢, to set up DRBD device pairs so they mirror their backing block devices, and to peek at the configuration of DRBD devices that are currently running. it's giving "let me talk to the driver directly" energy, and we love that for it.


⭐ NOTE ⭐

drbdsetup is a low level tool of the DRBD program suite πŸ‘‘. It's the one used by the data disk and drbd scripts to communicate with the device driver. so like, it's the backstage pass, iykyk.


πŸ¦‹ COMMANDS πŸ¦‹

Every drbdsetup sub-command might want arguments, and each one brings its own little set of options 🌈. Also important: all values have default units, and you can overrule those with K, M or G β€” defined the usual way (e.g. K = 2^10 = 1024) ✨.

πŸ’œ Common options πŸ’œ

All drbdsetup sub-commands accept these two options, no cap:

  • --create-device β€” if the DRBD device you specified (that's the minor number, bestie) doesn't exist yet, this creates it implicitly. so convenient fr fr.
  • --set-defaults β€” when --set-defaults is on the command line, every option of the invoked sub-command that isn't explicitly set gets reset to its default value. a little factory reset moment πŸ™ˆ.

πŸ’… disk πŸ’…

Associates device with lower_device to store its data blocks on. The -d (or --disk-size) should only be used if you wish not to use as much as possible from the backing block devices. If you do not use -d, the device is only ready for use as soon as it was connected to its peer once. (See the net command.) ✨

  • -d, --disk-size size β€” you can override DRBD's size determination method with this option. If you need to use the device before it was ever connected to its peer, use this option to pass the size of the DRBD device to the driver. Default unit is sectors (1s = 512 bytes).

If you use the size parameter in drbd.conf, we strongly recommend to add an explicit unit postfix. drbdadm and drbdsetup used to have mismatching default units. (a classic little historical oopsie 😭)

  • -e, --on-io-error err_handler β€” if the driver of the lower_device reports an error to DRBD, DRBD will mark the disk as inconsistent, call a helper program, or detach the device from its backing storage and perform all further IO by requesting it from the peer. The valid *err_handler*s are: pass_on, call-local-io-error and detach.
  • -f, --fencing fencing_policy β€” under fencing we understand preventive measures to avoid situations where both nodes are primary and disconnected (AKA split brain). 🚨

Valid fencing policies are:

  • dont-care β€” this is the default policy. No fencing actions are done. chill.
  • resource-only β€” if a node becomes a disconnected primary, it tries to outdate the peer's disk. This is done by calling the fence-peer handler. The handler is supposed to reach the other node over alternative communication paths and call 'drbdadm outdate res' there.
  • resource-and-stonith β€” if a node becomes a disconnected primary, it freezes all its IO operations and calls its fence-peer handler. The fence-peer handler is supposed to reach the peer over alternative communication paths and call 'drbdadm outdate res' there. In case it cannot reach the peer, it should stonith the peer. IO is resumed as soon as the situation is resolved. In case your handler fails, you can resume IO with the resume-io command.
  • -b, --use-bmbv β€” in case the backing storage's driver has a merge_bvec_fn() function, DRBD has to pretend that it can only process IO requests in units not larger than 4 KiB. (At time of writing the only known drivers which have such a function are: md (software raid driver), dm (device mapper - LVM) and DRBD itself.)

To get best performance out of DRBD on top of software raid (or any other driver with a merge_bvec_fn() function) you might enable this option, if you know for sure that the merge_bvec_fn() function will deliver the same results on all nodes of your cluster. I.e. the physical disks of the software raid are exactly of the same type.

USE THIS OPTION ONLY IF YOU KNOW WHAT YOU ARE DOING. πŸ’€ no like, seriously.
  • -a, --no-disk-barrier, -i, --no-disk-flushes, -D, --no-disk-drain β€” DRBD has four implementations to express write-after-write dependencies to its backing storage device. DRBD will use the first method that is supported by the backing storage device and that is not disabled by the user.

When selecting the method you should not only base your decision on the measurable performance. In case your backing storage device has a volatile write cache (plain disks, RAID of plain disks) you should use one of the first two. In case your backing storage device has battery-backed write cache you may go with option 3. Option 4 (disable everything, use "none") is dangerous on most IO stacks, may result in write-reordering, and if so, can theoretically be the reason for data corruption, or disturb the DRBD protocol, causing spurious disconnect/reconnect cycles.

Do not use no-disk-drain. πŸ™…β€β™€οΈ

Unfortunately device mapper (LVM) might not support barriers.

The letter after "wo:" in /proc/drbd indicates which method is currently in use for a device: b, f, d, n. The implementations:

  • barrier β€” the first requires that the driver of the backing storage device support barriers (called 'tagged command queuing' in SCSI and 'native command queuing' in SATA speak). The use of this method can be disabled by the --no-disk-barrier option. Note: Since Linux-2.6.36 (or RHEL's 2.6.32) this method is disabled.
  • flush β€” the second requires that the backing device support disk flushes (called 'force unit access' in the drive vendors speak). The use of this method can be disabled using the --no-disk-flushes option.
  • drain β€” the third method is simply to let write requests drain before write requests of a new reordering domain are issued. That was the only implementation before 8.0.9.
  • none β€” the fourth method is to not express write-after-write dependencies to the backing store at all, by also specifying --no-disk-drain. This is dangerous on most IO stacks, may result in write-reordering, and if so, can theoretically be the reason for data corruption, or disturb the DRBD protocol, causing spurious disconnect/reconnect cycles.
Do not use --no-disk-drain. πŸ’€ periodt.
  • -m, --no-md-flushes β€” disables the use of disk flushes and barrier BIOs when accessing the meta data device. See the notes on --no-disk-flushes. 🧚
  • -s, --max-bio-bvecs β€” in some special circumstances the device mapper stack manages to pass BIOs to DRBD that violate the constraints that are set forth by DRBD's merge_bvec() function and which have more than one bvec. A known example is: phys-disk -> DRBD -> LVM -> Xen -> missaligned partition (63) -> DomU FS. Then you might see "bio would need to, but cannot, be split:" in the Dom0's kernel log. 😭

The best workaround is to proper align the partition within the VM (E.g. start it at sector 1024). That costs 480 KiB of storage. Unfortunately the default of most Linux partitioning tools is to start the first partition at an odd number (63). Therefore most distributions install helpers for virtual linux machines will end up with missaligned partitions. The second best workaround is to limit DRBD's max bvecs per BIO (i.e., the max-bio-bvecs option) to 1, but that might cost performance.

The default value of max-bio-bvecs is 0, which means that there is no user imposed limitation.

  • -t, --disk-timeout disk_timeout β€” if the driver of the lower_device does not finish an IO request within disk_timeout, DRBD considers the disk as failed. If DRBD is connected to a remote host, it will reissue local pending IO requests to the peer, and ship all new IO requests to the peer only. The disk state advances to diskless, as soon as the backing block device has finished all IO requests.

The default value of disk-timeout is 0, which means that no timeout is enforced. The default unit is 100ms. This option is available since 8.3.12. ⭐

🌈 net 🌈

Sets up the device to listen on af:local_addr:port for incoming connections and to try to connect to af:remote_addr:port. If port is omitted, 7788 is used as default. If af is omitted ipv4 gets used. Other supported address families are ipv6, ssocks for Dolphin Interconnect Solutions' "super sockets" and sdp for Sockets Direct Protocol (Infiniband). πŸ¦‹

On the TCP/IP link, the protocol you specified gets used, periodt. Valid protocol specifiers are A, B, and C.

  • Protocol A: write IO is reported as completed if it has reached local disk and local TCP send buffer. πŸ’Ύ
  • Protocol B: write IO is reported as completed if it has reached local disk and remote buffer cache. 🧠
  • Protocol C: write IO is reported as completed if it has reached both local and remote disk. πŸ’½

  • -c, --connect-int time β€” okay so if it's not possible to connect to the remote DRBD device immediately, DRBD keeps on trying. This option sets the time between two retries. Default is 10 seconds, unit is 1 second. ⏱️
  • -i, --ping-int time β€” If the TCP/IP connection linking a DRBD device pair is idle for more than time seconds, DRBD will generate a keep-alive packet to check if its partner is still alive. Default is 10 seconds, unit is 1 second. πŸ’“
  • -t, --timeout val β€” If the partner node fails to send an expected response packet within val tenths of a second, the partner node is considered dead and therefore the TCP/IP connection is abandoned. Default is 60 (= 6 seconds). πŸ’€
  • -S, --sndbuf-size size β€” The socket send buffer is used to store packets sent to the secondary node, which are not yet acknowledged (from a network point of view) by the secondary node. When using protocol A, it might be necessary to increase the size of this data structure in order to increase asynchronicity between primary and secondary nodes. But keep in mind that more asynchronicity is synonymous with more data loss in the case of a primary node failure. Since 8.0.13 resp. 8.2.7 setting the size value to 0 means that the kernel should autotune this. The default size is 0, i.e. autotune. πŸŽ›οΈ
  • -r, --rcvbuf-size size β€” Packets received from the network are stored in the socket receive buffer first. From there they are consumed by DRBD. Before 8.3.2 the receive buffer's size was always set to the size of the socket send buffer. Since 8.3.2 they can be tuned independently. A value of 0 means that the kernel should autotune this. The default size is 0, i.e. autotune. πŸ“₯
  • -k, --ko-count count β€” In case the secondary node fails to complete a single write request for count times the timeout, it is expelled from the cluster, i.e. the primary node goes into StandAlone mode. To disable this feature, you should explicitly set it to 0; defaults may change between versions. πŸšͺ
  • -e, --max-epoch-size val β€” With this option the maximal number of write requests between two barriers is limited. Typically set to the same as --max-buffers, or the allowed maximum. Values smaller than 10 can lead to degraded performance. The default value is 2048. 🧱
  • -b, --max-buffers val β€” With this option the maximal number of buffer pages allocated by DRBD's receiver thread is limited. Typically set to the same as --max-epoch-size. Small values could lead to degraded performance. The default value is 2048, the minimum 32. Increase this if you cannot saturate the IO backend of the receiving side during linear write or during resync while otherwise idle.

See also drbd.conf(5) πŸ“–

  • -u, --unplug-watermark val β€” This setting has no effect with recent kernels that use explicit on-stack plugging (upstream Linux kernel 2.6.39, distributions may have backported). 🫠

When the number of pending write requests on the standby (secondary) node exceeds the unplug-watermark, we trigger the request processing of our backing storage device. Some storage controllers deliver better performance with small values, others deliver best performance when the value is set to the same value as max-buffers, yet others don't feel much effect at all. Minimum 16, default 128, maximum 131072. 🌊

  • -m, --allow-two-primaries β€” With this option set you may assign primary role to both nodes. You only should use this option if you use a shared storage file system on top of DRBD. At the time of writing the only ones are: OCFS2 and GFS. If you use this option with any other file system, you are going to crash your nodes and to corrupt your data! πŸ’₯
  • -a, --cram-hmac-alg alg β€” You need to specify the HMAC algorithm to enable peer authentication at all. You are strongly encouraged to use peer authentication. The HMAC algorithm will be used for the challenge response authentication of the peer. You may specify any digest algorithm that is named in /proc/crypto. πŸ”
  • -x, --shared-secret secret β€” The shared secret used in peer authentication. May be up to 64 characters. 🀫
  • -A, --after-sb-0pri asb-0p-policy β€” possible policies are:
    • disconnect β€” No automatic resynchronization, simply disconnect. βœ‚οΈ
    • discard-younger-primary β€” Auto sync from the node that was primary before the split-brain situation occurred. πŸ§“
    • discard-older-primary β€” Auto sync from the node that became primary as second during the split-brain situation. πŸ‘Ά
    • discard-zero-changes β€” In case one node did not write anything since the split brain became evident, sync from the node that wrote something to the node that did not write anything. In case none wrote anything this policy uses a random decision to perform a "resync" of 0 blocks. In case both have written something this policy disconnects the nodes. 🎲
    • discard-least-changes β€” Auto sync from the node that touched more blocks during the split brain situation. πŸ“Š
    • discard-node-NODENAME β€” Auto sync to the named node. 🎯
  • -B, --after-sb-1pri asb-1p-policy β€” possible policies are:
    • disconnect β€” No automatic resynchronization, simply disconnect. βœ‚οΈ
    • consensus β€” Discard the version of the secondary if the outcome of the after-sb-0pri algorithm would also destroy the current secondary's data. Otherwise disconnect. 🀝
    • discard-secondary β€” Discard the secondary's version. πŸ—‘οΈ
    • call-pri-lost-after-sb β€” Always honor the outcome of the after-sb-0pri algorithm. In case it decides the current secondary has the correct data, call the pri-lost-after-sb on the current primary. πŸ“ž
    • violently-as0p β€” Always honor the outcome of the after-sb-0pri algorithm. In case it decides the current secondary has the correct data, accept a possible instantaneous change of the primary's data. ⚑
  • -C, --after-sb-2pri asb-2p-policy β€” possible policies are:
    • disconnect β€” No automatic resynchronization, simply disconnect. βœ‚οΈ
    • call-pri-lost-after-sb β€” Always honor the outcome of the after-sb-0pri algorithm. In case it decides the current secondary has the right data, call the pri-lost-after-sb on the current primary. πŸ“ž
    • violently-as0p β€” Always honor the outcome of the after-sb-0pri algorithm. In case it decides the current secondary has the right data, accept a possible instantaneous change of the primary's data. ⚑
  • -P, --always-asbp β€” Normally the automatic after-split-brain policies are only used if current states of the UUIDs do not indicate the presence of a third node.

With this option you request that the automatic after-split-brain policies are used as long as the data sets of the nodes are somehow related. This might cause a full sync, if the UUIDs indicate the presence of a third node. (Or double faults have led to strange UUID sets.) 🧩

  • -R, --rr-conflict role-resync-conflict-policy β€” This option sets DRBD's behavior when DRBD deduces from its meta data that a resynchronization is needed, and the SyncTarget node is already primary. The possible settings are: disconnect, call-pri-lost and violently. While disconnect speaks for itself, with the call-pri-lost setting the pri-lost handler is called which is expected to either change the role of the node to secondary, or remove the node from the cluster. The default is disconnect.

With the violently setting you allow DRBD to force a primary node into SyncTarget state. This means that the data exposed by DRBD changes to the SyncSource's version of the data instantaneously. USE THIS OPTION ONLY IF YOU KNOW WHAT YOU ARE DOING. ☠️

  • -d, --data-integrity-alg hash_alg β€” DRBD can ensure the data integrity of the user's data on the network by comparing hash values. Normally this is ensured by the 16 bit checksums in the headers of TCP/IP packets. This option can be set to any of the kernel's data digest algorithms. In a typical kernel configuration you should have at least one of md5, sha1, and crc32c available. By default this is not enabled. πŸ”

See also the notes on data integrity on the drbd.conf manpage.

  • -o, --no-tcp-cork β€” DRBD usually uses the TCP socket option TCP_CORK to hint to the network stack when it can expect more data, and when it should flush out what it has in its send queue. There is at least one network stack that performs worse when one uses this hinting method. Therefore we introduced this option, which disable the setting and clearing of the TCP_CORK socket option by DRBD. 🍾
  • -p, --ping-timeout ping_timeout β€” The time the peer has to answer to a keep-alive packet. In case the peer's reply is not received within this time period, it is considered dead. The default unit is tenths of a second, the default value is 5 (for half a second). ⏳
  • -D, --discard-my-data β€” Use this option to manually recover from a split-brain situation. In case you do not have any automatic after-split-brain policies selected, the nodes refuse to connect. By passing this option you make this node a sync target immediately after successful connect. 🧹
  • -n, --dry-run β€” Causes DRBD to abort the connection process after the resync handshake, i.e. no resync gets performed. You can find out which resync DRBD would perform by looking at the kernel's log file. πŸ“
  • -g, --on-congestion congestion_policy, -f, --congestion-fill fill_threshold, -h, --congestion-extents active_extents_threshold β€” By default DRBD blocks when the available TCP send queue becomes full. That means it will slow down the application that generates the write requests that cause DRBD to send more data down that TCP connection. 🚦

When DRBD is deployed with DRBD-proxy it might lowkey be way more desirable that DRBD slides into AHEAD/BEHIND mode shortly before the send queue becomes full. In AHEAD/BEHIND mode DRBD stops replicating data, but bestie, it still keeps the connection open. πŸ’…

The glow-up of AHEAD/BEHIND mode is that your app is not slowed down, even if DRBD-proxy's buffer isn't big enough to buffer all the write requests. The downside (and yeah there is one, there's always one 😭) is that the peer node falls behind, and a resync will be necessary to bring it back into sync. And during that resync the peer node will have an inconsistent disk. πŸ™ˆ

Available congestion_policys are block and pull-ahead. The default is block. Fill_threshold might be in the range of 0 to 10GiBytes. The default is 0, which disables the check. Active_extents_threshold has the same limits as al-extents.

The AHEAD/BEHIND mode and its settings are available since DRBD 8.3.10. ✨


🌸 syncer 🌸

Changes the synchronization daemon parameters of device at runtime. Let's go. 🧚

  • -r, --rate rate β€” so your app on top of DRBD stays smooth, you can cap the bandwidth that background synchronization is allowed to eat. Default is 250 KiB/sec, and the default unit is KiB/sec.
  • -a, --after minor β€” only start resync on this device if the device with minor is already in connected state. Otherwise this device just chills in SyncPause state. 🫢
  • -e, --al-extents extents β€” DRBD does hot area detection automatically, and this is the knob that controls how big the hot area (aka the active set) can get. Each extent marks 4M of the backing storage. If a primary node leaves the cluster unexpectedly, the areas covered by the active set must be resynced when the failed node rejoins. The data structure lives in the meta-data area, so every change of the active set is a write operation to the meta-data device. More extents = longer resync times but fewer updates to the meta-data. The default number of extents is 127. (Minimum: 7, Maximum: 3843)
  • -v, --verify-alg hash-alg β€” during online verification (the one the verify sub-command kicks off), instead of doing a bit-wise comparison, DRBD runs a hash function over the contents of every block being verified and compares that hash with the peer. This option defines which hash algorithm gets used for that. It can be set to any of the kernel's data digest algorithms. In a typical kernel config you should have at least one of md5, sha1, and crc32c available. By default this is not enabled; you must set this option explicitly to be able to use on-line device verification. ⭐

See also the notes on data integrity on the drbd.conf manpage.

  • -c, --cpu-mask cpu-mask β€” sets the cpu-affinity-mask for DRBD's kernel threads of this device. The default value of cpu-mask is 0, which means DRBD's kernel threads get spread over all CPUs of the machine. This value must be given in hexadecimal notation. If it's too big it will be truncated.
  • -C, --csums-alg hash-alg β€” a resync process sends all marked data blocks from the source to the destination node, as long as no csums-alg is given. When one is specified, the resync process exchanges hash values of all marked blocks first, and only sends over those data blocks that have different hash values. πŸ¦‹

This setting is useful for DRBD setups with low bandwidth links. When a crashed primary node restarts, all blocks covered by the activity log are marked for resync β€” but a large part of those will actually still be in sync, so using csums-alg lowers the required bandwidth in exchange for CPU cycles.

  • -R, --use-rle β€” during resync-handshake, the dirty-bitmaps of the nodes are exchanged and merged (using bit-or), so the nodes end up with the same understanding of which blocks are dirty. On large devices, that fine grained dirty-bitmap can become large too, and the bitmap exchange can take quite some time on low-bandwidth links.

Because the bitmap typically contains compact areas where all bits are unset (clean) or set (dirty), a simple run-length encoding scheme can considerably reduce the network traffic necessary for the bitmap exchange.

For backward compatibilty reasons, and because on fast links this possibly does not improve transfer time but consumes cpu cycles, this defaults to off.

Introduced in 8.3.2.

  • -p, --c-plan-ahead plan_time, -s, --c-fill-target fill_target, -d, --c-delay-target delay_target, -M, --c-max-rate max_rate β€” the dynamic resync speed controller gets enabled by setting plan_time to a positive value. It aims to fill the buffers along the data path with either a constant amount of data (fill_target), or aims to have a constant delay time of delay_target along the path. The controller has an upper bound of max_rate. πŸ”₯

By plan_time the agility of the controller is configured. Higher values yield slower/lower responses of the controller to deviation from the target value. It should be at least 5 times RTT. For regular data paths a fill_target in the area of 4k to 100k is appropriate. For a setup that contains drbd-proxy it is advisable to use delay_target instead. Only when fill_target is set to 0 will the controller use delay_target. 5 times RTT is a reasonable starting value. Max_rate should be set to the bandwidth available between the DRBD-hosts and the machines hosting DRBD-proxy, or to the available disk-bandwidth.

The default value of plan_time is 0, the default unit is 0.1 seconds. Fill_target has 0 and sectors as default unit. Delay_target has 1 (100ms) and 0.1 as default unit. Max_rate has 10240 (100MiB/s) and KiB/s as default unit.

  • -m, --c-min-rate min_rate β€” we track the disk IO rate caused by the resync, so we can detect non-resync IO on the lower level device. If the lower level device seems to be busy, and the current resync rate is above min_rate, we throttle the resync. 😌

The default value of min_rate is 4M, the default unit is k. If you want to not throttle at all, set it to zero; if you want to throttle always, set it to one.

  • -n, --on-no-data-accessible ond-policy β€” this setting controls what happens to IO requests on a degraded, disk less node (I.e. no data store is reachable). The available policies are io-error and suspend-io.

If ond-policy is set to suspend-io you can either resume IO by attaching/connecting the last lost data storage, or by the drbdadm resume-io res command. The latter will result in IO errors of course. πŸ’€

The default is io-error. This setting is available since DRBD 8.3.9.


πŸ‘‘ primary πŸ‘‘

Sets the device into primary role. This means applications (e.g. a file system) may open the device for read and write access. Data written to the device in primary role is mirrored to the device in secondary role.

Normally it is not possible to set both devices of a connected DRBD device pair to primary role. By using the --allow-two-primaries option, you override this behavior and instruct DRBD to allow two primaries. Main character energy, honestly. ✨

  • -o, --overwrite-data-of-peer β€” alias for --force.
  • -f, --force β€” becoming primary fails if the local replica is not up-to-date. I.e. when it is inconsistent, outdated of consistent. By using this option you can force it into primary role anyway.
USE THIS OPTION ONLY IF YOU KNOW WHAT YOU ARE DOING. 🚨 Like, fr fr. This is not a vibe, this is a warning.

πŸ’œ secondary πŸ’œ

Brings the device into secondary role. This operation fails as long as at least one application (or file system) has opened the device.

It is possible that both devices of a connected DRBD device pair are secondary.


πŸ” verify πŸ”

This initiates on-line device verification. During on-line verification, the contents of every block on the local node are compared to those on the peer node. Device verification progress can be monitored via /proc/drbd. Any blocks whose content differs from that of the corresponding block on the peer node will be marked out-of-sync in DRBD's on-disk bitmap; they are not brought back in sync automatically. To do that, simply disconnect and reconnect the resource. πŸŽ€

If on-line verification is already in progress (and this node is "VerifyS"), this command silently "succeeds". In this case, any start-sector (see below) will be ignored, and any stop-sector (see below) will be honored. This can be used to stop a running verify, or to update/shorten/extend the coverage of the currently running verify.

This command will fail if the device is not part of a connected device pair.

See also the notes on data integrity on the drbd.conf manpage.

  • -s, --start start-sector β€” since version 8.3.2, on-line verification should resume from the last position after connection loss. It may also be started from an arbitrary position by setting this option. If you had reached some stop-sector before, and you do not specify an explicit start-sector, verify should resume from the previous stop-sector. 🌈

Default unit is sectors. You may also specify a unit explicitly. The start-sector will be rounded down to a multiple of 8 sectors (4kB).

  • -S, --stop stop-sector β€” since version 8.3.14, on-line verification can be stopped before it reaches end-of-device. This can be

Default unit is sectors. You may also specify a unit explicitly. The stop-sector may be updated by issuing an additional drbdsetup verify command on the same node while the verify is running.


πŸ¦‹ invalidate πŸ¦‹

This forces the local device of a pair of connected DRBD devices into SyncTarget state, which means that all data blocks of the device are copied over from the peer.

This command will fail if the device is not either part of a connected device pair, or disconnected Secondary.


πŸ’– invalidate-remote πŸ’–

This forces the local device of a pair of connected DRBD devices into SyncSource state, which means that all data blocks of the device are copied to the peer.

On a disconnected Primary device, this will set all bits in the out of sync bitmap. As a side affect this suspends updates to the on disk activity log. Updates to the on disk activity log resume automatically when necessary.


⏳ wait-connect ⏳

Returns as soon as the device can communicate with its partner device. That's it, that's the whole thing. Obsessed with the simplicity, ngl. 🫢

  • -t, --wfc-timeout wfc_timeout β€” how long to wait before giving up. If the device can't talk to its partner for timeout seconds, this command just fails, periodt. πŸ’€
  • -d, --degr-wfc-timeout degr_wfc_timeout β€” if the peer was already down before this node got rebooted, this is the timeout that gets used instead.
  • -o, --outdated-wfc-timeout outdated_wfc_timeout β€” if the peer was successfully outdated before this node's reboot, this one is the vibe check that counts.
  • -w, --wait-after-sb β€” the split-brain escape hatch. See below, bestie. πŸ‘‡

So here's the tea: if the peer was working fine before this node rebooted, you use wfc_timeout. If the peer was already down before the reboot, you use degr_wfc_timeout. And if the peer was successfully outdated before the reboot, you use outdated_wfc_timeout. The default for all three of those timeout values is 0, which literally means wait forever. No cap. πŸ•°οΈ

And when the connection status drops down to StandAlone because the peer showed up but the devices had a split brain situation, the default behavior for the command is to terminate. You can flip that with --wait-after-sb.


🌸 wait-sync 🌸

Returns as soon as the device leaves any synchronization and heads into connected state. The options are exactly the same as with the wait-connect command. Same menu, different craving. πŸ“

πŸ’… disconnect πŸ’…

Removes the information that the net command set on the device. Translation: the device goes into unconnected state and will no longer be listening for incoming connections. It's giving "do not perceive me." πŸ™ˆ

πŸŽ€ detach πŸŽ€

Removes the info that the disk command set on the device β€” so the device is detached from its backing storage device. Breaking up, but make it storage. πŸ’”

  • -f, --force β€” okay so a regular detach only returns after the disk state finally reached diskless. Which means detaching from a frozen backing block device never terminates. Ever. It just sits there. 😭

A forced detach, on the other hand, returns immediately. It lets you detach DRBD from a frozen backing block device. But heads up bestie: the disk will be marked as failed until all pending IO requests have been finished by the backing block device. ⚠️

πŸ¦‹ down πŸ¦‹

Removes all configuration information from the device and forces it back to unconfigured state. Full reset, main character rebirth energy. ✨

πŸ‘‘ role πŸ‘‘

Shows the current roles of the device and its peer, as local/peer.

🌈 state 🌈

Deprecated alias for "role". It's still here, but it's lowkey vintage. πŸ‘΅

⭐ cstate ⭐

Shows the current connection state of the device.

🧚 dstate 🧚

Shows the current states of the backing storage devices, as local/peer.

πŸ’œ status πŸ’œ

Shows the current status of the device in XML-like format. Example output:

<resource minor="0" name="s0" cs="SyncTarget" st1="Secondary" st2="Secondary"
         ds1="Inconsistent" ds2="UpToDate" resynced_precent="5.9" />

(yes, resynced_precent β€” that's literally how it's spelled in the output, iykyk πŸ™ˆ)

πŸ”₯ resize πŸ”₯

This causes DRBD to reexamine the size of the device's backing storage device. To actually do online growing you need to extend the backing storages on both devices and call the resize command on one of your nodes. Teamwork makes the dream work. 🫢

The --assume-peer-has-space lets you resize a device that is currently not connected to the peer. Use with care, since if you don't resize the peer's disk as well, further connect attempts of the two will fail. ⚠️

When the --assume-clean option is given, DRBD will skip the resync of the new storage. Only do this if you know that the new storage was initialized to the same content by other means. No guessing, bestie. πŸ™…

πŸ’– check-resize πŸ’–

To enable DRBD to detect offline resizing of backing devices, this command may be used to record the current size of backing devices. The size is stored in files in /var/lib/drbd/ named drbd-minor-??.lkbd

This command is called by drbdadm resize res after drbdsetup device resize returned.

🌸 pause-sync 🌸

Temporarily suspends an ongoing resynchronization by setting the local pause flag. Resync only progresses if neither the local nor the remote pause flag is set. It might be desirable to postpone DRBD's resynchronization after eventual resynchronization of the backing storage's RAID setup. Chill for a sec, it'll get there. βœ‹

✨ resume-sync ✨

Unsets the local sync pause flag. Back to work, babe. πŸ’ͺ

πŸŽ€ outdate πŸŽ€

Marks the data on the local backing storage as outdated. An outdated device refuses to become primary. This is used in conjunction with fencing and by the peer's fence-peer handler.

πŸ¦‹ show-gi πŸ¦‹

Displays the device's data generation identifiers, verbosely. Spill everything. πŸ—£οΈ

🌈 get-gi 🌈

Displays the device's data generation identifiers. (Quiet version, keep it cute.)

⭐ show ⭐

Shows all available configuration information of the device.

πŸ’œ suspend-io πŸ’œ

This command is of no apparent use and is just provided for the sake of completeness. Not me including a whole command just to be thorough πŸ’… (the manpage says so, not me)

🧚 resume-io 🧚

If the fence-peer handler fails to stonith the peer node, and your fencing policy is set to resource-and-stonith, you can unfreeze IO operations with this command. Un-pause the chaos. πŸ”“

πŸ”₯ events πŸ”₯

Displays every state change of DRBD and all calls to helper programs. This might be used to get notified of DRBD's state changes by piping the output to another program. Live feed, no filter. πŸ“‘

  • -a, --all-devices β€” display the events of all DRBD minors.
  • -u, --unfiltered β€” a debugging aid that displays the content of all received netlink messages. Raw. Uncut. 🫣

πŸ‘‘ new-current-uuid πŸ‘‘

Generates a new current UUID and rotates all other UUID values. This has at least two use cases, namely to skip the initial sync, and to reduce network bandwidth when starting in a single node configuration and then later (re-)integrating a remote site. Glow-up for your UUIDs. ✨

Available option:

  • -c, --clear-bitmap β€” clears the sync bitmap in addition to generating a new current UUID.

This can be used to skip the initial sync, if you want to start from scratch. This use-case does only work on "Just Created" meta data. Necessary steps:

  1. On both nodes, initialize meta data and configure the device.
drbdadm -- --force create-md res
  1. They need to do the initial handshake, so they know their sizes.
drbdadm up res
  1. They are now Connected Secondary/Secondary Inconsistent/Inconsistent. Generate a new current-uuid and clear the dirty bitmap.
drbdadm -- --clear-bitmap new-current-uuid res
  1. They are now Connected Secondary/Secondary UpToDate/UpToDate. Make one side primary and create a file system.
drbdadm primary res
mkfs -t fs-type $(drbdadm sh-dev res)

One obvious side-effect is that the replica is full of old garbage (unless you made them identical using other means), so any online-verify is expected to find any number of out-of-sync blocks. πŸ—‘οΈ

You must not use this on pre-existing data! Even though it may appear to work at first glance, once you switch to the other node, your data is toast, as it never got replicated. So do not leave out the mkfs (or equivalent). πŸ”₯🍞

This can also be used to shorten the initial resync of a cluster where the second node is added after the first node has gone into production, by means of disk shipping. This use-case works on disconnected devices only, and the device may be in primary or secondary role.

The necessary steps on the current active server are:

  1. ``` drbdsetup device new-current-uuid --clear-bitmap

2. Take the copy of the current active server. E.g. by pulling a disk out of the RAID1 controller, or by copying with `dd`. You need to copy the actual data, *and* the meta data.

3. ```
drbdsetup device new-current-uuid

Now add the disk to the new secondary node, and join it to the cluster. You will get a resync of the parts that were changed since the first call to drbdsetup in step 1. Slay. πŸ’…


✨ EXAMPLES ✨

For examples, please have a look at the DRBD User's Guide[1]. (That's http://www.drbd.org/users-guide/ if you need the link, bestie πŸ’–)

🌸 VERSION 🌸

This document was revised for version 8.3.2 of the DRBD distribution.

πŸŽ€ AUTHOR πŸŽ€

Written by Philipp Reisner <philipp.reisner@linbit.com> and Lars Ellenberg <lars.ellenberg@linbit.com>

πŸ¦‹ REPORTING BUGS πŸ¦‹

Report bugs to <drbd-user@lists.linbit.com>. They wanna hear it, fr fr. πŸ“¬

Copyright 2001-2008 LINBIT Information Technologies, Philipp Reisner, Lars Ellenberg. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. (Read that last bit in all caps, it's serious 😀)

⭐ SEE ALSO ⭐

drbd.conf(5), drbd(8), drbddisk(8), drbdadm(8), DRBD User's Guide[1], DRBD web site[2]

🌈 NOTES 🌈

  1. DRBD User's Guide http://www.drbd.org/users-guide/
  2. DRBD web site http://www.drbd.org/

and that's the whole page, bestie 🫢 this one's DRBD 8.3.2, dated 5 Dec 2008, and it lives at DRBDSETUP(8) β€” go forth and slay your storage cluster πŸ‘‘βœ¨