LVM Object Mapping
Probably a silly question, but it got asked of me today... Is there a good utility for mapping how a PV is used within a VG?
I'm generally fairly anal-retentive about how I lay out data - such that having a tool to create a pretty picture of how my PVs' extents are consumed hasn't been generally necessary. Worst case, I could always parse the /etc/lvm/backup files to backtrack things.
That said, VxVM used to have tools that would chart out how disks were cut up into subdisks and how those subdisks were used within the volumes of a diskgroup. Just wondering if there are cognates within LVM2. I looked at pvs/lvs/vgs, but, they don't reall provide a nice, neat and self-explanatory mapping.
Responses
I generally use 'lvs -a -o +devices [<vg>]' to see the mapping of logical volumes to physical volumes:
[root@jrummy6-64-clust ~]# lvs -a -o +devices test LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert Devices lv1 test rwi---r-- 1012.00m lv1_rimage_0(0),lv1_rimage_1(0) [lv1_rimage_0] test Iwi---r-- 1012.00m /dev/mapper/mpathi(1) [lv1_rimage_1] test Iwi---r-- 1012.00m /dev/mapper/mpathj(1) [lv1_rmeta_0] test ewi---r-- 4.00m /dev/mapper/mpathi(0) [lv1_rmeta_1] test ewi---r-- 4.00m /dev/mapper/mpathj(0)
You can also use system-config-lvm if you want a graphical representation of how things are laid out, although I generally don't recommend using it to actually manage your volumes, as it sometimes doesn't handle some of the more advanced layouts very well.
Have a look at the man pages for pvs, vgs, lvs and you can see the optional columns you can specify with -o. These commands typically can give you pretty much any information you need, you just have to know which options to specify.
Let me know if you have any questions.
Regards,
John Ruemker, RHCA
Senior Software Maintenance Engineer
Global Support Services
Red Hat, Inc.