In order to prepare a DRBD resource for use as a Physical Volume, it is necessary to create a PV signature on the DRBD device. In order to do so, issue one of the following commands on the node where the resource is currently in the primary role:
pvcreate /dev/drbdnum
or
pvcreate $(drbdadm sh-dev resource)
Now, it is necessary to include this device in the list of
devices LVM scans for PV signatures. In order to do this, you
must edit the LVM configuration file, normally named
/etc/lvm/lvm.conf. Find the line in the
devices section that contains the
filter keyword and edit it accordingly. If
all your PVs are to be stored on DRBD
devices, the following is an appropriate filter
option:
filter = [ "a|drbd.*|", "r|.*|" ]
This filter expression accepts PV signatures found on any DRBD devices, while rejecting (ignoring) all others.
![]() | Note |
|---|---|
By default, LVM scans all block devices found in
|
After modifying the lvm.conf file, you
must run the
vgscan command so LVM discards
its configuration cache and re-scans devices for PV
signatures.
You may of course use a different filter
configuration to match your particular system configuration.
What is important to remember, however, is that you need to
Accept (include) the DRBD devices you wish to use as PVs;
Reject (exclude) the corresponding lower-level devices, so as to avoid LVM finding duplicate PV signatures.
When you have configured your new PV, you may proceed to add it to a Volume Group, or create a new Volume Group from it. The DRBD resource must, of course, be in the primary role while doing so.
vgcreate name /dev/drbdnum
![]() | Note |
|---|---|
While it is possible to mix DRBD and non-DRBD Physical Volumes within the same Volume Group, doing so is not recommended and unlikely to be of any practical value. |
When you have created your VG, you may start carving Logical Volumes out of it, using the lvcreate command (as with a non-DRBD-backed Volume Group)