I have a volume group (VG) that contains two physical volumes (PV). Several logical volumes (LV) in the VG are likely to use extents on both PVs.
Is there a way to tell which LVs occupy space on which PVs?
I have a volume group (VG) that contains two physical volumes (PV). Several logical volumes (LV) in the VG are likely to use extents on both PVs.
Is there a way to tell which LVs occupy space on which PVs?
The
pvdisplay
command has a-m
option to show the mapping of physical extents to logical volumes and logical extents.I have set up the following situation on a test machine:
Running
pvdisplay -m
on this machine results in the following output:As you can see, You get a nice overview of where the extents for each of the 6 logical volumes are.
I use:
...which I find a little easier to interpret.
LVM is a flexible abstraction layer between physical disk up to the filesystem (disk ⇒ partition ⇒ LVM's physical volume [PV] ⇒ LVM's volume group [VG] ⇒ LVM logical volume [LV] ⇒ filesystem).
Due to some LVM features (aggregation, mirror, stripes, snapshot...), the physical layout can become complex... thus some caveats:
--all
to view internal details (of mirrored volumes), if wanted.For a quick overview, I recommend lsblk (which is a standard tool, not LVM specific).
LVM specific tools
To get LVM's internal view and details, use LVM commands:
lvs
andpvs
commands with option--segments
lvdisplay
andpvdisplay
commands with option-m
LVM tools exmples
List the physical segments used by a logical volume :
same with more details:
List the physical extents of a given LV. Useful to move those segments (using
pvmove
):The opposite way, list the logical volume (segments) inside a given Physical Volume:
List the physical segments of a given logical volume, among other information:
Display the Logical volume associated with a given physical volume , among other information:
Complex command, but full list :
lvdisplay -m
will list its physical segments:By adding the
-a
option, you can also see the volumes that are set up byraid1
-mirrored volumes:For each mirror, you will see two volumes,
{volume_name}_rmeta_{n}
(containing the raid meta data) and{volume_name}_rimage_{n}
(containing the actual data), where{volume_name}
is the name of the logical volume and{n}
is the number of the mirror (starting at0
).