Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Adding tags to LVM volumes and showing volumes that possess that tag is easy and works like a charm; but somehow I can't find a way to list all tags in use, or to show tags that apply to a specific volume. lvdisplay -v doesn't give me details on tags, neither lvs seems to have any option for that. (I am using CentOS 5.4.)

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Showing tags that belong to a specific volume:

# lvchange --addtag @RootFS /dev/VolGroup00/LogVol00
Logical volume "LogVol00" changed

# lvs -o lv_tags /dev/VolGroup00/LogVol00
  LV Tags
  RootFS

# lvs -o lv_tags /dev/VolGroup00/LogVol01
  LV Tags

You can easily script getting the active tags for a specific volume that way.

If you parse the output of the lvs command, and run the logical volumes through the command I used above, you'll be able to grep, sed and awk your way to a list of all tags in use.

Physical volumes and volume groups have commands that are similar to the above:

# pvs -o pv_tags /dev/sda2
  PV Tags

# vgs -o vg_tags /dev/VolGroup00
  VG Tags

Here's a Red Hat KB article about this

share|improve this answer
    
Thanks a lot! That was exactly what I was searching for :) –  ikso May 28 '10 at 15:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.