6

I need to migrate an existing storage server running Debian 6, with many TB of data, to a HA setup. I can't simply shut down this server for any prolonged time (HA is required after all).

I plan to migrate this server to a DRBD cluster. I can't buy two new servers for this cluster; I need to reuse the existing server as a member of the cluster for cost reasons. Remember, I can't shut down anything for more than a few minutes at a time.

I have a new server ready, running Debian 8 to be the "master". I'd need to set up a "split brain" cluster using this "master" server; copy all data from the existing old server to the cluster; switch the existing services to the cluster; reconfigure the old server with Debian 8, then add it to the cluster as a "slave", resynchronize data, and at last have a redundant setup.

I've set up the cluster on the new machine, however, how to proceed? I can't even start the drbd service as the other "node" doesn't even exist yet...

I'm starting up from a previous drbd configuration that worked fine... with two available nodes.

Any help appreciated.

5

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.

| improve this answer | |
  • 1
    Unfortunately though I used LVM for the volume, there is no space available. That, and the existing server is running an obsolete Debian version (6) and I'd rather upgrade it to match the new server than use the old tools, old drbd release, etc. However good to know that next time, I can reserve 32M and be able to migrate to HA without doubly copying everything :) – wazoox Jul 7 '16 at 17:13
  • Maybe stuff changed with drbdadm version 9.5 but if I try bring up a single node drbd config it'll say 'missing section 'on <PEER>'' and refuse to start.. or maybe I am doing something wrong, I'm new to it – Alex Sep 28 '19 at 4:51
1

Edit: If you are using Proxmox then the commands apply to you. If not, then a similar process is still used.

You can not create a single node cluster AND migrate all data from a different computer since there is no other computer to migrate to. There needs to be at least 2 nodes connected with DRBD in order to migrate data.

You can create a cluster using the command pvecm create <clustername>. Do this on the new computer you wish to move your server to. You will then have to add the old computer with the existing server to the cluster. To do this, on the old computer where you created the cluster, type pvecm add <nodename>. Now you will have both nodes in the cluster.

Set up the rest of DRBD and you will be able to migrate the servers.

Also, it would be helpful to know which distro you are using :)

For clarification, I put in some comments after each paragraph in your question. let me know if this helps!

I need to migrate an existing server to DRBD by adding another machine.

I need to migrate an existing server to another machine using DRBD

Therefore I need to create a "single node" drbd cluster on the new system, migrate all existing data to the "cluster", then reconfigure the old server as a member of the cluster.

Therefore I need to create a cluster on the new machine, add the old machine into the cluster and configure DRBD between the two machines. (For learning purposes, you can create the cluster on either the old or new machine. The cluster has no "host" information)

I've set up the cluster on the new machine, however, how to proceed? I can't even start the drbd service as the other "node" doesn't even exist yet...

Add the old machine to cluster by running pvecm add <ip address of new machine > on the OLD machine. If you get errors about the ssh key please comment. I have ways around that.

I'm starting up from a previous drbd configuration that worked fine... with two available nodes.

Any help appreciated.

(Not too sure what you need here)

| improve this answer | |
  • Hi and welcome to SF. Isn't pvecm Proxmox specific? If so, why do you think this question involves Proxmox? – gf_ Jul 5 '16 at 15:20
  • Another reason why I wanted more detail in the question, regardless of the command pvecm, the same principle applies. You are right though I should I specified. Edited it now. – Michael Jul 5 '16 at 15:21
  • 1
    It seems like I wasn't clear. I'm not using proxmox at all or anything similar. I'll edit my post for details. – wazoox Jul 6 '16 at 14:41
  • What do you mean not using anything similar? Proxmox is Debian-linux based and you tagged Linux, what are you using? – Michael Jul 6 '16 at 14:44
  • 1
    @Michael Proxmox is a virtualization environment AFAIK. Doesn't apply at all. This is simply a file server, serving data to other machines. – wazoox Jul 6 '16 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.