附录 D. LVM 对象标签
An LVM tag is a word that can be used to group LVM2 objects of the same type together. Tags can be attached to objects such as physical volumes, volume groups, and logical volumes. Tags can be attached to hosts in a cluster configuration.
可在命令行的 PV、VG 或者 LV 参数中赋予标签。标签应该有 @ 作为前缀以避免混淆。每个标签都可用所有对象都拥有的标签取代来扩大范围,标签的类型根据它在命令行的位置确定。
As of the Red Hat Enterprise Linux 6.1 release, LVM tags are strings of up to 1024 characters (for earlier releases the upper length limit was 128 characters). LVM tags cannot start with a hyphen.
A valid tag can consist of a limited range of characters only. For the Red Hat Enterprise Linux 6.0 release, the allowed characters are [A-Za-z0-9_+.-]. As of the Red Hat Enterprise Linux 6.1 release, the list of allowed characters has been extended, and tags can contain the "/", "=", "!", ":", "#", and "&" characters.
Only objects in a volume group can be tagged. Physical volumes lose their tags if they are removed from a volume group; this is because tags are stored as part of the volume group metadata and that is deleted when a physical volume is removed.
以下命令列出所有带
database 标签的逻辑卷。
lvs @database
lvs @database
The following command lists the currently active host tags.
lvm tags
lvm tags
D.1. 添加和删除对象标签 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
要从物理卷中添加或者删除标签,请使用
pvchange 命令的 --addtag 或者 --deltag 选项。
要从卷组中添加或者删除标签,请使用
vgchange 或 vgcreate 命令的 --addtag 或者 --deltag 选项。
要在逻辑卷中添加或者删除标签,请请使用
lvchange 或 lvcreate 命令的 --addtag 或者 --deltag 选项。
As of the Red Hat Enterprise Linux 6.1 release, you can specify multiple
--addtag and --deltag arguments within a single pvchange, vgchange, or lvchange command. For example, the following command deletes the tags T9 and T10 and adds the tags T13 and T14 to the volume group grant.
vgchange --deltag T9 --deltag T10 --addtag T13 --addtag T14 grant
vgchange --deltag T9 --deltag T10 --addtag T13 --addtag T14 grant