Setting up DRBD with only one node

You can bring DRBD up without a peer and without starting the DRBD service:

# modprobe drbd
# drbdadm create-md <res>
# drbdadm up <res> 
# drbdadm primary <res> --force
-- now you can use /dev/drbdX --

You could use DRBD to replicate from the existing server to the new server by installing DRBD on the existing storage.

If you're data is currently sitting on LVM you can unmount the logical volume, grow the logical volume (don't grow the filesystem) to make room for DRBD's metadata at the end of the device, set the disk option in the DRBD configuration to the logical volume, create the DRBD's metadata, and then force it to become Primary (with or without a peer). The rule of thumb for how much room DRBD needs for metadata is 32MB per 1TB of data. It would look something like this (assuming a 1TB LV):

# umount /dev/vg_name/lv_name
# lvextend -L +32M /dev/vg_name/lv_name
# drbdadm create-md <res>
-- will warn you if it finds existing data at the end of the device --
# drbdadm up <res> 
# drbdadm primary <res> --force

If you're not using LVM, you'd need to either shrink the filesystem to make room for DRBD's metadata, or use external metadata (described in the user's guide: https://www.drbd.org/en/doc/users-guide-84/ch-internals#s-metadata).

Once you bring DRBD up on the new server, it should start syncing your data. Just make sure the new server's backing disk is equal or larger in size.

Tags:

Linux

Drbd