[DRBD-user] Help with initial setup

kevin kempter kevin at kevinkempterllc.com
Thu Oct 9 21:59:53 CEST 2008

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


One more question:

If I setup a drbd filesystem and create/mount the filesystem on the  
primary, is the data in the filesystem available in a read-only mode  
on the slave/secondary ?


On Oct 9, 2008, at 9:57 AM, Mark Watts wrote:

>
> On Wednesday 08 October 2008 21:33:24 kevin kempter wrote:
>> Hi List;
>>
>> I'm a newbie to DRBD and I've hit a snag.
>>
>> Here's what I've done:
>>
>> 1) I setup 2 new installs of CentOS v5 (32bit) as VM's via vmware
>> server on a Dell 2900 (quad core, 16Gram, single RAID slice, etc)
>
> What I describe below is on CentOS 5.2, using the DRBD 8.0.13  
> packages from
> the CentOS Extras repository.
>
>> Note: I created /stage as a separate ext2 filesystem (mounted from /
>> dev/sda2). This is the filesystem I want to replicate with drbd
>
> There should be no filesystem on the raw partition(s) you want to  
> replicate.
> I'd unmount the partition(s) and erase the first few meg to be sure  
> DRBD
> thinks they're blank ("dd if=/dev/zero of=/dev/whatever bs=10M  
> count=1"
> should do it)
>
>>
>> 2) downloaded and compiled the drbd source (v 8.2.6) on both servers
>
> As an aside, DRBD 8.2.x is available via CentOS Extras, assuming  
> you're using
> the CenOS Plus kernel.
> DRBD 8.0.x is available for the default CentOS kernel from CentOS  
> Extras.
>
>> 4) edited my /etc/drbd.conf on both servers (VM's) to look like this:
>
> <snip>
>
>> resource r0 {
>>
>>   on CentOS-32-VM1 {
>>     device     /dev/drbd1;
>
> Traditionally you'd start with /dev/drbd0...
>
>>     disk       /dev/sda2;
>>     address    192.168.1.50:7788;
>>     meta-disk  internal;
>>   }
>>
>>   on CentOS-32-VM2 {
>>     device    /dev/drbd1;
>>     disk      /dev/sda2;
>>     address   192.168.1.51:7788;
>>     meta-disk internal;
>>   }
>> }
>>
>
> Missing step: initialise the resource:
>
> On both nodes, "drbdadm create-md r0"
>
>> 5) Installed the drbd module
>
> On both nodes, "service drbd start" will do this too.
> (See: http://www.drbd.org/docs/install/ )
>
>> 6) attempted to run drbdadm attach
>
> This is moot if you start the service instead.
> /proc/drbd on both nodes will show something like:
>
> version: 8.0.13 (api:86/proto:86)
> GIT-hash: ee3ad77563d2e87171a3da17cc002ddfd1677dbe build by
> buildsvn at c5-i386-build, 2008-08-07 13:40:24
> 0: cs:Connected st:Secondary/Secondary ds:Inconsistent/Inconsistent  
> 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/61 hits:0 misses:0 starving:0 dirty:0 changed:0
>        act_log: used:0/257 hits:0 misses:0 starving:0 dirty:0  
> changed:0
>
> At this point you need to tell DRBD which node is Primary. On your  
> prefered
> primary node:
>
> 	drbdadm -- --overwrite-data-of-peer primary r0
>
> /proc/drbd will now change to (during the sync it will show sync  
> progress):
>
> GIT-hash: ee3ad77563d2e87171a3da17cc002ddfd1677dbe build by
> buildsvn at c5-i386-build, 2008-08-07 13:40:24
> 0: cs:Connected st:Primary/Secondary ds:UpToDate/UpToDate C r---
>    ns:200736 nr:0 dw:0 dr:200736 al:0 bm:13 lo:0 pe:0 ua:0 ap:0
>        resync: used:0/61 hits:12533 misses:13 starving:0 dirty:0  
> changed:13
>        act_log: used:0/257 hits:0 misses:0 starving:0 dirty:0  
> changed:0
>
> Now you can create a filesystem:
>
> 	mke2fs -j /dev/drbd0
>
> Then mount it by hand to check:
>
> 	mkdir /mnt/drbd_r0
> 	mount /dev/drbd0 /mnt/drbd_r0
>
> Once you're happy this works, you'll want to use something like  
> heartbeat to
> deal with migrating/mounting the resource in the event of a failure.  
> The DRBD
> init script will put you into the Secondary/Secondary state;  
> heartbeat will
> control promoting to Primary and mounting:
>
> /etc/ha.d/haresources:
> node1.example.com  drbddisk::r0 Filesystem::/dev/drbd0::/mnt/ 
> drbd_r0::ext3
>
> Regards,
>
> Mark.
>
> -- 
> Mark Watts BSc RHCE MBCS
> Senior Systems Engineer
> QinetiQ Applied Technologies
> GPG Key: http://www.linux-corner.info/mwatts.gpg




More information about the drbd-user mailing list