How to disable lvmetad in CentOS/RHEL?

LVM can optionally use a central metadata cache, implemented through a daemon (lvmetad) and a udev rule. The metadata daemon has two main purposes: it improves the performance of LVM commands and it allows udev to automatically activate logical volumes or entire volume groups as they become available to the system.

To disable lvmetad

You may sometime experience that LVM changes are not reflected by the rest of the nodes in your cluster. After creating a volume group on a node in your cluster the other nodes do not reflect the change. In this case, we can disable the lvmetad daemon.

To disable the use of lvmetad you will need to make the following changes:

 

1. First ensure the use_lvmetad value in the /etc/lvm/lvm.conf file is set to 0.

# vi /etc/lvm/lvm.conf
use_lvmetad = 0

When set to 1 and when lvmetad is running (it is not auto-started), the volume group metadata and PV state flags are obtained from the lvmetad instance and no scanning is done by the individual commands. In a setup with lvmetad, lvmetad udev rules must be set up for LVM to work correctly. Without proper udev rules, all changes in block device configuration will be ignored until a manual “pvscan –cache” is performed.

 

2. We will also want to disable any lvmetad service.

 

For CentOS/RHEL 6

# service lvm2-lvmetad stop
# chkconfig lvm2-lvmetad off

 

For CentOS/RHEL 7

# systemctl stop lvm2-lvmetad
# systemctl disable lvm2-lvmetad
# systemctl stop lvm2-lvmetad.socket
# systemctl disable lvm2-lvmetad.socket

 

Note:

If you change the value of use_lvmetad from 1 to 0, you must reboot or stop the lvmetad service manually.

 

3. After making changes to the /etc/lvm.conf file, we will need to rebuild the initramfs to ensure the LVM configuration is loaded properly at boot time.

 

# cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.$(date +%m-%d-%H%M%S).bak
# dracut -f -v

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)