[DRBD-user] existing volume

Mike Lovell mike at dev-zero.net
Thu Jul 8 22:53:35 CEST 2010

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


Rohit Upadhyay wrote:
> Hello,
> How is pre-existing volume user data handled when DRBD module is 
> loaded? Does it copy existing volume data to remote storage replica?
> Or it works only on new DRBD virtual block device?
>
> If a volume is already existing, does it replicate blocks such that 
> running applications are not impacted?
>
i'm gonna make a few assumptions here. i'm assuming you have a server 
with a disk that has your existing data. and that you are setting up 
another server with a similarly sized disk that you want to replicate 
data from the first server to this disk. here are some pointers and 
suggestions about doing this.

an existing volume can be converted to a drbd volume without any loss of 
data, but there are a few things to be aware of. first and foremost is 
you need to make sure you pick the right disk to be the primary disk the 
first time you bring up drbd. last thing you want is to accidentally 
make the new blank drive the primary and have everything get copied from 
the blank drive over to your drive with data and overwriting everything. 
if you are following the documentation on drbd.org, make sure you follow 
the instructions in "The initial device synchronization" of chapter 5 on 
your server with the existing data. when it does the initial sync, it 
will copy all of the blocks and data from the original volume to the new 
volume on the remote server.

the other gotcha to be aware of is that drbd needs some space to store 
its metadata. most people put this at the end of the block device with 
the data. but i'm guessing when you formatted your volume you didn't 
leave room at the end of the device for stuff like this. if this is the 
case, then you are going to need to either put the drbd metadata on 
another block device or make room at the end of the block device (either 
shrinking the filesystem or increasing the size of the block device if LVM).

as for doing this while the system and apps on the system are online, it 
definitely can be done. things might be a little slow cause drbd is 
using some disk IO to do the replication. there isn't a technical reason 
you can't do it. after setting things up though, you should adjust your 
mount points so that the primary node is mounting the /dev/drbdX device 
instead of mounting the raw block device. that can be done with just a 
few seconds of downtime after drbd is set up and it doesn't have to 
happen immediately. you just need to make sure things get changed so 
that you aren't using the raw block device all the time cause that can 
really confuse drbd and mess thing up in the future.

so to re-cap. you can convert an existing volume to a drbd volume 
without losing data and drbd will just copy the data from one machine to 
the other. and you can do this while the system is online.

hope that was helpful.

mike



More information about the drbd-user mailing list