DRBDSETUP(8) | System Administration | DRBDSETUP(8) |
NAME¶
drbdsetup - Setup tool for DRBD
SYNOPSIS¶
drbdsetup {device} disk {lower_dev} {meta_data_dev} {meta_data_index} [-d {size}] [-e {err_handler}] [-f {fencing_policy}] [-b] [-t {disk_timeout}]
drbdsetup {device} net [af:] {local_addr} [:port] [af:] {remote_addr} [:port] {protocol} [-c {time}] [-i {time}] [-t {val}] [-S {size}] [-r {size}] [-k {count}] [-e {max_epoch_size}] [-b {max_buffers}] [-m] [-a {hash_alg}] [-x {shared_secret}] [-A {asb-0p-policy}] [-B {asb-1p-policy}] [-C {asb-2p-policy}] [-D] [-R {role-resync-conflict-policy}] [-p {ping_timeout}] [-u {val}] [-d {hash_alg}] [-o] [-n] [-g {congestion_policy}] [-f {val}] [-h {val}]
drbdsetup {device} syncer [-a {dev_minor}] [-r {rate}] [-e {extents}] [-v {verify-hash-alg}] [-c {cpu-mask}] [-C {csums-hash-alg}] [-R] [-p {plan_time}] [-s {fill_target}] [-d {delay_target}] [-m {max_rate}] [-n {ond-policy}]
drbdsetup {device} disconnect
drbdsetup {device} detach [-f]
drbdsetup {device} down
drbdsetup {device} primary [-f] [-o]
drbdsetup {device} secondary
drbdsetup {device} verify [-s {start-position}] [-S {stop-position}]
drbdsetup {device} invalidate
drbdsetup {device} invalidate-remote
drbdsetup {device} wait-connect [-t {wfc_timeout}] [-d {degr_wfc_timeout}] [-o {outdated_wfc_timeout}] [-w]
drbdsetup {device} wait-sync [-t {wfc_timeout}] [-d {degr_wfc_timeout}] [-o {outdated_wfc_timeout}] [-w]
drbdsetup {device} role
drbdsetup {device} cstate
drbdsetup {device} dstate
drbdsetup {device} status
drbdsetup {device} resize [-d {size}] [-f {assume-peer-has-space}] [-c {assume-clean}]
drbdsetup {device} check-resize
drbdsetup {device} pause-sync
drbdsetup {device} resume-sync
drbdsetup {device} outdate
drbdsetup {device} show-gi
drbdsetup {device} get-gi
drbdsetup {device} show
drbdsetup {device} suspend-io
drbdsetup {device} resume-io
drbdsetup {device} events [-u] [-a]
drbdsetup {device} new-current-uuid [-c]
DESCRIPTION¶
drbdsetup is used to associate DRBD devices with their backing block devices, to set up DRBD device pairs to mirror their backing block devices, and to inspect the configuration of running DRBD devices.
NOTE¶
drbdsetup is a low level tool of the DRBD program suite. It is used by the data disk and drbd scripts to communicate with the device driver.
COMMANDS¶
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).
Common options¶
All drbdsetup sub-commands accept these two options
--create-device
--set-defaults
disk¶
Associates device with lower_device to store its data blocks on. The -d (or --disk-size) should only be used if you wish not to use as much as possible from the backing block devices. If you do not use -d, the device is only ready for use as soon as it was connected to its peer once. (See the net command.)
-d, --disk-size size
If you use the size parameter in drbd.conf, we strongly recommend to add an explicit unit postfix. drbdadm and drbdsetup used to have mismatching default units.
-e, --on-io-error err_handler
-f, --fencing fencing_policy
Valid fencing policies are:
dont-care
resource-only
resource-and-stonith
-b, --use-bmbv
To get best performance out of DRBD on top of software raid (or any other driver with a merge_bvec_fn() function) you might enable this option, if you know for sure that the merge_bvec_fn() function will deliver the same results on all nodes of your cluster. I.e. the physical disks of the software raid are exactly of the same type. USE THIS OPTION ONLY IF YOU KNOW WHAT YOU ARE DOING.
-a, --no-disk-barrier, -i, --no-disk-flushes, -D, --no-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 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 with method is currently in use for a device: b, f, d, n. The implementations:
barrier
flush
drain
none
-m, --no-md-flushes
-s, --max-bio-bvecs
The best workaround is to proper align the partition within the VM (E.g. start it at sector 1024). That costs 480 KiB of storage. Unfortunately the default of most Linux partitioning tools is to start the first partition at an odd number (63). Therefore most distributions install helpers for virtual linux machines will end up with missaligned partitions. The second best workaround is to limit DRBD's max bvecs per BIO (i.e., the max-bio-bvecs option) to 1, but that might cost performance.
The default value of max-bio-bvecs is 0, which means that there is no user imposed limitation.
-t, --disk-timeout disk_timeout
The default value of disk-timeout is 0, which means that no timeout is enforced. The default unit is 100ms. This option is available since 8.3.12.
net¶
Sets up the device to listen on af:local_addr:port for incoming connections and to try to connect to af:remote_addr:port. If port is omitted, 7788 is used as default. If af is omitted ipv4 gets used. Other supported address families are ipv6, ssocks for Dolphin Interconnect Solutions' "super sockets" and sdp for Sockets Direct Protocol (Infiniband).
On the TCP/IP link the 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
-i, --ping-int time
-t, --timeout val
-S, --sndbuf-size size
-r, --rcvbuf-size size
-k, --ko-count count
-e, --max-epoch-size val
-b, --max-buffers val
See also drbd.conf(5)
-u, --unplug-watermark val
When the number of pending write requests on the standby (secondary) node exceeds the unplug-watermark, we trigger the request processing of our backing storage device. Some storage controllers deliver better performance with small values, others deliver best performance when the value is set to the same value as max-buffers, yet others don't feel much effect at all. Minimum 16, default 128, maximum 131072.
-m, --allow-two-primaries
-a, --cram-hmac-alg alg
-x, --shared-secret secret
-A, --after-sb-0pri asb-0p-policy
disconnect
discard-younger-primary
discard-older-primary
discard-zero-changes
discard-least-changes
discard-node-NODENAME
-B, --after-sb-1pri asb-1p-policy
disconnect
consensus
discard-secondary
call-pri-lost-after-sb
violently-as0p
-C, --after-sb-2pri asb-2p-policy
disconnect
call-pri-lost-after-sb
violently-as0p
-P, --always-asbp
With this option you request that the automatic after-split-brain policies are used as long as the data sets of the nodes are somehow related. This might cause a full sync, if the UUIDs indicate the presence of a third node. (Or double faults have led to strange UUID sets.)
-R, --rr-conflict role-resync-conflict-policy
With the violently setting you allow DRBD to force a primary node into SyncTarget state. This means that the data exposed by DRBD changes to the SyncSource's version of the data instantaneously. USE THIS OPTION ONLY IF YOU KNOW WHAT YOU ARE DOING.
-d, --data-integrity-alg hash_alg
See also the notes on data integrity on the drbd.conf manpage.
-o, --no-tcp-cork
-p, --ping-timeout ping_timeout
-D, --discard-my-data
-n, --dry-run
-g, --on-congestion congestion_policy, -f, --congestion-fill fill_threshold, -h, --congestion-extents active_extents_threshold
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.
Available congestion_policys are block and pull-ahead. The default is block. Fill_threshold might be in the range of 0 to 10GiBytes. The default is 0 which disables the check. Active_extents_threshold has the same limits as al-extents.
The AHEAD/BEHIND mode and its settings are available since DRBD 8.3.10.
syncer¶
Changes the synchronization daemon parameters of device at runtime.
-r, --rate rate
-a, --after minor
-e, --al-extents extents
-v, --verify-alg hash-alg
See also the notes on data integrity on the drbd.conf manpage.
-c, --cpu-mask cpu-mask
-C, --csums-alg hash-alg
This setting is useful 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, therefore using csums-alg will lower the required bandwidth in exchange for CPU cycles.
-R, --use-rle
Because the bitmap typically contains compact areas where all bits are unset (clean) or set (dirty), a simple run-length encoding scheme can considerably reduce the network traffic necessary for the bitmap exchange.
For backward compatibilty reasons, and because on fast links this possibly does not improve transfer time but consumes cpu cycles, this defaults to off.
Introduced in 8.3.2.
-p, --c-plan-ahead plan_time, -s, --c-fill-target fill_target, -d, --c-delay-target delay_target, -M, --c-max-rate max_rate
By plan_time the agility of the controller is configured. Higher values yield for 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.
-m, --c-min-rate min_rate
The default value of min_rate is 4M, the default unit is k. If you want to not throttle at all, set it to zero, if you want to throttle always, set it to one.
-n, --on-no-data-accessible ond-policy
If ond-policy is set to suspend-io you can either resume IO by attaching/connecting the last lost data storage, or by the drbdadm resume-io res command. The latter will result in IO errors of course.
The default is io-error. This setting is available since DRBD 8.3.9.
primary¶
Sets the device into primary role. This means that applications (e.g. a file system) may open the device for read and write access. Data written to the device in primary role are mirrored to the device in secondary role.
Normally it is not possible to set both devices of a connected DRBD device pair to primary role. By using the --allow-two-primaries option, you override this behavior and instruct DRBD to allow two primaries.
-o, --overwrite-data-of-peer
-f, --force
secondary¶
Brings the device into secondary role. This operation fails as long as at least one application (or file system) has opened the device.
It is possible that both devices of a connected DRBD device pair are secondary.
verify¶
This initiates on-line device verification. During on-line verification, the contents of every block on the local node are compared to those on the peer node. Device verification progress can be monitored via /proc/drbd. Any blocks whose content differs from that of the corresponding block on the peer node will be marked out-of-sync in DRBD's on-disk bitmap; they are not brought back in sync automatically. To do that, simply disconnect and reconnect the resource.
If on-line verification is already in progress (and this node is "VerifyS"), this command silently "succeeds". In this case, any start-sector (see below) will be ignored, and any stop-sector (see below) will be honored. This can be used to stop a running verify, or to update/shorten/extend the coverage of the currently running verify.
This command will fail if the device is not part of a connected device pair.
See also the notes on data integrity on the drbd.conf manpage.
-s, --start start-sector
Default unit is sectors. You may also specify a unit explicitly. The start-sector will be rounded down to a multiple of 8 sectors (4kB).
-S, --stop stop-sector
Default unit is sectors. You may also specify a unit explicitly. The stop-sector may be updated by issuing an additional drbdsetup verify command on the same node while the verify is running.
invalidate¶
This forces the local device of a pair of connected DRBD devices into SyncTarget state, which means that all data blocks of the device are copied over from the peer.
This command will fail if the device is not either part of a connected device pair, or disconnected Secondary.
invalidate-remote¶
This forces the local device of a pair of connected DRBD devices into SyncSource state, which means that all data blocks of the device are copied to the peer.
On a disconnected Primary device, this will set all bits in the out of sync bitmap. As a side affect this suspends updates to the on disk activity log. Updates to the on disk activity log resume automatically when necessary.
wait-connect¶
Returns as soon as the device can communicate with its partner device.
-t, --wfc-timeout wfc_timeout, -d, --degr-wfc-timeout degr_wfc_timeout, -o, --outdated-wfc-timeout outdated_wfc_timeout, -w, --wait-after-sb
wait-sync¶
Returns as soon as the device leaves any synchronization into connected state. The options are the same as with the wait-connect command.
disconnect¶
Removes the information set by the net command from the device. This means that the device goes into unconnected state and will no longer listen for incoming connections.
detach¶
Removes the information set by the disk command from the device. This means that the device is detached from its backing storage device.
-f, --force
On the other hand A forced detach returns immediately. It allows you to detach DRBD from a frozen backing block device. Please note that the disk will be marked as failed until all pending IO requests where finished by the backing block device.
down¶
Removes all configuration information from the device and forces it back to unconfigured state.
role¶
Shows the current roles of the device and its peer, as local/peer.
state¶
Deprecated alias for "role"
cstate¶
Shows the current connection state of the device.
dstate¶
Shows the current states of the backing storage devices, as local/peer.
status¶
Shows the current status of the device in XML-like format. Example output:
<resource minor="0" name="s0" cs="SyncTarget" st1="Secondary" st2="Secondary"
ds1="Inconsistent" ds2="UpToDate" resynced_precent="5.9" />
resize¶
This causes DRBD to reexamine the size of the device's backing storage device. To actually do online growing you need to extend the backing storages on both devices and call the resize command on one of your nodes.
The --assume-peer-has-space allows you to resize a device which is currently not connected to the peer. Use with care, since if you do not resize the peer's disk as well, further connect attempts of the two will fail.
When the --assume-clean option is given DRBD will skip the resync of the new storage. Only do this if you know that the new storage was initialized to the same content by other means.
check-resize¶
To enable DRBD to detect offline resizing of backing devices this command may be used to record the current size of backing devices. The size is stored in files in /var/lib/drbd/ named drbd-minor-??.lkbd
This command is called by drbdadm resize res after drbdsetup device resize returned.
pause-sync¶
Temporarily suspend an ongoing resynchronization by setting the local pause flag. Resync only progresses if neither the local nor the remote pause flag is set. It might be desirable to postpone DRBD's resynchronization after eventual resynchronization of the backing storage's RAID setup.
resume-sync¶
Unset the local sync pause flag.
outdate¶
Mark the data on the local backing storage as outdated. An outdated device refuses to become primary. This is used in conjunction with fencing and by the peer's fence-peer handler.
show-gi¶
Displays the device's data generation identifiers verbosely.
get-gi¶
Displays the device's data generation identifiers.
show¶
Shows all available configuration information of the device.
suspend-io¶
This command is of no apparent use and just provided for the sake of completeness.
resume-io¶
If the fence-peer handler fails to stonith the peer node, and your fencing policy is set to resource-and-stonith, you can unfreeze IO operations with this command.
events¶
Displays every state change of DRBD and all calls to helper programs. This might be used to get notified of DRBD's state changes by piping the output to another program.
-a, --all-devices
-u, --unfiltered
new-current-uuid¶
Generates a new current UUID and rotates all other UUID values. This has at least two use cases, namely to skip the initial sync, and to reduce network bandwidth when starting in a single node configuration and then later (re-)integrating a remote site.
Available option:
-c, --clear-bitmap
This can be used to skip the initial sync, if you want to start from scratch. This use-case does only work on "Just Created" meta data. Necessary steps:
drbdadm -- --force create-md res
drbdadm up res
drbdadm -- --clear-bitmap new-current-uuid res
drbdadm primary res
mkfs -t fs-type $(drbdadm sh-dev res)
One obvious side-effect is that the replica is full of old garbage (unless you made them identical using other means), so any online-verify is expected to find any number of out-of-sync blocks.
You must not use this on pre-existing data! Even though it may appear to work at first glance, once you switch to the other node, your data is toast, as it never got replicated. So do not leave out the mkfs (or equivalent).
This can also be used to shorten the initial resync of a cluster where the second node is added after the first node is gone into production, by means of disk shipping. This use-case works on disconnected devices only, the device may be in primary or secondary role.
The necessary steps on the current active server are:
Now add the disk to the new secondary node, and join it to the cluster. You will get a resync of that parts that were changed since the first call to drbdsetup in step 1.
EXAMPLES¶
For examples, please have a look at the DRBD User's Guide[1].
VERSION¶
This document was revised for version 8.3.2 of the DRBD distribution.
AUTHOR¶
Written by Philipp Reisner <philipp.reisner@linbit.com> and Lars Ellenberg <lars.ellenberg@linbit.com>
REPORTING BUGS¶
Report bugs to <drbd-user@lists.linbit.com>.
COPYRIGHT¶
Copyright 2001-2008 LINBIT Information Technologies, Philipp Reisner, Lars Ellenberg. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SEE ALSO¶
drbd.conf(5), drbd(8), drbddisk(8), drbdadm(8), DRBD User's Guide[1], DRBD web site[2]
NOTES¶
- 1.
- DRBD User's Guide
- 2.
- DRBD web site
5 Dec 2008 | DRBD 8.3.2 |