drbdsetup

Langue: en

Version: 27 March 2009 (debian - 07/07/09)

Section: 8 (Commandes administrateur)

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 ]

drbdsetup device net [ af: ] local_addr [ :port ] [ af: ] remote_addr [ :port ] protocol [ -c time ] [ -i time ] [ -t val ] [ -S 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 ]

drbdsetup device syncer [ -a dev_minor ] [ -r rate ] [ -e extents ] [ -v verify-hash-alg ] [ -c cpu-mask ] [ -C csums-hash-alg ]

drbdsetup device disconnect

drbdsetup device detach

drbdsetup device down

drbdsetup device primary [ -o ]

drbdsetup device secondary

drbdsetup device verify

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 ]

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
In case the specified DRBD device (minor number) does not exist yet, create it implicitly.
--set-defaults
When --set-defaults is given on the command line, all options of the invoked sub-command that are not explicitly set are reset to their default values.

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
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 sectors (1s = 512 bytes).

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
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, call a helper program, or detach the device from its backing storage and perform all further IO by requesting it from the peer. The valid err_handlers are: pass_on, call-local-io-error and detach.
-f, --fencing fencing_policy
Under fencing we understand preventative 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 undertaken.
resource-only
If a node becomes a disconnected primary. it tries to outdate the peer's disk. This is done by calling the outdate-peer handler. The handler is supposed to reach the other node over alternative communication paths and call 'drbdadm outdate res' there.
resource-and-stonith
If a node becomes a disconnected primary, it freezes all its IO operations and calls its outdate-peer handler. The outdate-peer handler is supposed to reach the peer over alternative communication paths and call 'drbdadm outdate res' there. 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 the resume-io command.
-b, --use-bmbv
In case the backing storage's driver has a merge_bvec_fn() function, DRBD has to pretend that it can only process IO requests in units not lager than 4kByte. (At 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 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 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
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 battery-backed write cache you may go with option 3 or 4. Option 4 will deliver the best performance such devices.

Unfortunately device mapper (LVM) does 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
The first requirs 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 the we --no-disk-barrier option.
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 the --no-disk-flushes option.
drain
The third method is simply to let write requests drain before write requests of a new reordering domain are issued. That was the only implementation before 8.0.9. You can prevent to use of this method by using the --no-disk-drain option.
none
The fourth method is to not express write-after-write dependencies to the backing store at all.
-m, --no-md-flushes
Disables the use of disk flushes and barrier BIOs when accessing the meta data device. See the notes on --no-disk-flushes.
-s, --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's merge_bvec() function and which have more than one bvec. A known example is: phys-disk -> DRBD -> LVM -> Xen -> missaligned 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). Costs 480 KiByte 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 missaligned partitions. The second best workaround is to limit DRBD's max bvecs per BIO (= max-bio-bvecs) to 1. Might cost performance.

The default value of max-bio-bvecs is 0, which means that there is no user imposed limitation.

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 and sci for Dolphin Interconnect Solutions' "super sockets".

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 value 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 asynchronicity between primary and secondary nodes. But keep in mind that more asynchronicity is synonymous with more data loss in the case of a primary node failure. Since 8.0.13 resp. 8.2.7 setting the size value to 0 means that the kernel should autotune this. The default size is 128 KB, the 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 than 100 can lead to degraded performance. The default value 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 performance. (Minimum 32) The default value is 2048.
-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. Minimum 16, default 128, maximum 131072.
-m, --allow-two-primaries
With this option set you may assign primary role to both nodes. You only should use this option if you use a shared storage file system on top of DRBD. At the time of writing the only ones are: 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!
-a, --cram-hmac-alg alg
You need to specify the HMAC algorithm to enable peer authentication at all. You are strongly encouraged to use peer authentication. The HMAC algorithm will be used for the challenge response authentication of the peer. You may specify any digest algorithm that is named in /proc/crypto.
-x, --shared-secret secret
The shared secret used in peer authentication. May be up to 64 characters.
-A, --after-sb-0pri asb-0p-policy
possible policies are:
disconnect
No automatic resynchronization, simply disconnect.
discard-younger-primary
Auto sync from the node that was primary before the split-brain situation occurred.
discard-older-primary
Auto sync from the node that became primary as second during the split-brain situation.
discard-zero-changes
In case one node did not write anything since the split brain became evident, sync from the node that wrote something to the node that did not write anything. In case none wrote anything this policy uses a random decision to perform a "resync" of 0 blocks. In case both have written something this policy disconnects the nodes.
discard-least-changes
Auto sync from the node that touched more blocks during the split brain situation.
discard-node-NODENAME
Auto sync to the named node.
-B, --after-sb-1pri asb-1p-policy
possible policies are:
disconnect
No automatic resynchronization, simply disconnect.
consensus
Discard the version of the secondary if the outcome of the after-sb-0pri algorithm would also destroy the current secondary's data. Otherwise disconnect.
discard-secondary
Discard the secondary's version.
call-pri-lost-after-sb
Always honor the outcome of the after-sb-0pri algorithm. In case it decides the current secondary has the right data, call the pri-lost-after-sb on the current primary.
violently-as0p
Always honor the outcome of the after-sb-0pri algorithm. In case it decides the current secondary has the right data, accept a possible instantaneous change of the primary's data.
-C, --after-sb-2pri asb-2p-policy
possible policies are:
disconnect
No automatic resynchronization, simply disconnect.
call-pri-lost-after-sb
Always honor the outcome of the after-sb-0pri algorithm. In case it decides the current secondary has the right data, call the pri-lost-after-sb on the current primary.
violently-as0p
Always honor the outcome of the after-sb-0pri algorithm. In case it decides the current secondary has the right data, accept a possible instantaneous change of the primary's data.
-P, --always-asbp
Normally the automatic after-split-brain policies are only used if current states of the UUIDs do not indicate the presence of a third node.

With this option you request that the automatic after-split-brain policies are used as long as the data sets of the nodes are somehow related. This might cause a full sync, if the UUIDs indicate the presence of a third node. (Or double faults have led to strange UUID sets.)

-R, --rr-conflict role-resync-conflict-policy
This option sets DRBD's behavior when DRBD deduces from its meta data that a resynchronization is needed, and the SyncTarget node is already primary. The possible settings are: disconnect, call-pri-lost and violently. While disconnect speaks for itself, with the call-pri-lost setting the pri-lost handler is called which is expected to either change the role of the node to secondary, or remove the node from the cluster. The default is disconnect.

With the violently setting you allow DRBD to force a primary node into SyncTarget state. This means that with that action the data exposed by DRBD change 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
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.

See also the notes on data integrity on the drbd.conf manpage.

-o, --no-tcp-cork
DRBD usually uses the TCP socket option TCP_CORK to 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 lease one network stack that performs worse when one uses this hinting method. Therefore we introducted this option, which disable the setting and clearing of the TCP_CORK socket option by DRBD.
-p, --ping-timeout ping_timeout
The time the peer has to answer to a keep-alive packet. In case the peer's reply is not received within this time period, it is considered as dead. The default value is 500ms, the default unit is 100ms.
-D, --discard-my-data
Use this option to manually recover from a split-brain situation. In case you do not have any automatic after-split-brain policies selected, the nodes refuse to connect. By passing this option you make a node to sync target immediately after successful connect.

SYNCER

Changes the synchronization daemon parameters of device at runtime.

-r, --rate rate
To ensure smooth operation of the application on top of DRBD, it is possible to limit the bandwidth that may be used by background synchronization. The default is 250 KB/sec, the default unit is KB/sec.
-a, --after minor
Start resync on this device only if the device with minor is already in connected state. Otherwise this device waits in SyncPause state.
-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 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 is 127. (Minimum: 7, Maximum: 3843)
-v, --verify-alg hash-alg
During online verification (as initiated by the verify sub-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 of md5, sha1, and crc32c available. By default this is not enabled; you must set this option explicitly in order to be able to use on-line device verification.

See also the notes on data integrity on the drbd.conf manpage.

-c, --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 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.
-C, --csums-alg hash-alg
A resync process sends all marked data blocks form the source to the destination node, as long as no csums-alg is given. When one is specified the resync process exchanges hash values of all marked blocks first, and sends only those data blocks over, that have different hash values.

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.

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
Becoming primary fails if the local replica is inconsistent. By using this option you can force it into primary role anyway. USE THIS OPTION ONLY IF YOU KNOW WHAT YOU ARE DOING.

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.

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.

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 part of a connected device pair.

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.

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
This command will fail if the device cannot communicate with its partner for timeout seconds. If the peer was working before this node was rebooted, the wfc_timeout is used. If the peer was already down before this node was rebooted, the degr_wfc_timeout is used. If the peer was sucessfully outdated before this node was rebooted the outdated_wfc_timeout is used. The default value for all those timeout values is 0 which means to wait forever. In case the connection status goes down to StandAlone because the peer appeared but the devices had a split brain situation, the default for the command is to terminate. You can change this behavior with the --wait-after-sb option.

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.

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. (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. (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 one of your nodes.

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 outdate-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 outdate-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
Display the events of all DRBD minors.
-u, --unfiltered
This is a debugging aid that displays the content of all received netlink messages.

NEW-CURRENT-UUID

Generates a new currend UUID and rotates all other UUID values. This works on disconnected devices only, the device might be in primary or secondary role. Available option:

-c, --clear-bitmap
Clears the sync bitmap in addition to generating a new current UUID.

This can 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. The necessary steps are:

1.
drbdsetup device new-current-uuid --clear-bitmap
2.
Take the copy of the current active server. E.g. by pulling a disk out of the RAID1 controller, or by copying with dd. You need to copy the actual data, and the meta data.
3.
drbdsetup device new-current-uuid
4.
Add the disk to the new secondary node, and join it to the cluster. You will get a resync of that parts that where changed since the first call to drbdsetup in step 1.

EXAMPLES

For examples, please have a look at the DRBD User's Guide <URL:http://www.drbd.org/users-guide/>.

VERSION

This document was revised for version 8.2.7 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 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 <URL:http://www.drbd.org/users-guide/>, DRBD web site <URL:http://www.drbd.org/>