DRBDSETUP(8)
NAME π
drbdsetup β Setup tool for DRBD. And yeah bestie, this is the System Administration manual, section 8 (DRBDSETUP(8)), so you know it's the real deal, no cap π
SYNOPSIS β¨
drbdsetup new-resource resource [--cpu-mask {val}]
[--on-no-data-accessible {io-error | suspend-io}]
drbdsetup new-minor resource minor volume
drbdsetup del-resource resource
drbdsetup del-minor minor
drbdsetup attach minor lower_dev meta_data_dev meta_data_index
[--size {val}] [--max-bio-bvecs {val}]
[--on-io-error {pass_on | call-local-io-error | detach}]
[--fencing {dont-care | resource-only | resource-and-stonith}]
[--disk-barrier] [--disk-flushes] [--disk-drain]
[--md-flushes] [--resync-rate {val}] [--resync-after {val}]
[--al-extents {val}] [--al-updates]
[--discard-zeroes-if-aligned] [--disable-write-same]
[--c-plan-ahead {val}] [--c-delay-target {val}]
[--c-fill-target {val}] [--c-max-rate {val}]
[--c-min-rate {val}] [--disk-timeout {val}]
[--read-balancing {prefer-local | prefer-remote | round-robin | least-pending | when-congested-remote | 32K-striping | 64K-striping | 128K-striping | 256K-striping | 512K-striping | 1M-striping}]
[--rs-discard-granularity {val}]
drbdsetup connect resource local_addr remote_addr [--tentative]
[--discard-my-data] [--protocol {A | B | C}] [--timeout {val}]
[--max-epoch-size {val}] [--max-buffers {val}]
[--unplug-watermark {val}] [--connect-int {val}]
[--ping-int {val}] [--sndbuf-size {val}] [--rcvbuf-size {val}]
[--ko-count {val}] [--allow-two-primaries]
[--cram-hmac-alg {val}] [--shared-secret {val}]
[--after-sb-0pri {disconnect | discard-younger-primary | discard-older-primary | discard-zero-changes | discard-least-changes | discard-local | discard-remote}]
[--after-sb-1pri {disconnect | consensus | discard-secondary | call-pri-lost-after-sb | violently-as0p}]
[--after-sb-2pri {disconnect | call-pri-lost-after-sb | violently-as0p}]
[--always-asbp]
[--rr-conflict {disconnect | call-pri-lost | violently}]
[--ping-timeout {val}] [--data-integrity-alg {val}]
[--tcp-cork]
[--on-congestion {block | pull-ahead | disconnect}]
[--congestion-fill {val}] [--congestion-extents {val}]
[--csums-alg {val}] [--csums-after-crash-only]
[--verify-alg {val}] [--use-rle]
[--socket-check-timeout {val}]
drbdsetup disk-options minor
[--on-io-error {pass_on | call-local-io-error | detach}]
[--fencing {dont-care | resource-only | resource-and-stonith}]
[--disk-barrier] [--disk-flushes] [--disk-drain]
[--md-flushes] [--resync-rate {val}] [--resync-after {val}]
[--al-extents {val}] [--al-updates]
[--discard-zeroes-if-aligned] [--disable-write-same]
[--c-plan-ahead {val}] [--c-delay-target {val}]
[--c-fill-target {val}] [--c-max-rate {val}]
[--c-min-rate {val}] [--disk-timeout {val}]
[--read-balancing {prefer-local | prefer-remote | round-robin | least-pending | when-congested-remote | 32K-striping | 64K-striping | 128K-striping | 256K-striping | 512K-striping | 1M-striping}]
[--rs-discard-granularity {val}]
drbdsetup net-options local_addr remote_addr [--protocol {A | B | C}]
[--timeout {val}] [--max-epoch-size {val}]
[--max-buffers {val}] [--unplug-watermark {val}]
[--connect-int {val}] [--ping-int {val}] [--sndbuf-size {val}]
[--rcvbuf-size {val}] [--ko-count {val}]
[--allow-two-primaries] [--cram-hmac-alg {val}]
[--shared-secret {val}]
[--after-sb-0pri {disconnect | discard-younger-primary | discard-older-primary | discard-zero-changes | discard-least-changes | discard-local | discard-remote}]
[--after-sb-1pri {disconnect | consensus | discard-secondary | call-pri-lost-after-sb | violently-as0p}]
[--after-sb-2pri {disconnect | call-pri-lost-after-sb | violently-as0p}]
[--always-asbp]
[--rr-conflict {disconnect | call-pri-lost | violently}]
[--ping-timeout {val}] [--data-integrity-alg {val}]
[--tcp-cork]
[--on-congestion {block | pull-ahead | disconnect}]
[--congestion-fill {val}] [--congestion-extents {val}]
[--csums-alg {val}] [--csums-after-crash-only]
[--verify-alg {val}] [--use-rle]
[--socket-check-timeout {val}]
drbdsetup resource-options resource [--cpu-mask {val}]
[--on-no-data-accessible {io-error | suspend-io}]
drbdsetup disconnect local_addr remote_addr [--force]
drbdsetup detach minor [--force]
drbdsetup primary minor [--force]
drbdsetup secondary minor
drbdsetup down resource
drbdsetup verify minor [--start {val}] [--stop {val}]
drbdsetup invalidate minor
drbdsetup invalidate-remote minor
drbdsetup wait-connect minor [--wfc-timeout {val}]
[--degr-wfc-timeout {val}] [--outdated-wfc-timeout {val}]
[--wait-after-sb {val}]
drbdsetup wait-sync minor [--wfc-timeout {val}]
[--degr-wfc-timeout {val}] [--outdated-wfc-timeout {val}]
[--wait-after-sb {val}]
drbdsetup role minor
drbdsetup cstate minor
drbdsetup dstate minor
drbdsetup resize minor [--size {val}] [--assume-peer-has-space]
[--assume-clean] [--al-stripes {val}]
[--al-stripe-size-kB {val}]
drbdsetup check-resize minor
drbdsetup pause-sync minor
drbdsetup resume-sync minor
drbdsetup outdate minor
drbdsetup show-gi minor
drbdsetup get-gi minor
drbdsetup show {resource | minor | all}
drbdsetup suspend-io minor
drbdsetup resume-io minor
drbdsetup status {resource | all} [--color {val}]
drbdsetup events2 {resource | all}
drbdsetup events {resource | minor | all}
drbdsetup new-current-uuid minor [--clear-bitmap]
DESCRIPTION πΈ
Okay so drbdsetup is the tool that associates DRBD devices with their backing block devices, sets up DRBD device pairs so they mirror their backing block devices, and lets you peek at the configuration of DRBD devices that are already running. That's the whole vibe. Three jobs, all iconic π«Ά
NOTE π
Real talk: drbdsetup is a low level tool of the DRBD program suite. It's the data disk and drbd scripts that use it to talk to the device driver. So it's not the cute friendly one β that's drbdadm's whole thing. You've been warned, bestie π
COMMANDS π
Each drbdsetup sub-command might need its own arguments, and it brings its own little set of options, because of course it does π
Also important: all values have default units, and you can override them with K, M or G. These units work the normal way (like K = 2^10 = 1024). So when you're typing numbers, know what unit you're in, periodt.
Common options β¨
All drbdsetup sub-commands accept these two options:
--create-deviceβ If the DRBD device you named (that's the minor number) doesn't exist yet, go ahead and create it implicitly. Surprise, it's there now π
new-resource π¦
Resources are the primary objects of any DRBD configuration, the main characters fr. You must create a resource with the new-resource command before you can create any volumes or minor devices on top of it. And connections? Those get referenced by name.
new-minor π
A minor is basically a synonym for a replicated block device. It shows up in the /dev/ directory as a block device, and it's the application's interface to the DRBD-replicated block devices. On the drbdsetup commandline, these block devices get addressed by their minor numbers.
Here's the tea though: a pair of replicated block devices may have different minor numbers on the two machines. They're associated by a common volume-number instead. Volume numbers are local to each connection, and minor numbers are global on one node. Don't mix those up, iykyk π
del-resource π
Destroys a resource object. And it's only possible if the resource has no volumes β so empty it out first, bestie. It's giving "you can't delete the folder while files are in it".
del-minor π
Minors can only be destroyed if their disk is detached. That's the rule, no exceptions.
attach, disk-options π
attach associates a device with lower_device so it stores its data blocks there.
Now, the -d (or --disk-size) should only be used if you wish not to use as much as possible from the backing block devices. And if you don't use -d, the device is only ready for use as soon as it was connected to its peer once. (Check the net command for that part.)
With the disk-options command you can change the options of a minor while it is attached β live edits, we love to see it β¨
--disk-sizesize β 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 issectors(1s=512 bytes).
If you use thesizeparameter indrbd.conf, we strongly recommend adding an explicit unit postfix.drbdadmanddrbdsetupused to have mismatching default units β messy, and not in a cute way π
--on-io-errorerr_handler β If the driver of thelower_devicereports 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 validerr_handlers are:pass_on,call-local-io-erroranddetach.--fencingfencing_policy β Under fencing we understand preventive measures to avoid situations where both nodes are primary and disconnected (AKA split brain). Yeah, that's the scary one. 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 thefence-peerhandler. The handler is supposed to reach the other node over alternative communication paths and calldrbdadm outdate resthere.resource-and-stonithβ If a node becomes a disconnected primary, it freezes all its IO operations and calls itsfence-peerhandler. Thefence-peerhandler is supposed to reach the peer over alternative communication paths and calldrbdadm outdate resthere. 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 theresume-iocommand. π«Ά
--disk-barrier,--disk-flushes,--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 default theflushmethod is used.
Sincedrbd-8.4.2disk-barrieris disabled by default, because sincelinux-2.6.36(or2.6.32 RHEL6) there is no reliable way to determine if queuing of IO-barriers works. Dangerous β only enable if you are told so by one that knows for sure. π Not the vibe to guess on this one, bestie.
Okay so before you just pick a drain method based on vibes and pretty benchmark numbers, bestie, listen β it is not just about the measurable performance. π
If your backing storage device has a volatile write cache (plain disks, a RAID of plain disks, that whole situation), you want one of the first two methods, no debate. If your backing storage device has a battery-backed write cache, then you may go with option 3, slay. But option 4 β disabling everything and using "none" β is dangerous on most IO stacks. It may result in write-reordering, and if it does, it can theoretically be the reason for data corruption, or it can disturb the DRBD protocol and cause spurious disconnect/reconnect cycles. Do not use no-disk-drain. Like, ever. π
And lowkey unfortunate: device mapper (LVM) might not support barriers. π
The letter after "wo:" in /proc/drbd tells you which method is currently in use for a device β it'll be one of b, f, d, n. Here's the tea on each implementation: π
π‘οΈ barrier
The first one requires that the driver of the backing storage device actually support barriers (in SCSI speak that's called 'tagged command queuing', and in SATA speak it's 'native command queuing'). You turn this method on by setting the disk-barrier options to yes. β¨
π§ flush
The second one requires that the backing device support disk flushes (the drive vendors call this 'force unit access'). You can turn this method off by setting disk-flushes to no. πΏ
π drain
The third method is simply to let write requests drain before write requests of a new reordering domain are issued. Honestly iconic behavior β this 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. I am begging. π
--md-flushesβ Disables the use of disk flushes and barrier BIOs when accessing the meta data device. Check the notes on--disk-flushes, bestie, same energy. β¨--max-bio-bvecsβ In some special circumstances the device mapper stack manages to pass BIOs to DRBD that violate the constraints set forth by DRBD'smerge_bvec()function, and which have more than one bvec. π€ A known example is:phys-disk -> DRBD -> LVM -> Xen -> misaligned partition (63) -> DomU FS. When that happens you might see"bio would need to, but cannot, be split:"in the Dom0's kernel log. Not cute.
The best workaround is to properly align the partition within the VM (e.g. start it at sector 1024). That costs 480 KiB of storage, which is nothing. Unfortunately the default of most Linux partitioning tools is to start the first partition at an odd number (63), so most distributions' install helpers for virtual linux machines will end up with misaligned 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 there is no user imposed limitation. π
--resync-raterate β To keep the application on top of DRBD running smoothly, it's possible to limit the bandwidth that may be used by background synchronization. The default is250KiB/sec, and the default unit isKiB/sec. π¦--resync-afterminor β Start resync on this device only if the device with minor is already in connected state. Otherwise this device just sits there waiting inSyncPausestate. Patient queen. π--al-extentsextents β DRBD automatically performs hot area detection. With this parameter you control how big the hot area (the active set) can get. Each extent marks4Mof the backing storage. In case a primary node leaves the cluster unexpectedly, the areas covered by the active set must be resynced upon rejoining of the failed node. The data structure is stored in the meta-data area, therefore each change of the active set is a write operation to the meta-data device. A higher number of extents gives longer resync times but fewer updates to the meta-data. The default number of extents is1237. (Minimum:7, Maximum:65534.) π₯
See also drbd.conf(5) and drbdmeta(8) for additional limitations and necessary preparation. iykyk. π
--al-updates{yes|no} β DRBD's activity log transaction writing makes it possible that, after the crash of a primary node, a partial (bit-map based) resync is sufficient to bring the node back to up-to-date. Setting al-updates tonomight increase normal operation performance, but it causes DRBD to do a full resync when a crashed primary gets reconnected. The default value isyes. π--c-plan-aheadplan_time,--c-fill-targetfill_target,--c-delay-targetdelay_target,--c-max-ratemax_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. β¨
--c-min-ratemin_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.
-t,--disk-timeoutdisk_timeout β If the lower-level device on which a DRBD device stores its data does not finish an I/O request within the defined disk-timeout, DRBD treats this as a failure. The lower-level device is detached, and the device's disk state advances toDiskless. If DRBD is connected to one or more peers, the failed request is passed on to one of them.
This option is dangerous and may lead to kernel panic! π±
"Aborting" requests, or force-detaching the disk, is intended for completely blocked/hung local backing devices which no longer complete requests at all, not even error completions. In this situation, usually a hard-reset and failover is the only way out. π
By "aborting", basically faking a local error-completion, we allow for a more graceful swichover by cleanly migrating services. Still, the affected node has to be rebooted "soon". π
By completing these requests, we allow the upper layers to re-use the associated data pages.
If later the local backing device "recovers", and now DMAs some data from disk into the original request pages, in the best case it will just put random data into unused pages; but typically it will corrupt meanwhile completely unrelated data, causing all sorts of damage.
Which means delayed successful completion, especially for READ requests, is a reason to panic(). We assume that a delayed error completion is OK, though we still will complain noisily about it. π€
The default value of disk-timeout is 0, which stands for an infinite timeout. Timeouts are specified in units of 0.1 seconds. This option is available since DRBD 8.3.12. π
--discard-zeroes-if-aligned{yes|no} β Setting discard-zeroes-if-aligned tonowill cause DRBD to always fall-back to zero-out on the receiving side, and to not even announce discard capabilities on the Primary, if the respective backend announcesdiscard_zeroes_data=false.
Setting discards-zeroes-if-aligned to yes will allow DRBD to use discards, and to announce discard_zeroes=true, even on backends that announce discard_zeroes_data=false. β¨
We used to ignore the discard_zeroes_data setting completely. To not break established and expected behaviour, the default value is yes. π«Ά
This option is available since 8.4.7. See also drbd.conf(5). π
--disable-write-same{yes|no} β Some disks announceWRITE_SAMEsupport to the kernel but fail with an I/O error upon actually receiving such a request. π This mostly happens when using virtualized disks β notably, this behavior has been observed with VMware's virtual disks.
When disable-write-same is set to yes, WRITE_SAME detection is manually overriden and support is disabled. π
The default value of disable-write-same is no. This option is available since 8.4.7. πΈ
--read-balancingmethod β The supported methods for load balancing of read requests areprefer-local,prefer-remote,round-robin,least-pendingandwhen-congested-remote,32K-striping,64K-striping,128K-striping,256K-striping,512K-stripingand1M-striping. π₯
The default value of read-balancing is prefer-local. This option is available since 8.4.1. π
--rs-discard-granularitybytes β When rs-discard-granularity is set to a non zero, positive value then DRBD tries to do a resync operation in requests of this size. In case such a block contains only zero bytes on the sync source node, the sync target node will issue adiscard/trim/unmapcommand for the area. π§Ή
The value is constrained by the discard granularity of the backing block device. In case rs-discard-granularity is not a multiplier of the discard granularity of the backing block device, DRBD rounds it up. The feature only gets active if the backing block device reads back zeroes after a discard command. β¨
The default value of rs-discard-granularity is 0. This option is available since 8.4.7. π
connect, net-options π«
Okay so connect 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). π¦
The net-options command lets you change options while the connection is established. Main character energy, fr.
--protocol protocolβ on the TCP/IP link, the specified protocol is used. Valid protocol specifiers areA,B, andC.- 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.
--connect-int timeβ if it's not possible to connect to the remote DRBD device immediately, DRBD keeps on trying to connect. With this option you set the time between two retries. The default value is10. The unit is seconds. β°--ping-int timeβ if the TCP/IP connection linking a DRBD device pair is idle for more thantimeseconds, DRBD will generate a keep-alive packet to check if its partner is still alive. The default value is10. The unit is seconds. π--timeout valβ if the partner node fails to send an expected response packet withinvaltenths of a second, the partner node is considered dead and therefore the TCP/IP connection is abandoned. The default value is60(= 6 seconds). π--sndbuf-size sizeβ the socket send buffer stores packets sent to the secondary node that 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 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. Since8.0.13resp.8.2.7, setting thesizevalue to0means the kernel should autotune this. The default size is0, i.e. autotune. π«--rcvbuf-size sizeβ packets received from the network are stored in the socket receive buffer first. From there they are consumed by DRBD. Before8.3.2the receive buffer's size was always set to the size of the socket send buffer. Since8.3.2they can be tuned independently. A value of0means the kernel should autotune this. The default size is0, i.e. autotune. πΈ--ko-count countβ if the secondary node fails to complete a single write request forcounttimes 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 to0; defaults may change between versions. π«--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 than10can lead to degraded performance. The default value is2048. π--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 is2048, the minimum32. 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).
--unplug-watermark valβ this setting has no effect with recent kernels that use explicit on-stack plugging (upstream Linux kernel2.6.39, distributions may have backported). When the number of pending write requests on the standby (secondary) node exceeds theunplug-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 asmax-buffers, yet others don't feel much effect at all. Minimum16, default128, maximum131072. π--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:OCFS2andGFS. If you use this option with any other file system, you are going to crash your nodes and to corrupt your data! π±--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. π--shared-secret secretβ the shared secret used in peer authentication. May be up to64characters. π€«--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.
--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 theafter-sb-0prialgorithm 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 theafter-sb-0prialgorithm. In case it decides the current secondary has the correct data, call thepri-lost-after-sbon the current primary.violently-as0pβ always honor the outcome of theafter-sb-0prialgorithm. In case it decides the current secondary has the correct data, accept a possible instantaneous change of the primary's data.
--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 theafter-sb-0prialgorithm. In case it decides the current secondary has the right data, call thepri-lost-after-sbon the current primary.violently-as0pβ always honor the outcome of theafter-sb-0prialgorithm. In case it decides the current secondary has the right data, accept a possible instantaneous change of the primary's data.
--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.) π§--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-lostandviolently. Whiledisconnectspeaks for itself, with thecall-pri-lostsetting thepri-losthandler is called which is expected to either change the role of the node to secondary, or remove the node from the cluster. The default isdisconnect. With theviolentlysetting 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. β οΈ--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 ofmd5,sha1, andcrc32cavailable. By default this is not enabled. See also the notes on data integrity on thedrbd.confmanpage. π‘οΈ--no-tcp-corkβ DRBD usually uses the TCP socket optionTCP_CORKto 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 theTCP_CORKsocket option by DRBD. πΎ--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 is5(for half a second). β³--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. ποΈ--tentativeβ 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. π§ͺ--on-congestioncongestion_policy,--congestion-fillfill_threshold,--congestion-extentsactive_extents_threshold β okay so by default DRBD just blocks the second the available TCP send queue goes full π. Which means it's gonna slow down the app that's generating the write requests making DRBD push more data down that TCP connection. Rude, but that's the default.
When DRBD is deployed with DRBD-proxy it might be way more desirable for DRBD to slip into AHEAD/BEHIND mode right before the send queue fills up. In AHEAD/BEHIND mode DRBD stops replicating data but keeps the connection open. Bestie it's giving "we're still talking, just not sharing" π
The glow-up of AHEAD/BEHIND mode: the application does not get slowed down, even if DRBD-proxy's buffer isn't big enough to buffer all the write requests. The downside? π The peer node falls behind, and a resync becomes necessary to bring it back into sync. And during that resync the peer node has an inconsistent disk. So like, tradeoffs, yk?
The available congestion_policys are block and pull-ahead. Default is block. Fill_threshold can be anywhere in the range of 0 to 10GiBytes. Default is 0, which disables the check entirely. Active_extents_threshold has the same limits as al-extents.
The AHEAD/BEHIND mode and its settings have been available since DRBD 8.3.10.
--verify-alghash-alg β during online verification (the one you kick off with theverifysub-command), 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 is literally just "which hash algorithm are we using, bestie". It can be set to any of the kernel's data digest algorithms. In a typical kernel config you should have at least one ofmd5,sha1, andcrc32cready to go. 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.
--csums-alghash-alg β so a resync process sends all the marked data blocks from the source to the destination node, for as long as no csums-alg is given. Once one is specified, the resync process swaps hash values of all the marked blocks first, and only sends over those data blocks that have different hash values. Efficient queen behavior π
This setting is super useful for DRBD setups with low bandwidth links. When a crashed primary node restarts, all blocks covered by the activity log get marked for resync. But a big chunk of those are actually still in sync, so using csums-alg lowers the required bandwidth in exchange for CPU cycles. No cap.
--use-rleβ during resync-handshake, the dirty-bitmaps of the nodes get exchanged and merged (using bit-or), so both nodes end up with the same understanding of which blocks are dirty. On large devices, that fine grained dirty-bitmap can get big, and the bitmap exchange can take quite some time on low-bandwidth links. Not the vibe.
But 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. Slay.
For backward compatibility 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.
--socket-check-timeoutβ in setups involving a DRBD-proxy and connections that experience a lot of buffer-bloat, it might be necessary to setping-timeoutto an unusual high value. By default DRBD uses the same value to wait and check if a newly established TCP-connection is stable. Since the DRBD-proxy is usually located in the same data center, such a long wait time may hinder DRBD's connect process π¬.
In such setups socket-check-timeout should be set to at least the round trip time between DRBD and DRBD-proxy. I.e. in most cases to 1.
The default unit is tenths of a second, the default value is 0 (which causes DRBD to use the value of ping-timeout instead). Introduced in 8.4.5.
π«Ά resource-options
Changes the options of the resource at runtime. Live tweaking, we love to see it β¨
--cpu-maskcpu-mask β sets the cpu-affinity-mask for DRBD's kernel threads of this device. The default value of cpu-mask is0, which means DRBD's kernel threads should be spread over all CPUs of the machine. This value must be given in hexadecimal notation. If it's too big it will be truncated. Simple as that π--on-no-data-accessibleond-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 areio-errorandsuspend-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 that applications (e.g. a file system) may open the device for read and write access. Data written to the device in primary role are mirrored to the device in secondary role. Main character energy fr fr π
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.
--overwrite-data-of-peerβ alias for--force.--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, actually. Bestie. Please.
π¦ 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. Chill, peaceful, no drama π
π 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. Noted π
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. Sneaky but useful π
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.
--startstart-sector β since version8.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,--stopstop-sector β since version8.3.14, on-line verification can be stopped before it reaches end-of-device.
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. This can be used to stop a running verify, or to update/shorten/extend the coverage of the currently running verify. You're literally in control π
π 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. Fresh start, clean slate, iconic.
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 effect this suspends updates to the on disk activity log. Updates to the on disk activity log resume automatically when necessary. She's autonomous π
β³ wait-connect
Returns as soon as the device can communicate with its partner device. The "are we there yet" of commands π«Ά
--wfc-timeoutwfc_timeout,--degr-wfc-timeoutdegr_wfc_timeout,--outdated-wfc-timeoutoutdated_wfc_timeout,--wait-after-sbβ this command will fail if the device cannot communicate with its partner for timeout seconds. If the peer was working before this node was rebooted, the wfc_timeout is used. If the peer was already down before this node was rebooted, the degr_wfc_timeout is used. If the peer was successfully outdated before this node was rebooted the outdated_wfc_timeout is used. The default value for all those timeout values is0, which means to wait forever. The unit is seconds. In case the connection status goes down toStandAlonebecause the peer appeared but the devices had a split brain situation, the default for the command is to terminate. You can change this behavior with the--wait-after-sboption.
π wait-sync
Returns as soon as the device leaves any synchronization into connected state. The options are the same as with the wait-connect command.
π disconnect
Removes the information set by the net command from the device. This means that the device goes into unconnected state and will no longer listen for incoming connections. It's giving "we're not taking calls right now" π΅
π§ detach
Removes the information set by the disk command from the device. This means that the device is detached from its backing storage device.
-f,--forceβ a regular detach returns after the disk state finally reacheddiskless. As a consequence detaching from a frozen backing block device never terminates π.
On the other hand a forced detach returns immediately. It allows you to detach DRBD from a frozen backing block device. Please note that the disk will be marked as failed until all pending IO requests where finished by the backing block device.
π down
Removes all configuration information from the device and forces it back to unconfigured state. Factory reset energy, we love a clean slate π
role π
Shows the current roles of the device and its peer, as local/peer.
state π
Deprecated alias for role.
cstate π
Shows the current connection state of the device.
dstate πΎ
Shows the current states of the backing storage devices, as local/peer.
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.
--sizeβ can be used to online shrink the usable size of a drbd device. It's the user's responsibility to make sure that a file system on the device is not truncated by that operation. π¬--assume-peer-has-spaceβ allows you to resize a device which is currently not connected to the peer. Use with care, since if you do not resize the peer's disk as well, further connect attempts of the two will fail. π¨--assume-cleanβ when 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. π§Ό--al-stripes,--al-stripe-size-kBβ may be used to change the layout of the activity log online. In case of internal meta data this may involve shrinking the user visible size at the same time (using--size) or increasing the available space on the backing devices. π
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 suspend 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.
resume-sync βΆοΈ
Unset the local sync pause flag.
outdate π«
Mark 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.
get-gi π
Displays the device's data generation identifiers.
show π
Shows all available configuration information of a resource, or of all resources. Available options:
--show-defaultsβ show all configuration parameters, even the ones with default values. Normally, parameters with default values are not shown. ποΈ
suspend-io π
This command is of no apparent use and just provided for the sake of completeness.
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.
status π
Show the status of a resource, or of all resources. The output consists of one paragraph for each configured resource. Each paragraph contains one line for each resource, followed by one line for each device, and one line for each connection. The device and connection lines are indented. The connection lines are followed by one line for each peer device; these lines are indented against the connection line.
Long lines are wrapped around at terminal width, and indented to indicate how the lines belongs together. Available options:
--verboseβ include more information in the output even when it is likely redundant or irrelevant. π£οΈ--statisticsβ include data transfer statistics in the output. π--color={always | auto | never}β colorize the output. With--color=auto,drbdsetupemits color codes only when standard output is connected to a terminal. π
For example, the non-verbose output for a resource with only one connection and only one volume could look like this:
fs-backoffice role:Primary
disk:UpToDate
peer role:Secondary
replication:Established peer-disk:UpToDate
With the --verbose --statistics options, the same resource could be reported as:
fs-data role:Primary suspended:no
write-ordering:drain
volume:0 minor:1 disk:UpToDate
size:10616472 read:134465 written:144800 al-writes:18 bm-writes:0
upper-pending:0 lower-pending:0 al-suspended:no blocked:no
peer connection:Connected role:Secondary congested:no
volume:0 replication:Established peer-disk:UpToDate resync-suspended:no
received:122596 sent:22204 out-of-sync:0 pending:0 unacked:0
events2 π
Show the current state of all configured DRBD objects, followed by all changes to the state.
The output format is meant to be human as well as machine readable. Each line starts with the event number, which is followed by an asterisk if the event continues in the next line. The second word in each line indicates the kind of event: exists for an existing object; create, destroy, and change if an object is created, destroyed, or changed; or call or response if an event handler is called or it returns. The third word indicates the object the event applies to: resource, device, connection, peer-device, helper, or a dash (-) to indicate that the current state has been dumped completely.
The remaining words identify the object and describe the state that the object is in. Available options:
--nowβ terminate after reporting the current state. The default is to continuously listen and report state changes. β±οΈ--statisticsβ include statistics in the output. π
events π«
Deprecated. If possible, change to the events2 subcommand instead.
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. π
--all-devicesβ display the events of all DRBD minors. π§©--unfilteredβ this is a debugging aid that displays the content of all received netlink messages. π
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.
Available option:
--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:
- On both nodes, initialize meta data and configure the device.
drbdadm -- --force create-md res
- They need to do the initial handshake, so they know their sizes.
drbdadm up res
- They are now
Connected Secondary/Secondary Inconsistent/Inconsistent. Generate a new current-uuid and clear the dirty bitmap.
drbdadm new-current-uuid --clear-bitmap res
- 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 is gone into production, by means of disk shipping. This use-case works on disconnected devices only, the device may be in primary or secondary role. π
The necessary steps on the current active server are:
- ``` drbdsetup new-current-uuid --clear-bitmap minor
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 new-current-uuid minor
Now add the disk to the new secondary node, and join it to the cluster. You will get a resync of that parts that were changed since the first call to drbdsetup in step 1. π
β¨ EXAMPLES β¨
For examples, please have a look at the DRBD User's Guide[1]. π
π 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>. π¬
π COPYRIGHT π
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. βοΈ
π SEE ALSO π
drbd.conf(5), drbd(8), drbdadm(8), DRBD User's Guide[1], DRBD web site[2] π
π NOTES π
DRBD User's Guidehttp://www.drbd.org/users-guide/DRBD web sitehttp://www.drbd.org/
That's the whole vibe, bestie! This page is from DRBD 8.4.0, dated 6 May 2011, and it's the DRBDSETUP(8) manual. Now go slay those configs! π β¨
π¦ where this page comes from
- alpine 3.23: drbd-utils-doc 9.33.0-r0 Β· GPL-2.0-or-later
- alpine 3.24: drbd-utils-doc 9.34.0-r0 Β· GPL-2.0-or-later
- fedora 43: drbd-utils 9.32.0-1.fc43 Β· GPL-2.0-or-later
- fedora 43: drbd-utils 9.34.0-2.fc43 Β· GPL-2.0-or-later
- fedora 44: drbd-utils 9.34.0-1.fc44 Β· GPL-2.0-or-later
- fedora 44: drbd-utils 9.34.0-2.fc44 Β· GPL-2.0-or-later
- nixos 26.05: drbd 9.33.0
- nixpkgs unstable: drbd 9.34.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms