LVM 命令 Failed to load config file /etc/lvm/lvm.conf

问题

修改lvm.conf后无法运行lvm命令

错误如下:

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

解析错误,
无法加载配置文件 /etc/lvm/lvm.conf

www. On IT Road .com

解决方案

这可能是由于 /etc/lvm/lvm.conf 中的无关字符造成的。
在这种情况下,解析错误提示错误在第 1382 行,但如果错误类似于缺少括号,则可能不准确。

# 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"

要跟踪语法错误,使用以下内容消除注释和空行会很有帮助:

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

此外,我们可以使用提供语法高亮功能的“vim”。
这对于诸如缺少括号之类的错误特别有用。
纠正这些错误后,再次运行 LVM 命令进行验证。

日期:2020-09-17 00:14:05 来源:oir作者:oir