DRBD.CONF(5)
π DRBD.CONF π β the drbd.conf(5) situation, bestie edition
okay so you opened the Configuration Files section of the manual, and this is literally the whole vibe of drbd.conf. buckle up, we're doing this together π«Ά
β¨ NAME β¨
drbd.conf β the configuration file for DRBD's devices. that's it, that's the name, iconic.
πΈ INTRODUCTION πΈ
so the file /etc/drbd.conf gets read by drbdadm. that's the whole relationship. π
the file format was designed so you can have a verbatim copy of the file on both nodes of the cluster. and honestly? highly recommended, bestie, because that's how you keep your configuration manageable. /etc/drbd.conf should be the same on both nodes of the cluster. and listen β changes to /etc/drbd.conf do not apply immediately. no cap. you gotta reload. π
in this example (the one from the page, not me making stuff up), there's a single DRBD resource β it's called r0 β and it uses protocol C for the connection between its devices. the device that runs on host alice uses /dev/drbd1 as its device for the application, and /dev/sda7 as low-level storage for the data. the IP addresses are what you use to specify the networking interfaces. and an eventually running resync process should use about 10MByte/second of IO bandwidth. slay. π
there may be multiple resource sections in a single drbd.conf file. for more examples, please have a look at the DRBD User's Guide[1]. go read it, i'll wait π
π¦ FILE FORMAT π¦
the file consists of sections and parameters. a section begins with a keyword, sometimes an additional name, and an opening brace (β{β). a section ends with a closing brace (β}β). the braces enclose the parameters. it's giving nested vibes.
section [name] { parameter value; [...] }
a parameter starts with the identifier of the parameter followed by whitespace. every subsequent character is considered as part of the parameter's value. βοΈ a special case are Boolean parameters, which consist only of the identifier. parameters are terminated by a semicolon (β;β).
some parameter values have default units which might be overruled by K, M or G. these units are defined in the usual way: K = 2^10 = 1024, M = 1024 K, G = 1024 M. math is math, periodt. π’
comments may be placed into the configuration file and must begin with a hash sign (β#β). subsequent characters are ignored until the end of the line. classic. π
π Sections π
skip
comments out chunks of text, even spanning more than one line. characters between the keyword skip and the opening brace (β{β) are ignored. everything enclosed by the braces is skipped. this comes in handy if you just want to comment out some 'resource [name] {...}' section β just precede it with 'βskipβ'. so valid, so clean. β¨
global
configures some global parameters. currently only minor-count, dialog-refresh, disable-ip-verification and usage-count are allowed here. you may only have one global section, preferably as the first section. main character energy, first in line. π
common
all resources inherit the options set in this section. the common section might have a startup, a syncer, a handlers, a net and a disk section. it's the shared closet everyone borrows from. π§
resource name
configures a DRBD resource. each resource section needs to have two (or more) on host sections, and may have a startup, a syncer, a handlers, a net and a disk section. required parameter in this section: protocol. π
on host-name
carries the necessary configuration parameters for a DRBD device of the enclosing resource. host-name is mandatory and must match the Linux host name (uname -n) of one of the nodes. you may list more than one host name here, in case you want to use the same parameters on several hosts (you'd have to move the IP around usually). or you may list more than two such sections. look at this gorgeous example:
resource r1 {
protocol C;
device minor 1;
meta-disk internal;
on alice bob {
address 10.2.2.100:7801;
disk /dev/mapper/some-san;
}
on charlie {
address 10.2.2.101:7801;
disk /dev/mapper/other-san;
}
on daisy {
address 10.2.2.103:7801;
disk /dev/mapper/other-san-as-seen-from-daisy;
}
}
see also the floating section keyword. required parameters in this section: device, disk, address, meta-disk, flexible-meta-disk. don't forget a single one, bestie, i'm serious π€
stacked-on-top-of resource
for a stacked DRBD setup (3 or 4 nodes), a stacked-on-top-of is used instead of an on section. required parameters in this section: device and address. that's the whole checklist. β
floating AF addr:port
carries the necessary configuration parameters for a DRBD device of the enclosing resource. this section is very similar to the on section. the difference is that the matching of the host sections to machines is done by the IP-address instead of the node name. required parameters in this section: device, disk, meta-disk, flexible-meta-disk β all of which may be inherited from the resource section, in which case you may shorten this section down to just the address identifier. cute, efficient, we love her. π
resource r2 {
protocol C;
device minor 2;
disk /dev/sda7;
meta-disk internal;
# short form, device, disk and meta-disk inherited
floating 10.1.1.31:7802;
# longer form, only device inherited
floating 10.1.1.32:7802 {
disk /dev/sdb;
meta-disk /dev/sdc8;
}
}
disk
this section is used to fine tune DRBD's properties in respect to the low level storage. please refer to drbdsetup(8) for a detailed description of the parameters. optional parameters: on-io-error, size, fencing, use-bmbv, no-disk-barrier, no-disk-flushes, no-disk-drain, no-md-flushes, max-bio-bvecs, disk-timeout. π§
net
this section is used to fine tune DRBD's properties. please refer to drbdsetup(8) for a detailed description of this section's parameters. optional parameters: sndbuf-size, rcvbuf-size, timeout, connect-int, ping-int, ping-timeout, max-buffers, max-epoch-size, ko-count, allow-two-primaries, cram-hmac-alg, shared-secret, after-sb-0pri, after-sb-1pri, after-sb-2pri, data-integrity-alg, no-tcp-cork, on-congestion, congestion-fill, congestion-extents. the networking chapter, we're obsessed. π
startup
this section is used to fine tune DRBD's properties. please refer to drbdsetup(8) for a detailed description of this section's parameters. optional parameters: wfc-timeout, degr-wfc-timeout, outdated-wfc-timeout, wait-after-sb, stacked-timeouts and become-primary-on. π
syncer
this section is used to fine tune the synchronization daemon for the device. please refer to drbdsetup(8) for a detailed description of this section's parameters. optional parameters: rate, after, al-extents, use-rle, cpu-mask, verify-alg, csums-alg, c-plan-ahead, c-fill-target, c-delay-target, c-max-rate, c-min-rate and on-no-data-accessible. syncing is her whole personality. π
handlers
in this section you can define handlers (executables) that are started by the DRBD system in response to certain events. optional parameters: pri-on-incon-degr, pri-lost-after-sb, pri-lost, fence-peer (formerly oudate-peer), local-io-error, initial-split-brain, split-brain, before-resync-target, after-resync-target. β‘
the interface is done via environment variables:
DRBD_RESOURCEβ is the name of the resourceDRBD_MINORβ is the minor number of the DRBD device, in decimal.DRBD_CONFβ is the path to the primary configuration file; if you split your configuration into multiple files (e.g. in/etc/drbd.conf.d/), this will not be helpful.DRBD_PEER_AF,DRBD_PEER_ADDRESS,DRBD_PEERSβ are the address family (e.g.ipv6), the peer's address and hostnames.
DRBD_PEER(note the singular form) is deprecated, and superseeded byDRBD_PEERS. it's giving legacy, bestie, please move on π
please note that not all of these might be set for all handlers, and that some values might not be useable for a floating definition. so don't come for me if one's missing π
π Parameters π
minor-count count
count may be a number from 1 to 255.
use minor-count if you want to define massively more resources later without reloading the DRBD kernel module. per default the module loads with 11 more resources than you have currently in your config but at least 32. future-proofing queen π
dialog-refresh time
time may be 0 or a positive number.
the user dialog redraws the second count every time seconds (or does no redraws if time is 0). the default value is 1. β±οΈ
disable-ip-verification
use disable-ip-verification if, for some obscure reasons, drbdadm can/might not use ip or ifconfig to do a sanity check for the IP address. you can disable the IP verification with this option. obscure reasons only, no cap. π΅οΈ
usage-count val
please participate in DRBD's online usage counter[2]. the most convenient way to do so is to set this option to yes. valid options are: yes, no and ask. go on, say yes, it's free π₯Ί
protocol prot-id
on the TCP/IP link the specified protocol is used. 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.
device name minor nr
the name of the block device node of the resource being described. you must use this device with your application (file system) and you must not use the low level block device which is specified with the disk parameter. do not, i repeat, do NOT. π
one can ether omit the name or minor and the minor number. if you omit the name a default of /dev/drbdminor will be used.
udev will create additional symlinks in /dev/drbd/by-res and /dev/drbd/by-disk. cute little shortcuts, love that for us π
disk name
DRBD uses this block device to actually store and retrieve the data. never access such a device while DRBD is running on top of it. this also holds true for dumpe2fs(8) and similar commands. i'm so serious, put the command down π
address AF addr:port
a resource needs one IP address per device, which is used to wait for incoming connections from the partner device respectively to reach the partner device. AF must be one of ipv4, ipv6, ssocks or sdp (for compatibility reasons sci is an alias for ssocks). it may be omited for IPv4 addresses. the actual IPv6 address that follows the ipv6 keyword must be placed inside brackets: ipv6 [fd01:2345:6789:abcd::1]:7800. brackets are not optional, she's dramatic like that π
part 1 done, bestie β more coming, don't go anywhere π¦
okay so your DRBD resource needs a TCP port to hook up with the node's partner device β and two different DRBD resources may NOT use the same addr:port combination on the same node. no sharing, bestie, that's the whole rule π
meta-disk internal,flexible-meta-disk internal,meta-disk device [index],flexible-meta-disk deviceβ this is where the meta-data lives, and there are β¨choicesβ¨internalmeans the last part of the backing device gets used to store the meta-data. You must not use[index]withinternal. Note: regardless of whether you use themeta-diskor theflexible-meta-diskkeyword, it will always be of the size needed for the remaining storage size.- You can use a single block device to store meta-data of multiple DRBD devices. E.g. use
meta-disk /dev/sde6[0];andmeta-disk /dev/sde6[1];for two different resources. In this case the meta-disk would need to be at least 256 MB in size. - With the
flexible-meta-diskkeyword you specify a block device as meta-data storage. You usually use this with LVM, which lets you have many variable sized block devices. The required size of the meta-disk block device is36kB + Backing-Storage-size / 32k. Round that number to the next 4kb boundary up and you have the exact size. Rule of the thumb: 32kByte per 1GByte of storage, round up to the next MB.
on-io-error handlerβ thehandlerthat gets taken if the lower level device reports io-errors to the upper layers.handlermay bepass_on,call-local-io-errorordetach.pass_on: the node downgrades the disk status to inconsistent, marks the erroneous block as inconsistent in the bitmap and retries the IO on the remote node.call-local-io-error: call the handler scriptlocal-io-error.detach: the node drops its low level device, and continues in diskless mode.
fencing fencing_policyβ by 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 taken.resource-onlyβ if a node becomes a disconnected primary, it tries to fence 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.
use-bmbvβ in case the backing storage's driver has amerge_bvec_fn()function, DRBD has to pretend that it can only process IO requests in units not larger than4KiB. (At the 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 the best performance out of DRBD on top of software RAID (or any other driver with a
merge_bvec_fn()function) you might enable this function, if you know for sure that themerge_bvec_fn()function will deliver the same results on all nodes of your cluster. I.e. the physical disks of the software RAID are of exactly the same type. Use this option only if you know what you are doing.
- To get the best performance out of DRBD on top of software RAID (or any other driver with a
no-disk-barrier,no-disk-flushes,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 a 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 useno-disk-drain. π« - Unfortunately device mapper (LVM) might not support barriers.
- The letter after
"wo:"in/proc/drbdindicates with method is currently in use for a device:b,f,d,n. The implementations are: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 theno-disk-barrieroption. 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 theno-disk-flushesoption.drainβ the third method is simply to let write requests drain before write requests of a new reordering domain are issued. This was the only implementation before8.0.9.noneβ the fourth method is to not express write-after-write dependencies to the backing store at all, by also specifyingno-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 useno-disk-drain.
- 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 a battery-backed write cache you may go with option 3. Option 4 (disable everything, use
no-md-flushesβ disables the use of disk flushes and barrier BIOs when accessing the meta data device. See the notes onno-disk-flushes.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'smerge_bvec()function and which have more than one bvec. A known example is:phys-disk -> DRBD -> LVM -> Xen -> misaligned 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). This costs480 KiBof storage. Unfortunately the default of most Linux partitioning tools is to start the first partition at an odd number (63). Therefore most distribution's 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 (=max-bio-bvecs) to1, but that might cost performance. - The default value of
max-bio-bvecsis0, which means that there is no user imposed limitation.
- The best workaround is to proper align the partition within the VM (E.g. start it at sector
disk-timeoutβ if the driver of thelower_devicedoes not finish an IO request withindisk_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-timeoutis0, which means that no timeout is enforced. The default unit is100ms. This option is available since8.3.12.
- The default value of
sndbuf-size sizeβsizeis the size of the TCP socket send buffer. The default value is0, i.e. autotune. You can specify smaller or larger values. Larger values are appropriate for reasonable write throughput with protocol A over high latency networks. Values below32Kdo not make sense. Since8.0.13resp.8.2.7, setting thesizevalue to0means that the kernel should autotune this.rcvbuf-size sizeβsizeis the size of the TCP socket receive buffer. The default value is0, i.e. autotune. You can specify smaller or larger values. Usually this should be left at its default. Setting thesizevalue to0means that the kernel should autotune this.timeout timeβ if the partner node fails to send an expected response packet withintimetenths of a second, the partner node is considered dead and therefore the TCP/IP connection is abandoned. This must be lower thanconnect-intandping-int. The default value is60= 6 seconds, the unit0.1seconds.connect-int timeβ in case it is not possible to connect to the remote DRBD device immediately, DRBD keeps on trying to connect. With this option you can set the time between two retries. The default value is10seconds, the unit is1second.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 is10seconds, the unit is1second.ping-timeout timeβ the time the peer has time to answer to a keep-alive packet. In case the peer's reply is not received within this time period, it is considered as dead. The default value is500ms, the default unit are tenths of a second.max-buffers numberβ limits the memory usage per DRBD minor device on the receiving side, or for internal buffers during resync or online-verify. Unit isPAGE_SIZE, which is4 KiBon most systems. The minimum possible setting is hard coded to32(=128 KiB). These buffers are used to hold data blocks while they are written to/read from disk. To avoid possible distributed deadlocks on congestion, this setting is used as a throttle threshold rather than a hard limit. Once more thanmax-bufferspages are in use, further allocation from this pool is throttled. You want to increasemax-buffersif you cannot saturate the IO backend on the receiving side.ko-count numberβ in case the secondary node fails to complete a single write request forcounttimes thetimeout, 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 numberβ the highest number of data blocks between two write barriers. If you set this smaller than10, you might decrease your performance. πallow-two-primariesβ and the manpage literally cuts off right here, bestie π the rest of this one is coming in the next chunk, stay tuned π«Ά
Okay so with this option set you may assign the primary role to both nodes. But bestie β 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! π
unplug-watermark numberβ this one has no effect with recent kernels that use explicit on-stack plugging (that's upstream Linux kernel2.6.39, and distributions may have backported it). 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 asmax-buffers, yet others don't feel much effect at all. Minimum16, default128, maximum131072. β¨cram-hmac-algβ you need to specify the HMAC algorithm to enable peer authentication at all. And you are strongly encouraged to use peer authentication, fr fr. 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β the shared secret used in peer authentication. May be up to64characters. Note that peer authentication is disabled as long as nocram-hmac-alg(see above) is specified. πafter-sb-0pri 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 happened.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 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.violently-as0pβ always take the decision of theafter-sb-0prialgorithm, even if that causes an erratic change of the primary's view of the data. This is only useful if you use a one-node FS (i.e. notOCFS2orGFS) with theallow-two-primariesflag, AND if you really know what you are doing. This is DANGEROUS and MAY CRASH YOUR MACHINE if you have an FS mounted on the primary node. π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 right data, it calls the"pri-lost-after-sb"handler on the current primary.
after-sb-2pri policyβ possible policies are:disconnectβ no automatic resynchronization, simply disconnect.violently-as0pβ always take the decision of theafter-sb-0prialgorithm, even if that causes an erratic change of the primary's view of the data. This is only useful if you use a one-node FS (i.e. notOCFS2orGFS) with theallow-two-primariesflag, AND if you really know what you are doing. This is DANGEROUS and MAY CRASH YOUR MACHINE if you have an FS mounted on the primary node. πcall-pri-lost-after-sbβ call the"pri-lost-after-sb"helper program on one of the machines. This program is expected to reboot the machine, i.e. make it secondary.
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 led to strange UUID sets.) πrr-conflict policyβ this option helps to solve the cases when the outcome of the resync decision is incompatible with the current role assignment in the cluster.disconnectβ no automatic resynchronization, simply disconnect.violentlyβ sync to the primary node is allowed, violating the assumption that data on a block device are stable for one of the nodes. Dangerous, do not use.call-pri-lostβ call the"pri-lost"helper program on one of the machines. This program is expected to reboot the machine, i.e. make it secondary.
data-integrity-alg 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. π«Ά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. It turned out that there is at least one network stack that performs worse when one uses this hinting method. Therefore we introduced this option, which disables the setting and clearing of theTCP_CORKsocket option by DRBD. πon-congestion congestion_policy, congestion-fill fill_threshold, 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 be more desirable that DRBD goes into AHEAD/BEHIND mode shortly before the send queue becomes full. In AHEAD/BEHIND mode DRBD does no longer replicate data, but still keeps the connection open. The advantage of the AHEAD/BEHIND mode is that the application is not slowed down, even if DRBD-proxy's buffer is not sufficient to buffer all write requests. The downside is that the peer node falls behind, and that a resync will be necessary to bring it back into sync. During that resync the peer node will have an inconsistent disk. π Availablecongestion_policys areblockandpull-ahead. The default isblock.fill_thresholdmight be in the range of0to10GiBytes. The default is0which disables the check.active_extents_thresholdhas the same limits asal-extents. The AHEAD/BEHIND mode and its settings are available since DRBD8.3.10. βwfc-timeout timeβ wait for connection timeout. The init scriptdrbd(8)blocks the boot process until the DRBD resources are connected. When the cluster manager starts later, it does not see a resource with internal split-brain. In case you want to limit the wait time, do it here. Default is0, which means unlimited. The unit is seconds. β³degr-wfc-timeout timeβ wait for connection timeout, if this node was a degraded cluster. In case a degraded cluster (= cluster with only one node left) is rebooted, this timeout value is used instead ofwfc-timeout, because the peer is less likely to show up in time, if it had been dead before. Value0means unlimited.outdated-wfc-timeout timeβ wait for connection timeout, if the peer was outdated. In case a degraded cluster (= cluster with only one node left) with an outdated peer disk is rebooted, this timeout value is used instead ofwfc-timeout, because the peer is not allowed to become primary in the meantime. Value0means unlimited.wait-after-sbβ by setting this option you can make the init script to continue to wait even if the device pair had a split brain situation and therefore refuses to connect. π₯²become-primary-on node-nameβ sets on which node the device should be promoted to primary role by the init script. The node-name might either be a host name or the keywordboth. When this option is not set the devices stay in secondary role on both nodes. Usually one delegates the role assignment to a cluster manager (e.g.heartbeat). πstacked-timeoutsβ usuallywfc-timeoutanddegr-wfc-timeoutare ignored for stacked devices, instead twice the amount ofconnect-intis used for the connection timeouts. With thestacked-timeoutskeyword you disable this, and force DRBD to mind thewfc-timeoutanddegr-wfc-timeoutstatements. Only do that if the peer of the stacked resource is usually not available or will usually not become primary. By using this option incorrectly, you run the risk of causing unexpected split brain. π¬rate rateβ to ensure a smooth operation of the application on top of DRBD, it is possible to limit the bandwidth which may be used by background synchronizations. The default is250 KB/sec, the default unit isKB/sec. Optional suffixesK,M,Gare allowed. πuse-rleβ during resync-handshake, the dirty-bitmaps of the nodes are exchanged and merged (using bit-or), so the nodes will have the same understanding of which blocks are dirty. On large devices, the fine grained dirty-bitmap can become large as well, 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. π§
okay so real quick, the tail end of that last one: for backward-compat reasons, and because on fast links it maybe doesn't even make your transfer any quicker while it chomps through CPU cycles β this thing defaults to off. π
after res-nameβ by default, resynchronization of all devices just runs in parallel, chaos-gremlin style. But if you define a sync-after dependency, the resync of this resource won't even start until the resource res-name is already in connected state (which means it's finished its own resynchronization). πal-extents extentsβ DRBD does hot area detection automatically, and this is you deciding how big the hot area (aka the active set) is allowed to get. Every single extent marks 4M of the backing storage (that's your low-level device, bestie). If a primary node dips out of the cluster unexpectedly, everything covered by the active set has to get resynced when it 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. Bigger number of extents = longer resync times but fewer meta-data updates. Default is 127. (Minimum: 7, Maximum: 3843.) β¨verify-alg hash-algβ during online verification (the kind you kick off with theverifysub-command), instead of doing a bit-wise comparison, DRBD slaps a hash function on the contents of every block it's verifying and compares that hash with the peer. This option is the hash algorithm it uses for that. You can set it to any of the kernel's data digest algorithms. In a typical kernel config you should have at least one ofmd5,sha1, andcrc32csitting there ready. By default this is not enabled β you have to set it explicitly if you want to be able to use on-line device verification. π
See also the notes on data integrity (they're right below, iykyk).
csums-alg hash-algβ a resync process sends all the marked data blocks from the source to the destination node, as long as nocsums-algis given. Once you specify one, the resync process exchanges hash values of all the marked blocks first, and then only sends the data blocks that have different hash values. π¦
This is genuinely useful for DRBD setups with low bandwidth links. When a crashed primary node restarts, every block covered by the activity log gets marked for resync β but a big chunk of those are actually still in sync, so using csums-alg lowers the bandwidth you need, and the price you pay is CPU cycles.
c-plan-ahead plan_time,c-fill-target fill_target,c-delay-target delay_target,c-max-rate max_rateβ the dynamic resync speed controller switches on when you set plan_time to a positive value. Its whole goal: fill the buffers along the data path with either a constant amount of data (fill_target), or keep a constant delay time (delay_target) along the path. The controller has an upper bound, and that's max_rate. π₯
plan_time is where you configure the agility of the controller. Higher values = slower/lower responses from the controller when things deviate 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 has drbd-proxy in it, it's 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. π
Defaults, so you know: plan_time default is 0, and its default unit is 0.1 seconds. fill_target defaults to 0 with sectors as the default unit. delay_target defaults to 1 (100ms) with 0.1 as the default unit. max_rate defaults to 10240 (100MiB/s) with KiB/s as the default unit.
The dynamic resync speed controller and its settings have been available since DRBD 8.3.9.
c-min-rate min_rateβ a node that's primary and sync-source has to schedule both application IO requests and resync IO requests. min_rate tells DRBD to use only up to min_rate for resync IO, and to hand all the other available IO bandwidth to application requests. π«Ά
Note: the value 0 has a special meaning. It disables the limitation of resync IO completely β which might slow down application IO considerably. Set it to 1 if you'd rather resync IO never slows down application IO.
Note: even though the name might suggest it's a lower bound for the dynamic resync speed controller, it is not. If thedrbd-proxybuffer is full, the dynamic resync speed controller is free to lower the resync speed all the way down to 0, completely independent of thec-min-ratesetting.
Min_rate has 4096 (4MiB/s) and KiB/s as default unit.
on-no-data-accessible ond-policyβ this controls what happens to IO requests on a degraded, diskless node (meaning: no data store is reachable). The policies you can pick from areio-errorandsuspend-io. π
If ond-policy is set to suspend-io, you can resume IO either by attaching/connecting the last lost data storage, or with the drbdadm resume-io res command. That second one will of course result in IO errors. π
The default is io-error. This setting is available since DRBD 8.3.9.
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 should be spread over all CPUs of the machine. This value must be given in hexadecimal notation. If it's too big, it will just get truncated. βοΈpri-on-incon-degr cmdβ this handler gets called if the node is primary, degraded, and the local copy of the data is inconsistent. πpri-lost-after-sb cmdβ the node is currently primary, but it lost the after-split-brain auto recovery procedure. As a consequence, it should be abandoned. πpri-lost cmdβ the node is currently primary, but DRBD's algorithm thinks it should become sync target. As a consequence it should give up its primary role. πfence-peer cmdβ this handler is part of the fencing mechanism. It gets called when the node needs to fence the peer's disk. It should use other communication paths than DRBD's network link. πlocal-io-error cmdβ DRBD got an IO error from the local IO subsystem. πinitial-split-brain cmdβ DRBD has connected and detected a split brain situation. This handler can alert someone in all cases of split brain, not just the ones that go unresolved. π¨split-brain cmdβ DRBD detected a split brain situation but it remains unresolved. Manual recovery is necessary. This handler should alert someone on duty. π£before-resync-target cmdβ DRBD calls this handler just before a resync begins on the node that's becoming the resync target. It might be used to take a snapshot of the backing block device. πΈafter-resync-target cmdβ DRBD calls this handler just after a resync operation finished on the node whose disk just became consistent after being inconsistent for the duration of the resync. It might be used to remove a snapshot of the backing device that was created by thebefore-resync-targethandler. π§Ή
πΈ Other Keywords πΈ
include file-patternβ includes all files matching the wildcard pattern file-pattern. Heads up: theincludestatement is only allowed on the top level, i.e. it is not allowed inside any section. π«
π NOTES ON DATA INTEGRITY π
There are two independent methods in DRBD to keep your mirrored data's integrity on lock. One is the online-verify mechanism, the other is the data-integrity-alg of the network section. β¨
Both mechanisms might deliver false positives if the user of DRBD modifies the data that gets written to disk while the transfer is going on. This can happen for swap, or for certain append while global sync, or truncate/rewrite workloads β and it doesn't necessarily pose a problem for the integrity of the data. Usually when the initiator of the data transfer does this, it already knows that that data block won't be part of an on-disk data structure, or that it'll be resubmitted with correct data soon enough. π
The data-integrity-alg causes the receiving side to log an error about Digest integrity check FAILED: Ns +x\n, where N is the sector offset, and x is the size of the requst in bytes. It will then disconnect, and reconnect, thus causing a quick resync. If the sending side at the same time detected a modification, it warns about Digest mismatch, buffer modified by upper layers during write: Ns +x\n, which shows that this was a false positive. The sending side may detect these buffer modifications immediately after the unmodified data has been copied to the tcp buffers, in which case the receiving side won't notice it. π
The most recent (2007) example of systematic corruption was an issue with the TCP offloading engine and the driver of a certain type of GBit NIC. The actual corruption happened on the DMA transfer from core memory to the card. Since the TCP checksum gets calculated on the card, this type of corruption stays undetected as long as you do not use either the online verify or the data-integrity-alg. π
We suggest using the data-integrity-alg only during a pre-production phase, because of its CPU costs. Further, we suggest doing online verify runs regularly, e.g. once a month during a low load period. ποΈ
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(8), drbddisk(8), drbdsetup(8), drbdadm(8), DRBD User's Guide[1], DRBD web site[3] π
NOTES
- DRBD User's Guide
http://www.drbd.org/users-guide/ - DRBD's online usage counter
http://usage.drbd.org - DRBD web site
http://www.drbd.org/
and that's a wrap bestie π that was the DRBD.CONF(5) page, revised for DRBD 8.3.2, dated 5 Dec 2008 β go forth and mirror your disks responsibly, you absolute icon ππ
π¦ where this page comes from
- debian bookworm: drbd-utils 9.22.0-1 Β· GPL-2.0-or-later
- debian trixie: drbd-utils 9.22.0-1.1 Β· GPL-2.0-or-later
- ubuntu noble: drbd-utils 9.22.0-1build1 Β· GPL-2.0-or-later
- ubuntu questing: drbd-utils 9.22.0-1.2
- ubuntu resolute: drbd-utils 9.22.0-1.2build1 Β· GPL-2.0-or-later
- ubuntu stonking: drbd-utils 9.22.0-1.2build1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms