LVM, the Linux logical volume manager included in the Linux kernel uses the device-mapper functionality to allow easy administration and creation of logical volumes in your file system. This is great technology, but what happens when you are having hard drive problems and want o troubleshoot. How do you determine which physical drive your volume is mapped to? How to find out if the drive you are replacing is storing critical parts of your system?
Here is the technique I’ve used and it works pretty well.
The df command will tell you what volume a specific directory is on. the output of this command might look like this
# df /foo
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/kubuntu--vg-Video 739G 645G 56G 93% /foo
Once you know the volume you are looking for you can use the lvs command to report information about logical volumes. Note, lvs seems to need root access so you may need to use sudo.
# sudo lvs -o +devices /dev/mapper/kubuntu--vg-Video
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
Video kubuntu-vg -wi-ao---- 750.00g /dev/sda5(128000)
So now we can see that the logical volum in question is on /dev/sda5
lshw can now show us what drive is on sda
# sudo lshw -class disk
description: ATA Disk
physical id: 0.0.0
bus info: scsi@0:0.0.0
logical name: /dev/sda
size: 1863GiB (2TB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 logicalsectorsize=512 sectorsize=4096 signature=000c3f21
Now we know which drive is storing the content from the LVM in question and can migrate this over to a new hard drive.