[DRBD-user] Using DRBD on existing system

Lars Ellenberg lars.ellenberg at linbit.com
Mon Feb 16 12:39:37 CET 2009

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


On Mon, Feb 16, 2009 at 11:15:33AM +0100, Hracek, Petr wrote:
> Hello all,
>  
> I would like to ask you on the general question about using DRBD.
>  
> I have already installed system (SLES10 SP1) where is used also database
> on the special 
> partition called /database.
> This partition is LVM2 partition.
> This partition is used by database engine MySQL.
>  
> Because of this partition is not replicated yet I would like to
> replicate them with DRBD software.
> Is it possible to configure DRBD so that /database partition will be
> used for database engine after DRBD configuration?
> I've made several tests and after configuration of DRBD /dev/drbd0 has
> been created for corresponding partition.
> /database partition has not been replicated online but /dev/drbd0  has
> been replicate.
> Could you please help me how to replicate already existing and used
> partitions?
> Is it neccessary to reconfigure MySQL database engine for using
> /dev/drbd0 or can I use the existing partition?

mini howto DRBD on existing file system

so I will never have to answer this question again ;)
please correct me, where I forgot to mention one step,
and add notes where I'm not detailed enough.

situation:
    existing server bob
    LVM2 volume /dev/some.vg/existing.data
    mounted to /some.mountpoint

desired:
    replicate this using DRBD to new server alice

todo:
    stop services accessing the existing data.

    umount /some.mountpoint

    add some space for DRBD meta data
    (~32 MiB per 1 TiB of storage)
    alternatives:
      - extend current LV:
	lvextend -L 32m some.vg/existing.data
      - add new LV for use as DRBD meta data store
	lvcreate -n existing.data-md -L some.vg -L 32m
      - leave the LV as is, but shrink (or recreate smaller)
	the existing file system. as you live on LV already,
	this is NOT recommended. both LV related methods are much
	more convenient.

   prepare the drbd.conf file
	(see www.drbd.org/docs/about)
	point it to
	disk /dev/some.vg/existing.data
	flexible-meta-disk internal;
	(or, flexible-meta-disk /dev/some.vg/exiting.data-md)

   create drbd meta data
	drbdadm create-md whatever-you-chose-your-resourcename-to-be


   next few steps are usually done by the drbd init script,
   but it won't hurt to do them step-by-step for the first setup.

   load drbd module: modprobe drbd
   attach drbd: drbdadm attach all
	cat /proc/drbd:
	StandAlone Secondary/Unknown Inconsistent/DUnknown

   force it to be primary here
   (because we know this is the existing data, right?)
   drbdadm -- --overwrite-data-of-peer primary all
	cat /proc/drbd:
	StandAlone Primary/Unknown UpToDate/DUnknown

   remove all references to /dev/some.vg/existing.data (e.g. fstab)
   mount drbd instead
	mount /dev/drbdX /some.mountpoint
	(noatime recommended!)

   repeat.
    !!! DO NOT mount or access /dev/some.vg/exitings.data anymore.
    !!! ONLY use /dev/drbdX from now on.

   prepare new server alice
	copy drbd.conf there,
	create backend lv, create meta data lv if wanted,
	initialize meta data,
		drbdadm create-md
	load drbd module,
		modprobe drbd
	attach drbd, apply syncer config, try to contact peer
		drbdadm adjust all


   back on bob, tell drbd to talk to alice
	drbdadm adjust all

   verify in /proc/drbd that they now connect and do an initial full sync.

   wait for this sync to finish.
   manually do a switchover
	stop services on one server, unmount, make it secondary
	make other server primary, mount, start services

now go and integrate your drbd and services with your cluster manager.

-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
__
please don't Cc me, but send to list   --   I'm subscribed



More information about the drbd-user mailing list