Sei sulla pagina 1di 3

DRBD�Quick�Command�Reference

Martin Loschwitz <martin.loschwitz@linbit.com>


Edited by Florian Haas
v1.0, Sep 2010
Copyright © 2010, 2011 LINBIT HA-Solutions GmbH

Trademark notice
DRBD® and LINBIT® are trademarks or registered trademarks of LINBIT in Austria, the United States, and other
countries. Other names mentioned in this document may be trademarks or registered trademarks of their respective
owners.

License information
The text and illustrations in this document are licensed under a Creative Commons Attribution-NonCommercial-
NoDerivs 3.0 Unported license ("CC BY-NC-ND").

• A summary of CC BY-NC-ND is available at http://creativecommons.org/licenses/by-nc-nd/3.0/.

• The full license text is available at http://creativecommons.org/licenses/by-nc-nd/3.0/legalcode.

• In accordance with CC BY-NC-ND, if you distribute this document, you must provide the URL for the original version.

1. Initializing a DRBD resource ....................................................................................... 1


2. Frequently used drbdadm commands ........................................................................ 1
3. Advanced use of drbdadm ....................................................................................... 2
4. Gathering information on DRBD resources .................................................................. 2
5. DRBD Configuration ................................................................................................. 2
6. Manually resolving a split brain situation ..................................................................... 3
7. Interrupting the resynchronisation process .................................................................. 3
8. DRBD Proxy ............................................................................................................ 3

The following command reference aims to give you an overview over some of the most important
shell commands for manipulating DRBD resources.

1. Initializing�a�DRBD�resource
In order to create the DRBD meta-data for a given resource, use:

drbdadm create-md <resource>

In order to define the Primary node for a freshly created DRBD resource, and at the same time
kick off the initial full synchronization, use the following command:

drbdadm primary --force <resource>

Warning
This will cause DRBD to overwrite any data for this resource on the peer node.

2. Frequently�used�drbdadm�commands
To enable a DRBD resource on a host, use:

drbdadm up <resource>

To disable a DRBD resource, use the following command:

1
DRBD Quick Command Reference

drbdadm down <resource>

To switch a DRBD resource into primary mode, use:

drbdadm primary <resource>

To switch a DRBD resource into secondary mode, use:

drbdadm secondary <resource>

3. Advanced�use�of�drbdadm
To attach a resource to its backing device, use:

drbdadm attach <resource>

To detach DRBD from its backing device, use:

drbdadm detach <resource>

To enable a DRBD resource’s network connection, use:

drbdadm connect <resource>

To disable a DRBD resource’s network connection, use:

drbdadm disconnect <resource>

To resize a DRBD resource, use:

drbdadm --size=new-size <resource>

Warning
Shrinking requires you to follow the right order! See the Resizing resources chapter
in the DRBD User’s Guide.

4. Gathering�information�on�DRBD�resources
To gather information about existing DRBD resources via the /proc pseudo filesystem, use:

cat /proc/drbd

Table 1. Important acronyms in /proc/drbd


acronym meaning
cs connection state
ro role
ds disk state

A more concise overview is provided by drbd-overview.

5. DRBD�Configuration
To set the syncer rate for a specific DRBD resource on the fly, use:

drbdsetup <DRBD device> syncer -r <rate>

2
DRBD Quick Command Reference

To see the current live configuration of a resource, use:

drbdsetup <DRBD device> show

To adjust the configuration of a resource after having changed the configuration file, use:

drbdadm adjust <resource>

6. Manually�resolving�a�split�brain�situation
On the split brain victim, issue this command:

drbdadm connect --discard-my-data <resource>

Afterwards, issue the following command on the split brain survivor:

drbdadm connect <resource>

7. Interrupting�the�resynchronisation�process
To pause a currently running resynchronisation process, use:

drbdadm pause-sync <resource>

To resume that resynchronisation process later on, use:

drbdadm resume-sync <resource>

8. DRBD�Proxy
To list connections:

drbd-proxy-ctl -c "list hconnections"

To watch the proxy buffers (run on the Primary node):

watch -n1 'drbd-proxy-ctl -c "show memusage"'

Show currently configured communication paths:

drbd-proxy-ctl -c show

Potrebbero piacerti anche