Drbd Quick Reference

Embed Size (px)

Citation preview

  • 8/10/2019 Drbd Quick Reference

    1/3

    1

    DRBD Quick Command Reference

    Martin Loschwitz 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 othercountries. Other names mentioned in this document may be trademarks or registered trademarks of their respectiveowners.

    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 .. ......... ........ ........ ........ ........ ........ ........ ........ ........ ......... ... 12. Frequently used drbdadmcommands ....... ........ ......... ........ ........ ........ ........ ........ ........ 13. Advanced use of drbdadm ....................................................................................... 24. Gathering information on DRBD resources ... .... .... .... .... .... ... .... .... .... .... .... .... ... .... .... .... . 25. DRBD Configuration ............... ........ ........ ........ ........ ........ ........ ......... ........ ........ ........ . 26. Manually resolving a split brain situation .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ... .... .. 37. Interrupting the resynchronisation process ..... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... . 3

    8. DRBD Proxy ........ ........ ........ ........ ........ ........ ......... ........ ........ ........ ........ ........ ........ ... 3

    The following command reference aims to give you an overview over some of the most importantshell 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

    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 thefollowing command:

    drbdadm primary --force

    Warning

    This will cause DRBD to overwriteany data for this resource on the peer node.

    2. Frequently useddrbdadmcommands

    To enable a DRBD resource on a host, use:

    drbdadm up

    To disable a DRBD resource, use the following command:

    http://creativecommons.org/licenses/by-nc-nd/3.0/legalcodehttp://creativecommons.org/licenses/by-nc-nd/3.0/legalcodehttp://creativecommons.org/licenses/by-nc-nd/3.0/
  • 8/10/2019 Drbd Quick Reference

    2/3

    DRBD Quick Command Reference

    2

    drbdadm down

    To switch a DRBD resource into primary mode, use:

    drbdadm primary

    To switch a DRBD resource into secondary mode, use:

    drbdadm secondary

    3. Advanced use ofdrbdadm

    To attach a resource to its backing device, use:

    drbdadm attach

    To detach DRBD from its backing device, use:

    drbdadm detach

    To enable a DRBD resources network connection, use:

    drbdadm connect

    To disable a DRBD resources network connection, use:

    drbdadm disconnect

    To resize a DRBD resource, use:

    drbdadm --size=new-size

    Warning

    Shrinking requires you to follow the right order! See the Resizing resourceschapterin the DRBD Users Guide.

    4. Gathering information on DRBD resources

    To gather information about existing DRBD resources via the /procpseudo 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 bydrbd-overview.

    5. DRBD Configuration

    To set the syncer rate for a specific DRBD resource on the fly, use:

    drbdsetup syncer -r

  • 8/10/2019 Drbd Quick Reference

    3/3

    DRBD Quick Command Reference

    3

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

    drbdsetup show

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

    drbdadm adjust

    6. Manually resolving a split brain situation

    On the split brain victim, issue this command:

    drbdadm connect --discard-my-data

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

    drbdadm connect

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

    drbdadm pause-sync

    To resume that resynchronisation process later on, use:

    drbdadm resume-sync

    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