DRBD.CONF(5)
๐ drbd.conf(5) โ Configuration Files ๐
okay bestie, sit down, hydrate, because this is drbd.conf(5) and we are going to understand it together. no cap. ๐ซถ
๐ธ NAME ๐ธ
drbd.conf โ the configuration file for DRBD's devices. short, sweet, iconic. โจ
๐ฆ INTRODUCTION ๐ฆ
okay so the file /etc/drbd.conf is the one drbdadm reads. that's the whole relationship. ๐
The file format was literally designed so you can have a verbatim copy of the file on both nodes of the cluster. and bestie, please do that, it is highly recommended โ it's how you keep your config manageable and not a chaotic mess. The file /etc/drbd.conf should be the same on both nodes of the cluster. ๐
heads up: changes to /etc/drbd.conf do not apply immediately. it's giving "no instant gratification". ๐ญ
By convention the main config contains two include statements. The first one includes the file /etc/drbd.d/global_common.conf, and the second one all files with a .res suffix. ๐
resource r0 {
net {
protocol C;
cram-hmac-alg sha1;
shared-secret "FooFunFactory";
}
disk {
resync-rate 10M;
}
on alice {
volume 0 {
device minor 1;
disk /dev/sda7;
meta-disk internal;
}
address 10.1.1.31:7789;
}
on bob {
volume 0 {
device minor 1;
disk /dev/sda7;
meta-disk internal;
}
address 10.1.1.32:7789;
}
}
so in this example there is a single DRBD resource (called r0) which uses protocol C for the connection between its devices. It contains a single volume which runs on host alice, uses /dev/drbd1 as devices for its application, and /dev/sda7 as low-level storage for the data. The IP addresses are used to specify the networking interfaces to be used. An eventually running resync process should use about 10MByte/second of IO bandwidth. This resync-rate statement is valid for volume 0, but would also be valid for further volumes. In this example it assigns full 10MByte/second to each volume. ๐ฅ
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]. ๐
๐ 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.
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). ๐งฎ
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.
๐ Sections ๐
skipโ Comments out chunks of text, even spanning more than one line. Characters between the keywordskipand 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'. ๐globalโ Configures some global parameters. Currently onlyminor-count,dialog-refresh,disable-ip-verificationandusage-countare allowed here. You may only have oneglobalsection, preferably as the first section. ๐commonโ All resources inherit the options set in this section. Thecommonsection might have astartup, aoptions, ahandlers, anetand adisksection. ๐resource nameโ Configures a DRBD resource. Each resource section needs to have two (or more)on hostsections and may have astartup, aoptions, ahandlers, anetand adisksection. It might containvolumessections. โจon host-nameโ Carries the necessary configuration parameters for a DRBD device of the enclosing resource.host-nameis 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. ๐ฆ
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 statements in this section: address and volume. Note for backward compatibility and convenience it is valid to embed the statements of a single volume directly into the host section. ๐
volume vnrโ Defines a volume within a connection. The minor numbers of a replicated volume might be different on different hosts, the volume number (vnr) is what groups them together. Required parameters in this section:device,disk,meta-disk. ๐ฅstacked-on-top-of resourceโ For a stacked DRBD setup (3 or 4 nodes), astacked-on-top-ofis used instead of anonsection. Required parameters in this section:deviceandaddress. ๐ธfloating AF addr:portโ Carries the necessary configuration parameters for a DRBD device of the enclosing resource. This section is very similar to theonsection. The difference to theonsection 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, all of which may be inherited from the resource section, in which case you may shorten this section down to just theaddressidentifier. โจ
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 todrbdsetup(8)for detailed description of the parameters. Optional parameters:on-io-error,size,fencing,disk-barrier,disk-flushes,disk-drain,md-flushes,max-bio-bvecs,resync-rate,resync-after,al-extents,al-updates,c-plan-ahead,c-fill-target,c-delay-target,c-max-rate,c-min-rate,disk-timeout,discard-zeroes-if-aligned,rs-discard-granularity,read-balancing. ๐netโ This section is used to fine tune DRBD's properties. Please refer todrbdsetup(8)for a detailed description of this section's parameters. Optional parameters:protocol,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,verify-alg,use-rle,csums-alg,socket-check-timeout. ๐startupโ This section is used to fine tune DRBD's properties. Please refer todrbdsetup(8)for a detailed description of this section's parameters. Optional parameters:wfc-timeout,degr-wfc-timeout,outdated-wfc-timeout,wait-after-sb,stacked-timeoutsandbecome-primary-on. ๐optionsโ This section is used to fine tune the behaviour of the resource object. Please refer todrbdsetup(8)for a detailed description of this section's parameters. Optional parameters:cpu-mask, andon-no-data-accessible. โ๏ธ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(formerlyoudate-peer),local-io-error,initial-split-brain,split-brain,before-resync-target,after-resync-target. ๐จ
The interface is done via environment variables:
DRBD_RESOURCEis the name of the resourceDRBD_MINORis the minor number of the DRBD device, in decimal.DRBD_CONFis 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_PEERSare the address family (e.g.ipv6), the peer's address and hostnames.
DRBD_PEER is deprecated.
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. ๐ซถ
๐ง Parameters ๐ง
minor-count countโcountmay be a number from 1 to 1048575.
Minor-count is a sizing hint for DRBD. It helps to right-size various memory pools. It should be set in the in the same order of magnitude than the actual number of minors you use. Per default the module loads with 11 more resources than you have currently in your config but at least 32. ๐ข
dialog-refresh timeโtimemay be0or 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โ Usedisable-ip-verificationif, for some obscure reasons,drbdadmcan/might not useiporifconfigto do a sanity check for the IP address. You can disable the IP verification with this option. ๐ธudev-always-use-vnrโ When udev asksdrbdadmfor a list of device related symlinks,drbdadmwould suggest symlinks with differing naming conventions, depending on whether the resource has explicitvolume VNR { }definitions, or only one single volume with the implicit volume number0:
okay so the symlink layout it hands you looks a lil something like this:
# implicit single volume without "volume 0 {}" block
DEVICE=drbd<minor>
SYMLINK_BY_RES=drbd/by-res/<resource-name>
# explicit volume definition: volume VNR { }
DEVICE=drbd<minor>
SYMLINK_BY_RES=drbd/by-res/<resource-name>/VNR
and if you drop this parameter into the global section, drbdadm will always add the .../VNR part, and will not care for whether the volume definition was implicit or explicit. ๐
for legacy backward compatibility this is off by default โ but bestie, we do recommend you enable it. no cap. ๐ซถ
usage-countval โ pls pls pls participate in DRBD's online usage counter[2] ๐ฅบ the comfiest way to do that is to set this option toyes. valid options are:yes,noandask.protocolprot-id โ this is the protocol that gets used on the TCP/IP link. 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. (this one is the vibe, just saying)
- Protocol
devicename 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 thediskparameter. like, not even a little. ๐ โโ๏ธ
you can either omit the name or 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.
diskname โ 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 fordumpe2fs(8)and similar commands. ๐addressAF 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 ofipv4,ipv6,ssocksorsdp(for compatibility reasonssciis an alias forssocks). it may be omitted for IPv4 addresses. the actual IPv6 address that follows theipv6keyword must be placed inside brackets:ipv6 [fd01:2345:6789:abcd::1]:7800.
each DRBD resource needs a TCP port which is used to connect to the node's partner device. two different DRBD resources may not use the same addr:port combination on the same node. ๐ซ
meta-disk internal,meta-diskdevice,meta-diskdevice[index]โ where the meta-data lives, three flavors:
internal means that the last part of the backing device is used to store the meta-data. the size of the meta-data is computed based on the size of the device.
when a device is specified, either with or without an index, DRBD stores the meta-data on this device. without index, the size of the meta-data is determined by the size of the data device. this is usually used with LVM, which allows to have many variable sized block devices. the meta-data size is 36kB + Backing-Storage-size / 32k, rounded up to the next 4kb boundary. (rule of the thumb: 32kByte per 1GByte of storage, rounded up to the next MB.)
when an index is specified, each index number refers to a fixed slot of meta-data of 128 MB, which allows a maximum data size of 4 TiB. this way, multiple DRBD devices can share the same meta-data device. for example, if /dev/sde6[0] and /dev/sde6[1] are used, /dev/sde6 must be at least 256 MB big. because of the hard size limit, use of meta-disk indexes is discouraged. ๐
on-io-errorhandler โ handler is taken if the lower level device reports io-errors to the upper layers. handler may 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.
fencingfencing_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 the fence-peer handler. 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 its fence-peer handler. the fence-peer handler 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 the flush method is used.
since drbd-8.4.2 disk-barrier is disabled by default because since linux-2.6.36 (or 2.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. ๐
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 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 enabled by setting thedisk-barrieroptions toyes.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 settingdisk-flushestono.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.
md-flushesโ disables the use of disk flushes and barrier BIOs when accessing the meta data device. see the notes ondisk-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 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 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) 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.
disk-timeoutโ if the lower-level device on which a DRBD device stores its data does not finish an I/O request within the defineddisk-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 do no longer complete requests at all, not even do 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 switchover 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}
There are, like, so many aspects to discard/trim/unmap support on linux block devices, bestie. Even if discard is supported in general, it may fail silently, or may partially ignore discard requests. Devices also announce whether reading from unmapped blocks returns defined data (usually zeroes), or undefined data (possibly old data, possibly garbage). It's giving chaos energy ngl.
So if on different nodes DRBD is backed by devices with differing discard characteristics, discards may lead to data divergence (old data or garbage left over on one backend, zeroes due to unmapped areas on the other backend). And then online verify would potentially report tons of spurious differences. While probably harmless for most use cases (fstrim on a file system), DRBD cannot have that. Not on our watch. ๐
To play safe, we have to disable discard support, if our local backend (on a Primary) does not support discard_zeroes_data=true. We also have to translate discards to explicit zero-out on the receiving side, unless the receiving side (Secondary) supports discard_zeroes_data=true, thereby allocating areas what were supposed to be unmapped.
There are some devices (notably the LVM/DM thin provisioning) that are capable of discard, but announce discard_zeroes_data=false. In the case of DM-thin, discards aligned to the chunk size will be unmapped, and reading from unmapped sectors will return zeroes. However, unaligned partial head or tail areas of discard requests will be silently ignored. sneaky little things. ๐ฆ
If we now add a helper to explicitly zero-out these unaligned partial areas, while passing on the discard of the aligned full chunks, we effectively achieve discard_zeroes_data=true on such devices. slay, we fixed it ourselves. โจ
Setting discard-zeroes-if-aligned to yes will allow DRBD to use discards, and to announce discard_zeroes_data=true, even on backends that announce discard_zeroes_data=false.
Setting discard-zeroes-if-aligned to no will 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 announces discard_zeroes_data=false.
We used to ignore the discard_zeroes_data setting completely. To not break established and expected behaviour, and suddenly cause fstrim on thin-provisioned LVs to run out-of-space instead of freeing up space, the default value is yes.
This option is available since 8.4.7.
--disable-write-same {yes | no}
Some disks announce WRITE_SAME support 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. the audacity, honestly. ๐ญ
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-balancing_method_
The supported methods for load balancing of read requests are prefer-local, prefer-remote, round-robin, least-pending, when-congested-remote, 32K-striping, 64K-striping, 128K-striping, 256K-striping, 512K-striping and 1M-striping.
The default value of read-balancing is prefer-local. This option is available since 8.4.1.
rs-discard-granularity_byte_
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 a discard/trim/unmap command 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.
sndbuf-size_size_
_size_ is the size of the TCP socket send buffer. The default value is 0, 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 below 32K do not make sense. Since 8.0.13 resp. 8.2.7, setting the _size_ value to 0 means that the kernel should autotune this.
rcvbuf-size_size_
_size_ is the size of the TCP socket receive buffer. The default value is 0, i.e. autotune. You can specify smaller or larger values. Usually this should be left at its default. Setting the _size_ value to 0 means that the kernel should autotune this.
timeout_time_
If the partner node fails to send an expected response packet within _time_ tenths of a second, the partner node is considered dead and therefore the TCP/IP connection is abandoned. This must be lower than connect-int and ping-int. The default value is 60 = 6 seconds, the unit 0.1 seconds.
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 is 10 seconds, the unit is 1 second.
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. The default is 10 seconds, the unit is 1 second.
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 is 500ms, 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 is PAGE_SIZE, which is 4 KiB on most systems. The minimum possible setting is hard coded to 32 (=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 than max-buffers pages are in use, further allocation from this pool is throttled. You want to increase max-buffers if 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 for _count_ times the timeout, it is expelled from the cluster. (I.e. the primary node will kill and restart the connection.) To disable this feature, you should explicitly set it to 0; defaults may change between versions. heads up bestie, don't just assume the default. โญ
max-epoch-size_number_
The highest number of data blocks between two write barriers. If you set this smaller than 10, you might decrease your performance.
allow-two-primaries
With this option set you may assign the 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!
Like, genuinely: crash your nodes, corrupt your data. This is the dangerous one. Do not freestyle this. ๐
unplug-watermark_number_
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.
cram-hmac-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
The shared secret used in peer authentication. May be up to 64 characters. Note that peer authentication is disabled as long as no cram-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" of0blocks. 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. the name literally warns you. violently. as0p. bestie. ๐ฅ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-2pripolicy โ okay so the possible policies are:disconnectโ No automatic resynchronization, simply disconnect. periodt ๐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. ๐จ bestie, do NOT play with this one ๐จ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. it's giving "you're fired, reboot" energy ๐
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.) lowkey messy but okay โจ
rr-conflictpolicy โ This option helps to solve the cases when the outcome of the resync decision is incompatible with the current role assignment in the cluster. vibe check: who's primary? who's secondary? let's fix itdisconnectโ No automatic resynchronization, simply disconnect. bye felicia ๐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. literally do not ๐call-pri-lostโ Call thepri-lost-after-sbhelper program on one of the machines unless that machine can demote to secondary. The helper program is expected to reboot the machine, which brings the node into a secondary role. Which machine runs the helper program is determined by theafter-sb-0pristrategy. it's giving "reboot to fix your role" energy ๐
data-integrity-algalg โ 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. you gotta opt in, bestie ๐ซถ
See also the notes on data integrity.
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 introducted this option. By settingtcp-corktonoyou can disable the setting and clearing of theTCP_CORKsocket option by DRBD. yes, "introducted" โ iconic typo, we keep it ๐on-congestioncongestion_policy,congestion-fillfill_threshold,congestion-extentsactive_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. ngl, that's a trade-off bestie โ๏ธ
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. numbers, slay ๐ข
The AHEAD/BEHIND mode and its settings are available since DRBD 8.3.10. OG status ๐
wfc-timeouttime โ Wait for connection timeout.
The init script drbd(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 is 0, which means unlimited. The unit is seconds. zero = wait forever, basically โณ
degr-wfc-timeouttime โ 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. degraded cluster = solo era, not by choice ๐ญoutdated-wfc-timeouttime โ 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. outdated peer? been there ๐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. just keep waiting, bestie ๐ซถbecome-primary-onnode-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). main character energy, but for a node ๐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. โ ๏ธ risky, bestie โ unexpected split brain is NOT the vibe ๐resync-raterate โ 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. throttle it, bestie ๐ฆ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.
For backward compatibility reasons, and because on fast links this possibly does not improve transfer time but consumes cpu cycles, this defaults to off. default off, but if your link is slow, this is your bestie ๐ฆ
socket-check-timeoutvalue โ 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 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 to the round trip time between DRBD and DRBD-proxy. I.e. in most cases to 1. easy โจ
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. new-ish, but iconic ๐
resync-afterres-name โ By default, resynchronization of all devices would run in parallel. By defining aresync-afterdependency, the resynchronization of this resource will start only if the resource res-name is already in connected state (i.e., has finished its resynchronization). queue it up, bestie ๐งal-extentsextents โ DRBD automatically performs hot area detection. With this parameter you control how big the hot area (= active set) can get. Each extent marks4Mof the backing storage (= low-level device). 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 less updates to the meta-data. The default number of extents is1237. (Minimum:7, Maximum:65534) so many extents, so little time โฐ
Note that the effective maximum may be smaller, depending on how you created the device meta data, see also drbdmeta(8). The effective maximum is 919 * (available on-disk activity-log ring-buffer area/4kB -1), the default 32kB ring-buffer effects a maximum of 6433 (covers more than 25 GiB of data). We recommend to keep this well within the amount your backend storage and replication link are able to resync inside of about 5 minutes. math check: slay ๐งฎ
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. Settingal-updatestonomight increase normal operation performance but causes DRBD to do a full resync when a crashed primary gets reconnected. The default value isyes. keep ityesunless you love full resyncs ๐verify-alghash-alg โ During online verification (as initiated by theverifysub-command), rather than doing a bit-wise comparison, DRBD applies a hash function to the contents of every block being verified, and compares that hash with the peer. This option defines the hash algorithm being used for that purpose. It 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; you must set this option explicitly in order to be able to use on-line device verification. you gotta set it explicitly, bestie ๐ซถ
See also the notes on data integrity.
csums-alghash-alg โ okay so bestie, by default a resync process sends all the marked data blocks from the source node to the destination node, as long as nocsums-algis given. But when you specify one, the resync process exchanges hash values of all marked blocks first, and only sends the data blocks that have different hash values. ๐
This setting is lowkey perfect for DRBD setups with low bandwidth links. During the restart of a crashed primary node, all blocks covered by the activity log are marked for resync. But a large part of those will actually be still in sync, so using csums-alg will lower the required bandwidth in exchange for CPU cycles. It's giving "trade bandwidth for CPU" and we love that for you. โจ
c-plan-aheadplan_time,c-fill-targetfill_target,c-delay-targetdelay_target,c-max-ratemax_rate โ the dynamic resync speed controller gets enabled when you setplan_timeto a positive value. It aims to fill the buffers along the data path with either a constant amount of datafill_target, or aims to have a constant delay time ofdelay_targetalong the path. The controller has an upper bound ofmax_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 the controller will 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. ๐
The dynamic resync speed controller and its settings are available since DRBD 8.3.9. ๐
c-min-ratemin_rate โ a node that is primary and sync-source has to schedule application IO requests and resync IO requests. Themin_ratetells DRBD use only up tomin_ratefor resync IO and to dedicate all 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 a value of 1, if you prefer that resync IO never slows down application IO. ๐ญ
Note: Although the name might suggest that it is 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 down to 0, completely independent of thec-min-ratesetting. ๐
The default value of min_rate is 250, in units of KiB/s. โจ
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. ๐
cpu-maskcpu-mask โ sets the cpu-affinity-mask for DRBD's kernel threads of this device. The default value ofcpu-maskis 0, which means that DRBD's kernel threads should be spread over all CPUs of the machine. This value must be given in hexadecimal notation. If it is too big it will be truncated. ๐งpri-on-incon-degrcmd โ this handler is called if the node is primary, degraded and if the local copy of the data is inconsistent. ๐ญpri-lost-after-sbcmd โ the node is currently primary, but lost the after-split-brain auto recovery procedure. As a consequence, it should be abandoned. ๐pri-lostcmd โ the node is currently primary, but DRBD's algorithm thinks that it should become sync target. As a consequence it should give up its primary role. ๐fence-peercmd โ the handler is part of the fencing mechanism. This handler is called in case the node needs to fence the peer's disk. It should use other communication paths than DRBD's network link. ๐ฅlocal-io-errorcmd โ DRBD got an IO error from the local IO subsystem. ๐ฅinitial-split-braincmd โ DRBD has connected and detected a split brain situation. This handler can alert someone in all cases of split brain, not just those that go unresolved. ๐จsplit-braincmd โ DRBD detected a split brain situation but remains unresolved. Manual recovery is necessary. This handler should alert someone on duty. ๐before-resync-targetcmd โ DRBD calls this handler just before a resync begins on the node that becomes resync target. It might be used to take a snapshot of the backing block device. ๐ธafter-resync-targetcmd โ 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 โจ
includefile-pattern โ include all files matching the wildcard pattern file-pattern. 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 ensure the integrity of the mirrored data. The online-verify mechanism and the data-integrity-alg of the network section. โจ
Both mechanisms might deliver false positives if the user of DRBD modifies the data which gets written to disk while the transfer goes on. This may happen for swap, or for certain append while global sync, or truncate/rewrite workloads, and not necessarily poses 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 will not be part of an on disk data structure, or will 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 request 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 to use the data-integrity-alg only during a pre-production phase due to its CPU costs. Further we suggest to do online verify runs regularly e.g. once a month during a low load period. ๐ธ
๐ VERSION ๐
This document was revised for version 8.4.0 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)drbdsetup(8)drbdmeta(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 the whole DRBD.CONF(5) vibe, bestie! This page is from DRBD 8.4.0, dated 6 May 2011, and it's the DRBD.CONF(5) man page. Stay slay, keep your data consistent, and may your resyncs always be quick. ๐โจ
๐ฆ 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