[CentOS] centos drbd - mounts/ replication

Fri Jun 29 00:15:47 UTC 2007
Karl R. Balsmeier <karl at klxsystems.net>

Hi,

I would normally post this to the drbd list but it so low traffic/low 
volume (plus Austria might be asleep right now) I figured i'd ask 
someone here in case they have gotten drbd working on centos.  Right now 
my system says i'm only the 971st person to even install it...  It's 
been out for years, so likely this just means version 8.  But you'll 
only see a couple of posts a day on there so far.

Here's a "HOWTO" for getting things to a point where you can experiment 
carefully with the mounting procedures, which is where the mystery comes 
into view for the uninitiated <so don't follow it for production just 
yet, it's under construction for eventual use by the Wiki if we can 
answer some questions>:

Install Centos 5

during install make a filesystem called /drbd-netblock and give it 1GB and it shows up as /dev/sda7

yum install drbd kmod-drbd

edit /etc/grub.conf to allow boot of the drbd kernel 2.6.18-8.1.6.el5 #1 SMP

reboot, the proper kernel should now be up.

modprobe drbd

umount /drbd-netblock filesystem so drbd can use it:

umount /drbd-netblock

edit /etc/drbd.conf  /dev/sda7 is a 1GB filesystem I made during install called /drbd-netblock
#############
global { usage-count yes; }
      common { syncer { rate 10M; } }
      resource r0 {
           protocol C;
           net {
                cram-hmac-alg sha1;
                shared-secret "secretphrase";
           }
           on box1.mydomain.com {
                device    /dev/drbd1;
                disk      /dev/sda7;
                address   192.168.1.2:7789;
                meta-disk  internal;
           }
           on box2.mydomain.com {
                device    /dev/drbd1;
                disk      /dev/sda7;
                address   192.168.1.3:7789;
                meta-disk  internal;
           }
      }
##############

drbdadm create-md r0    # Is this done on just the primary or both?  I did it on both.

drbdadm up all

you'll see:

[root@ ~]# ps ax | grep drbd
18063 ?        S      0:00 [drbd1_worker]
18069 ?        S      0:00 [drbd1_receiver]
18070 ?        S      0:00 [drbd1_asender]

cat /proc/drbd will show both in secondary, as the drbd website howto shows, and you can promote a node to primary:

drbdadm -- --overwrite-data-of-peer primary all

[root@ ~]# cat /proc/drbd
version: 8.0.3 (api:86/proto:86)
SVN Revision: 2881 build by buildsvn at c5-x8664-build, 2007-05-23 14:07:33

 1: cs:Connected st:Primary/Secondary ds:UpToDate/UpToDate C r---
    ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0
        resync: used:0/31 hits:0 misses:0 starving:0 dirty:0 changed:0

My question is, when the howto says "The device is usable right away, go ahead and create a filesystem if you haven't already", what do they mean?  

What are the following steps to get replication working?

I also made myself a 40GB partition called /replicated  just in case I wanted to use that.

How does the "device" statement in the .conf file (device /dev/drbd1;) relate to any actual filesystem element?  None right, it's just a name you give your netblock correct?

Is the "disk" statement (disk /dev/sda7;) referring to my 1GB filesystem space I created, that's what I should put right?  

When you do the mount, are you doing "mount /dev/drbd1 /drbd-netblock1" or "mount /dev/drbd1 /replicated" ?

I figure someone here in the Centos crowd will have an answer(s) so we can create a Wiki HOWTO for this.   :-) 
       
-krb