What is lvmetad
To improve performance and automatic activation of volume groups and logical volumes by udev, LVM makes use of a metadata cache. By default, LVM manages its metadata centrally using a daemon, lvmetad.
How to disable lvmetad
Sometimes, especially in a clustered environment, you may find that when you create a volume group on one node of the cluster, the same is not reflected on the other nodes of the cluster. This is mainly due to the cached metadata on the other nodes. Some users may want to completely disable lvmetad in order to avoid this issue.
To disable the lvmetad, follow the steps given below:
Modify /etc/lvm/lvm.conf
1. Edit the /etc/lvm/lvm.conf file and set use_lvmetad as 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. After the use of the lvmetad metadata cache is disabled, the lvmetad service can be disabled as well.
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
You may also want to mask both the services:
# systemctl mask lvm2-lvmetad.service # systemctl mask lvm2-lvmetad.socket
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