The lvm2-lvmetad daemon is a caching service used in older implementations of the Logical Volume Manager (LVM) in Ubuntu Linux. Its primary purpose was to cache LVM metadata locally in memory, significantly speeding up commands like lvs, vgs, and pvs by avoiding the need to scan all block devices on the system every time a query was made. However, in modern LVM configurations (specifically those using lvmetad deprecation or native systemd integration), this daemon is often obsolete or actively problematic, leading to stale metadata issues where the cache falls out of sync with the actual disks. If you are experiencing strange LVM reporting errors, or if you are running a modernized server environment where direct disk scanning is preferred for absolute accuracy, disabling this daemon is a standard troubleshooting step.
This guide explains how to completely disable the lvm2-lvmetad daemon in Ubuntu Server and configure LVM to bypass the cache.
Stop and Mask the lvmetad Daemon
Disabling lvmetad requires a two-step process: we must stop the systemd daemon, and then we must explicitly tell the LVM configuration file to stop attempting to use it.
- Log into your Ubuntu Server via SSH using an account with
sudoprivileges. - First, stop the running service and its associated socket:
sudo systemctl stop lvm2-lvmetad.service lvm2-lvmetad.socket - Next, disable and mask both units to prevent them from starting on boot:
sudo systemctl disable lvm2-lvmetad.service lvm2-lvmetad.socket sudo systemctl mask lvm2-lvmetad.service lvm2-lvmetad.socket - Now, you must edit the global LVM configuration file. Open it with your preferred text editor:
sudo nano /etc/lvm/lvm.conf - Locate the line that reads
use_lvmetad = 1and change it touse_lvmetad = 0. - Save the file and exit the editor.
Verify the Service Lockdown
By masking the units and updating the configuration file, you have forced LVM to rely entirely on direct disk scanning for metadata queries.
To verify the lockdown is successful, first check the systemd status:
systemctl status lvm2-lvmetad.service
The output will clearly state that the service is masked. Next, run any standard LVM reporting command, such as sudo pvs. The command should execute successfully, directly scanning the block devices without throwing any warnings regarding a missing or disconnected lvmetad socket. You have successfully bypassed the LVM metadata cache.