What is lvmetad and how do I disable it?
Environment
- Red Hat Enterprise Linux 9
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 6
- LVM
- For RHEL8 hosts:
- The `lvmetad` daemon does not exist in RHEL8. Starting in RHEL8, the lvm metadata is no longer read from cache, but from the disks directly.[FN.4]
- For Hosts within a Cluster:
- If the host is a member of a cluster, then review the following before disabling lvmetad: "Why I got warning "WARNING: Disable lvmetad in lvm.conf lvmetad should never be enabled in a clustered environment." from messages log ?"[FN.3]
Issue
-
What is
lvmetadand its function? [FN.1] -
The
lvmetaddaemon is enabled by default, and I need to disablelvmetad[FN.2] -
May be seeing issues at boot up when
lvmetadis enabledWarning: /dev/mapper/rootvg-lv_root does not exist Warning: /dev/rootvg/lv_root does not exist -
LVM changes are not reflected by the rest of the nodes in my cluster.
-
After creating a volume group on a node in my cluster the other nodes do not reflect the change.
Resolution
To disable[FN.2] the use of lvmetad[FN.1] you will need to make the following changes:
- Check current feature and service status
- Disable feature at boot time vis
use_lvmetad=0[FN.4],[FN.5] - Disable run-time service(s) using sytemctl
- Verify changes
- Rebuild boot image file to reflect above changes (optional) [FN.1]
- Reboot (optional)
-
Check
lvmetadcurrent status:grep use_lvmetad /etc/lvm/lvm.conf | xargs -I {} echo {} | grep -v "^#" systemctl status lvm2-lvmetad # RHEL 8+ only -
Disable
lvmetadfeature: ensure theuse_lvmetadvalue in the/etc/lvm/lvm.conffile is set to0(off).use_lvmetad = 0 -
Disable
lvmetadservices: We will also need to disable the currently runninglvmetadservice-
RHEL 8, 9:
no actions required, lvmetad is not present in RHEL 8+ -
RHEL 7:
# systemctl stop lvm2-lvmetad # systemctl disable lvm2-lvmetad # systemctl stop lvm2-lvmetad.socket # systemctl disable lvm2-lvmetad.socket # systemctl mask lvm2-lvmetad.socket -
RHEL 6
# service lvm2-lvmetad stop # chkconfig lvm2-lvmetad off
-
-
Rebuild boot image to pick up changes: After making changes to the
/etc/lvm/lvm.conffile, we will need to rebuild theinitramfsto ensure the LVM configuration is loaded properly at next boot time. More information is available here: "How to rebuild the initial ramdisk image in Red Hat Enterprise Linux".# cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.$(date +%m-%d-%H%M%S).bak # dracut -f -v -
Reboot (optional): Optionally you may wish to reboot to validate the above changes are applied as expected.
Same issue persists after above
-
If same issue then collect the below data from the system (for example in maintence mode if the system will not complete boot successfully).
# cat /etc/fstab > /tmp/fstab.out # lsblk > /tmp/lsblk.out # df -h > df.out # cat /proc/mounts > /tmp/proc-mounts.out # journalctl -xb > /tmp/journactl.out -
Compress the collected files.
# tar -cJf /tmp/CASENUMBER_lvmdiags.tar.xz /tmp/*out -
Provide the above file and reference to this document to an existing or newly opened Red Hat support case.
Footnotes
- Why you should not disable the
lvmetadfeature long term. - What is
lvmetad, and what is it's function? - Additional resources for LVM in a cluster/high availability environment:
- The
lvmetaddaemon does not exist in RHEL8 so does not, and cannot, be disabled -- it is already implicitly disabled. What replaced it?# systemctl status lvm2-lvmetad Unit lvm2-lvmetad.service could not be found. - Disabling just the service (
systemctl) is not enough to guarantee disabling the feature. You must disable thelvmetadfeature, not just the service. If just thelvmetadservice is disabled (the feature is not disabled), thenlvmetadservice can, and often will, end up resulting in thelvmetad>getting auto restarted. The feature must be first disabled via thelvmetad=0configuration clause within the/etc/lvm/lvm.conflvm configuration file. - For a complete rebuild of the lvm cache data utilized by
lvmetad, it is recommended that the following commands be run:# pvscan # vgscan # especially important if the lvm.conf:filter settings have been changed # lvscan - LVM filtering notes.
- The lvm configuration file
/etc/lvm/lvm.confhas two filter key:value pairs:-
fliter=; used for filtering devices when command are run and -
global_filter=; used for event driven auto activication (e.g. systemd+udev in RHEL 7+)
-
- What is LVM's filter setting and how do I configure it easily in RHEL?
- How do I setup multipath on a system that already has LVM configured?
- Why do I see 'Found duplicate PV' warnings when using LVM with multipath storage in RHEL?
- The lvm configuration file
Root Cause
-
When set to
1and whenlvmetadis running (it is not auto-started), the volume group metadata and PV state flags are obtained from thelvmetadinstance and no scanning is done by the individual commands. In a setup withlvmetad,lvmetadudev 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 manualpvscan --cacheis performed. -
See also the following references:
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.