[DRBD-user] meta-disk

Diego Julian Remolina diego.remolina at ibb.gatech.edu
Thu Jan 5 17:49:54 CET 2006

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


It sounds like you are trying to use drbd to replicate all partitions from one computer to other. 
You cannot replicate /boot or / on two systems with drbd, it just does not work that way. Specially 
because at this point, with drbd 0.7.X you cannot have both master and slave have the drbd 
partitions mounted, not even read only. So if one node had / mounted, the slave would not be able to 
have it mounted too.

You need at least 3 partitions to use drbd if you use no swap and metadata internal and at least 5 
partitions (6 if you count the extended) if you want swap and external metadata. For example:

/dev/hda1	101MB	/boot
/dev/hda2	10240MB	/
/dev/hda3	1024MB	(reserved for metadata for up to 8 drbd devices )
/dev/hda4	This is the extended partition
/dev/hda5	1024MB	swap (adjust to match your needs)
/dev/hda6	FREE	to be used for drbd

You do the same on both systems, then you configure drbd for partition /dev/hda6 and you put the 
metadata in /dev/hda3 [0].

Lets say you want this machines to be your file server with either nfs or samba.  So when you create 
/dev/drbd0 then you mount that on say /export

You then create /export/home and then you delete the /home directory from both systems and create a 
symbolic link:
cd / && ln -s /export/home .

Then if you use samba or nfs to export things in /home then whichever system is master will have the 
filesystem mounted and on the other system /home will just be a broken link.  This is because drbd 
cannot mount the filesystem, not even read only on both primary and secondary.

Some server software can be configured to read things from your drbd partitions.  Some others cannot 
do it that way, so you just create symbolic links.  For example with samba, I created 
/export/etc/samba (remember export is my drbd partition mounted).  Then since samba look from the 
configuration file in /etc/samba, I did:

cp -rp /etc/samba /export/etc/
mv /etc/samba /etc/samba.orig
cd /etc
ln -s /export/etc/samba .

In your secondary if the drbd partition is not mounted you do:

cd /etc
ln -sf /export/etc/samba .

I use RHEL4, and this distro provides with /etc/sysconfig where some configuration files are stored. 
  So for example for apache, I do not create a link for /etc/httpd, but I rather copy everything to
/export/etc/httpd and then in /etc/sysconfig/httpd I add the following configuration variable:

OPTIONS="-f /export/etc/httpd/conf/httpd.conf"

So now when apache gets started from /etc/init.d/httpd it will actually look for its config file in:
/export/etc/httpd/conf/httpd.conf rather than /etc/httpd/conf/httpd.conf

Hope this helps explain things a little bit.

I think you need to try to read and understand how drbd works because you seem to be trying to use 
it in a way in which it will not work.

Diego

Chip Burke wrote:
> Exactly. I was trying to replicate /boot with 'meta-data internal' which
> would cause it to die being that the space wasn't available. I am slowly
> getting my head around the whole process.
> 
> However, I can't seem to mount the drbd device. I edited my fstab from 
> 
> /dev/hda2 / ext3 defaults 1 1
> 
> to 
> 
> /dev/drbd0 / ext3 defaults 1 1
> 
> and it does not like it. When I try to start drbd manually using 'service
> brbd start' or 'drbdadm up all', I get an error that /dev/hda2 is already
> mounted. So I am a bit confused as to how to actually mount the /dev/drbdx
> device. Essentially I want the root file system to be identical between two
> boxes for a failover situation. Am I headed in the right direction?
> 
> Thanks again for everyone's help. Once I am done with this, I am very
> tempted to write a new HowTo for real novices such as myself.
> 
> 
> ________________________________________
> Chip Burke
> ________________________________________
> 
> 
> -----Original Message-----
> From: Clive Eisen [mailto:clive at serendipita.com] 
> Sent: Thursday, January 05, 2006 9:03 AM
> To: cburke at innova-partners.com
> Cc: drbd-user at lists.linbit.com
> Subject: Re: [DRBD-user] meta-disk
> 
> Only if you told drbd to put the meta data on /boot
> 
> Not A Good Idea (tm).
> 
> Yes you mount the /dev/drbdx devices
> 
> If you are using linux-ha, you allow that to do the mounting.
> --
> Clive
> 
> Chip Burke wrote:
> 
> 
>>Thank you very much for the very complete answer. I think I know what the
>>issue is then. I have a separate /boot partition and it is only 100MB. The
>>fact that it is only 100MB would not allow a 128MB file to be created. That
>>makes sense. 
>>
>>My next question is, after read the linux-ha docs, it hints at this, but is
>>not very explicit... In fstab am I to mount the new /dev/drbdx devices that
>>are created instead of the normal /dev/hdx devices? 
>>
>>Thank you so much for your help,
>>
>>________________________________________
>>Chip Burke
>>________________________________________
>>
>>
>>-----Original Message-----
>>From: drbd-user-bounces at lists.linbit.com
>>[mailto:drbd-user-bounces at lists.linbit.com] On Behalf Of Chris Procter
>>Sent: Thursday, January 05, 2006 6:00 AM
>>To: drbd-user at linbit.com
>>Subject: Re: [DRBD-user] meta-disk
>>
>>On Wednesday 04 January 2006 20:07, Chip Burke wrote:
>>
>> 
>>
>>
>>>I think I am missing something very basic. Do I need to create a partition
>>>on the system specifically for the meta-data or something else? I have
>>>   
>>>
>>
>>read
>> 
>>
>>
>>>the drbd.conf notes about 10 times and I really don't understand what they
>>>mean.
>>>   
>>>
>>
>>As with all good questions the answer is "it depends".
>>
>>DRBD needs to store 128MB of metadata some where on the system to store the
> 
> 
>>list of which blocks have changed (its stored on disk so it persists across
> 
> 
>>reboots). This metadata can be stored in one of two places.
>>
>>It can be stored on the partition you are replicating (termed "internal" 
>>metadata) in which case it basically takes over the last 128MB of the 
>>partition, reducing the space you have to store data in and overwriting and
> 
> 
>>data that is already stored there. This is good if you are starting fresh
>>and 
>>can overwrite the diskspace without risking the data or dont have room to 
>>create a separate partition. 
>>For this you put:
>>meta-disk internal;
>>in the drbd.conf for each machine (the "on [hostname]" section).
>>
>>Alternatively you can store the metadata on a separate partition
> 
> ("external"
> 
>>metadata) in which case (obviously) you need to create a partition to use. 
>>This partition needs to be at least 128MB for each DRBD device you are
> 
> using
> 
>>and is setup in the drbd.conf file as: 
>>meta-disk [devicename] [[offset]];
>>e.g.
>>meta-disk /dev/hde5 [0];
>>
>>The number in brackets is an offset within the partition, so the above will
> 
> 
>>use the first 128MB of the /dev/hde5 partion to store meta data, you could 
>>then set up another drbd device (/dev/drbd1 say) with 
>>meta-disk /dev/hde5 [1];
>>which would use the second 128MB (obviously the partition would need to be
>>at 
>>least 256MB in size). You would then have the meta data for /dev/drbd0 in 
>>0-127MB and for /dev/drbd1 in 128-256MB on /dev/hde5
>>
>>There are probably performance reasons for using one over the other, and
>>there 
>>are certainly issues with diskspace (if you dont have space to create a 
>>seperate partion the internal is the way forward for example). In theory
> 
> you
> 
>>could configure drbd to use internal metadata on one machine and external
>>for 
>>the same device on the other machine. If you do this however you're on your
> 
> 
>>own :-)
>>
>>Your error message implies that the meta-disk you are using is less then
>>128MB 
>>in size. I'm not sure if it defaults to something if you dont define it in 
>>drbd.conf so its worth checking to make sure it is explicitly defined to 
>>something sensible.
>>
>>Thats the way I understand it anyway, hope it helps.
>>
>>chris
>>_______________________________________________
>>drbd-user mailing list
>>drbd-user at lists.linbit.com
>>http://lists.linbit.com/mailman/listinfo/drbd-user
>>
>>
>>_______________________________________________
>>drbd-user mailing list
>>drbd-user at lists.linbit.com
>>http://lists.linbit.com/mailman/listinfo/drbd-user
>> 
>>
> 
> 
> 
> 
> _______________________________________________
> drbd-user mailing list
> drbd-user at lists.linbit.com
> http://lists.linbit.com/mailman/listinfo/drbd-user



More information about the drbd-user mailing list