Well, seeing as though I pulled my hair out solving this, let me answer my question and save someone else the trouble of hair pulling :)
Solution:
After playing around, plenty of Googling and repartitioning etc... I came to a setup that works like a charm.
There is probably a quicker way to do this but I am not going to over complicate this answer
I did a standard install with the partitions like this (I have a 500g hard drive) :
/boot 100mb
/swap 4gb
/ 40gb
The balance of the disk space is to be left as unpartitioned space.
Then, I created a primary partition called /dev/sda4 by following these steps:
~: fdisk /dev/sda
~: (fdisk shell) p4 (for primary partition # 4)
~: (fdisk shell) t (hit t and enter to edit the partition type)
~: (fdisk shell) 08e (Linux LVM)
Reboot the server so that the new partitions can take effect.
Now create logical volumes by:
~: pvcreate /dev/sda4
~: vgcreate xenvg -s 4M /dev/sda4 # (xenvg is the name of my virtual group, you can rename it)
~: lvcreate -L400G -n xenroot xenvg # (xenroot is going to be my drbd resource and root partition for my DomU)
~: lvcreate -L4G -n xenswap xenvg # (xenswap is my swap file for my DomU)
Now that you have the correct partitioning you can go ahead and install DRBD with the following config file directives (drbd.conf)
Just displaying the 2 important directives here...
{
device /dev/drbd0;
disk /dev/xenvg/xenroot;
}
Your XEN VM config file needs to look like this (again, just the important one)
{
disk = [ "drbd:xenvm,xvda,w","phy:xenvg/xenswap,xvdb,w" ]
}
I hope this helps someone out there...
Best Answer
You shouldn't mount the attached block device,
/dec/sdb
. Instead, you should attach it as you already have, and then while unmounted create the DRBD metadata on both nodes, bring up the DRBD device on both nodes, pick a node and promote the DRBD device toPrimary
on that node, and finally create and mount the resulting/dev/drbdX
device there.To get there from where you currently are, you'll need to first un-mount the block device on both nodes:
# umount /dev/sdb
Then, follow the steps I outlined in the summary above:
On both nodes (substitute with the name of your DRBD resource):
You may need to wipe or shrink (shrinking is not supported by xfs) the filesystem to make room for DRBD's metadata if the
create-md
refuses to overwrite the filesystem. If you have no important data since you're just testing, I would just wipe it:# wipefs -a /dev/sdb
You should then see something like this in the output of
drbdadm status
:If the nodes are stuck in a
Connecting
state, check the IPs in your configuration file and your nodes' firewall rules.Once you see they are
Inconsistent/Inconsistent
, you can choose one of your nodes to becomePrimary
and start the initial sync. Then, on that same node, (re)create your filesystem and mount the DRBD device:Then anything you write into
/mnt/drbd0
will be replicated to the peer. To test that everything is working you could unmount the device from thePrimary
node, demote the device to secondary (# drbdadm secondary <res>), promote the device to
Primary` and mount it on the peer, and you should see that your filesystem has been replicated.Note that you shouldn't use the
--force
flag under any normal circumstances; only when you are creating a new DRBD device or recreating the metadata for an existing device.