什么是 lvm 标签,如何添加 / 删除 / 显示 lvm 标签?

如果您想要激活一个指定的 vg,而不是激活所有的 vg,您可以在 /etc/lvm/lvm.conf 的 volume_list 中添加 lvm 标签。

编 辑 /etc/lvm/lvm.conf,你可以看到以下注释:


# If volume_list is defined, each LV is only activated if there is a
# match against the list.
# "vgname" and "vgname/lvname" are matched exactly.
# "@tag" matches any tag set in the LV or VG.
# "@" matches if any tag defined on the host is also set in the LV or VG
# volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@" ]

运行 vgchange 以添加或者删除一个标签:


# vgchange --addtag test /dev/vg00
Volume group "vg00" successfully changed

检查标签是否已经被添加:


# vgs -o vg_tags /dev/vg00

VG Tags
test

编辑 /etc/lvm/lvm.conf,追加 volume_list 设置:

volume_list = ["@test"]

该设置表明,只有标签为test的vg才会被激活。

删除一个标签:


# vgchange --deltag test /dev/vg00
Volume group "vg00" successfully changed

# vgs -o vg_tags /dev/vg00
VG Tags

如果你希望操作 lv,请使用 lvchange 命令而非 vgchange 命令。

原文地址:https://www.cnblogs.com/danghuijian/p/4400263.html