• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to disable lvmetad in CentOS/RHEL

by admin

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
Note: When the value of use_lvmetad is changed 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
CentOS / RHEL 6 : How to rebuild Initial Ramdisk Image

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. RHEL 7 – RHCSA Notes : Create, delete, and modify local groups and group memberships.
  2. more: command not found
  3. What causes iptables to load every time after a reboot even when it’s completely turned off
  4. abbr Command Examples in fish-shell
  5. How to use the ssh-keygen Command in Linux
  6. ldconfig: command not found
  7. sox: command not found
  8. nice: command not found
  9. How to Create a tmpfs Filesystem in CentOS/RHEL
  10. How to use command redirection under Linux

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-rebuild Command Examples in Linux
  • nixos-option: Command Examples in Linux
  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright