Since an existing Logical Volume is simply a block device in Linux terms, you may of course use it as a DRBD backing device. To use LV's in this manner, you simply create them, and then initialize them for DRBD as you normally would.
This example assumes that a Volume Group named
foo already exists on both nodes of on your
LVM-enabled system, and that you wish to create a DRBD resource
named r0 using a Logical Volume in that Volume
Group.
First, you create the Logical Volume:
lvcreate --name bar --size 10G foo
Logical volume "bar" created
Of course, you must complete this command on both nodes of
your DRBD cluster. After this, you should have a block device
named /dev/foo/bar on either node.
Then, you can simply enter the newly-created volumes in your resource configuration:
resource r0 {
...
on alice {
device /dev/drbd0;
disk /dev/foo/bar;
...
}
on bob {
device /dev/drbd0;
disk /dev/foo/bar;
...
}
}Now you can continue to bring your resource, just as you would if you were using non-LVM block devices.