LVM Commands Fail With “Failed to load config file /etc/lvm/lvm.conf”

The Problem

Unable to run lvm commands after modifying lvm.conf

Errors like:

lvextend -L +549G /dev/u03/u03
Parse error at byte 61974 (line 1382): unexpected token
Failed to load config file /etc/lvm/lvm.conf

The Solution

This could happen due to extraneous characters in /etc/lvm/lvm.conf. In this case the parse error gives a hint that the error is at line 1382, but if the error is something like a missing bracket it might not be accurate.

# the redundant nature of the mirror. This policy acts like
# 'remove' if no suitable device and space can be allocated for the
ck
# replacement.
#
mirror_image_fault_policy = "remove"

To track down syntax errors, it can be helpful to eliminate comments and blank lines with something like:

# grep -vE '^\s*(#|$)' /etc/lvm/lvm.conf

Also, we can use “vim” which provides syntax highlighting capability. This is particularly helpful with errors such as missing brackets. Once these errors are rectified, run the LVM commands again to verify.

Related Post