Configuring the DRBD Service

[Note]

The following procedure uses the server names node 1 and node 2, and the cluster resource name r0. It sets up node 1 as the primary node. Make sure to modify the instructions to use your own node and file names.

  1. Start YaST and select the configuration module Miscellaneous+drbd.

  2. In Start-up Configuration+Booting select On to start drbd always at boot time.

  3. If you need to configure more than one replicated resource, select Global Configuration. The input field Minor Count selects how many different drbd resources may be configured without restarting the computer.

  4. The actual configuration of the resource is done in Resource Configuration. Press Add to create a new resource. The following parameters have to be set:

    Resource Name

    The name of the resource, often called r0.

    Name

    The hostname of the respective node.

    Address:Port

    The IP address and port number of the respective node.

    Device

    The device that holds the replicated data on the respective node. Use this device to create file systems and mount operations.

    Disk

    The device that is replicated between both nodes.

    Meta-disk

    The Meta-disk is either set to the value internal or specifies an explicit device extended by an index to hold the meta data needed by drbd.

    When using internal, the last 128 MB of the replicated device are used to store the meta data.

    A real device may also be used for multiple drbd resources. For example, if your Meta-Disk is /dev/sda6[0] for the first resource, you may use /dev/sda6[1] for the second resource. However, there must be at least 128 MB space for each resource available on this disk.

    All of these options are explained in the examples in the /usr/share/doc/packages/drbd/drbd.conf file and in the man page of drbd.conf(5).

  5. Copy the /etc/drbd.conf file to the /etc/drbd.conf location on the secondary server (node 2).

    scp /etc/drbd.conf <node 2>:/etc
    
  6. Initialize and start the DRBD service on both systems by entering the following on each node:

    drbdadm create-md r0
    rcdrbd start
    
  7. Configure node1 as the primary node by entering the following on node1:

    drbdsetup /dev/drbd0 primary --overwrite-data-of-peer
    
  8. Check the DRBD service status by entering the following on each node:

    rcdrbd status
    

    Before proceeding, wait until the block devices on both nodes are fully synchronized. Repeat the rcdrbd status command to follow the synchronization progress.

  9. After the block devices on both nodes are fully synchronized, format the DRBD device on the primary with a file system such as reiserfs. Any Linux file system can be used. For example, enter

    mkfs.reiserfs -f /dev/drbd0 
    
    [Important]

    Always use the /dev/drbd<n> name in the command, not the actual /dev/disk device name.