man drbdsetup (Administration système) - Setup tool for DRBD


drbdsetup - Setup tool for DRBD


drbdsetup device disk lower_dev meta_data_dev meta_data_index [ -d size ] [ -e err_handler ]

drbdsetup device net local_addr [ :port ] remote_addr [ :port ] protocol [ -c time ] [ -i time ] [ -t val ] [ -S size ] [ -k count ] [ -d discon_handler ]

drbdsetup device syncer [ -k ] [ -g group ] [ -r rate ] [ -e extents ]

drbdsetup device disconnect

drbdsetup device detach

drbdsetup device down

drbdsetup device primary [ -h ] [ -t ] [ -d ]

drbdsetup device secondary

drbdsetup device on_primary [ -h ] [ -t ]

drbdsetup device invalidate

drbdsetup device invalidate_remote

drbdsetup device wait_connect [ -t wfc_timeout ] [ -d degr_wfc_timeout ]

drbdsetup device wait_sync [ -t wfc_timeout ] [ -d degr_wfc_timeout ]

drbdsetup device state

drbdsetup device cstate

drbdsetup device resize [ -d size ]

drbdsetup device show


drbdsetup is used to associate DRBD devices with their lower level block devices, to set up DRBD device pairs to mirror their lower level block devices, and to inspect the configuration of running DRBD devices.


drbdsetup is a low level tool of the DRBD program suite. It is used by the datadisk and drbd scripts to communicate with the device driver.


Each drbdsetup sub-command might require arguments and bring its own set of options. All values have default units which might be overruled by K, M or G. These units are defined in the usual way (e.g. K = 2^10 = 1024).


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

-d, --disk-size size
You can override DRBD's size determination method with this option. If you need to use the device before it was ever connected to its peer, use this option to pass the size of the DRBD device to the driver. Default unit is KB (1 KB = 1024 bytes).
-e, --on-io-error err_handler
If the driver of the lower_device reports an error to DRBD, DRBD will either pass the error to the upper layers of the operating system, panic the machine, or detaches the device from its backing storage and perform all futher IO by requesting it from the peer. The valid err_handler are: pass_on, panic and detach.


Sets up the device to listen on local_addr:port for incoming connections and to try to connect to remote_addr:port. If port is omitted, 7788 is used as default.

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.

-c, --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 tries. The default value is 10 seconds, the unit is 1 second.
-i, --ping-int time
If the TCP/IP connection linking a DRBD device pair is idle for more than time seconds, DRBD will generate a keep-alive packet to check if its partner is still alive. The default is 10 seconds, the unit is 1 second.
-t, --timeout val
If the partner node fails to send an expected response packet within val 10ths of a second, the partner node is considered dead and therefore the TCP/IP connection is abandoned. The default value is 60 = 6 seconds.
-S, --sndbuf-size size
The socket send buffer is used to store packets sent to the secondary node, which are not yet acknowledged (from a network point of view) by the secondary node. When using protocol A, it might be necessary to increase the size of this data structure in order to increase asynchronism between primary and secondary nodes. But keep in mind that more asynchronism is synonymous with more data loss in the case of a primary node failure. The default size is 128 KB. Default unit is KB.
-k, --ko-count count
In case the secondary node fails to complete a single write request for count times the timeout, it is expelled from the cluster. (I.e. the primary node goes into StandAlone mode.) The default is 0, which disables this feature.
-e, --max-epoch-size val
With this option the maximal number of write requests between two barriers is limited. Should be set to the same as --max-buffers . Values smaller then 100 can lead to degraded performace. The default is 2048.
-b, --max-buffers val
With this option the maximal number of buffer pages allocated by DRBD's receiver thread is limited. Should be set to the same as --max-epoch-size . Small values could lead to degraded performace. (Minimum 32) The default is 2048.
-d, --on-disconnect discon_handler
When the connection to the peer is lost, DRBD can either go into stand alone mode, try to reconnect to the peer or freeze all further IO requests (think of an NFS hard mount). The keywords are: stand_alone, reconnect and freeze_io. The default handler is reconnect.


Changes the synchronization daemon parameters of device at runtime. Not mentioned parameters will not be changed.

-r, --rate rate
To ensure 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 is 250 KB/sec, the default unit is KB/sec.
-k, --skip-sync
This option suppresses the automatic start of the resynchronization process, which is triggered as soon as two DRBD devices are connected.
-g, --sync-group group
Resynchronization of all devices in one group runs parallel. Groups are serialized in ascending order. You should avoid that devices which lower devices share one and the same physical disk sync in parallel. The default group is 0. I.e. per default all devices sync parallel.
-e, --al-extents extents
DRBD automatically performs hot area detection. With this parameter you control how big the hot area (=active set) can get. Each extent marks 4M of the backing storage. In case a primary node leaves the cluster unexpectedly the areas covered by the active set must be resynced upon rejoin 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 is 127. (Minimum: 7, Maximum: 3843)


Sets the device into primary state, 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 state is mirrored to the device in secondary state.

It is not possible to set both devices of a connected DRBD device pair to primary state.

-h, --human
Indicates that this state change was issued by an administrator and has at cluster restart time precedence over decisions made by other parties.
-t, --timeout-expired
Indicates that this state change was caused because a node did not showed up on cluster startup (The cluster started in degraded mode). At cluster restart this has precedence over decisions made by the cluster manager.
-d, --do-what-I-say
Becoming primary fails if the local replica is inconsistent. By using this option you can force it into primary state anyway. USE THIS OPTION ONLY IF YOU KNOW WHAT YOU ARE DOING.


Sets the device into secondary state. This operation fails as long as at least one application (or file system) has the device open for write access.

It is however, possible that both devices of a connected DRBD device pair are in secondary state.


This sets additional flags for the next transition into primary state. The flags are only preserved as long as the device can not connect to its peer. The possible flags are --inc-human and --inc-timeout-expired.

This is a conevenience command. It has the same effect as passing this options to the following primary command directly. See the primary command for a detailed description of the two flags.


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

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


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.


Returns as soon as the device can communicate with its partner device.

-t, --wfc-timeout wfc_timeout
-d, --degr-wfc-timeout degr_wfc_timeout
This command will fail if the device can not communicate with its partner for timeout seconds. If the peer was working before this node got rebootet, the wfc_timeout is used. If the peer was already down before this node got rebooted, the degr_wfc_timeout is used. The default value for wfc_timeout is 0 which means to wait forever. The default for degr_wfc_timeout is 120 seconds.


Returns as soon as the device leaves any synchronization state and returns into connected state. The options are the same as with the wait_connect command.


Removes the information set by the net command from the device. This means that the device goes into unconnected state and that it will no longer listen for incoming connections.


Removes the information set by the disk command from the device. This means that the device is detached from its backing storage device.


Removes all configuration information from the device and forces it back to unconfigured state.


Shows the current states of the device and its peer. (local/peer).


Shows the current connection states of the device.


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 both nodes.


Shows all available configuration information of the device.


For examples please have a look at the DRBD Quickstart Guide <URL:>.


This document is correct for version 0.7.15 of the DRBD distribution.


Written by Philipp Reisner <>.


Report bugs to <>.


Copyright (c) 2001-2005 Philipp Reisner. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


drbd.conf(5), drbd(8), drbddisk(8) drbdadm(8) DRBD Homepage <URL:>