I have a file hdd.img
being raw image of a hard disk. The harddisk has a BIOS/DOS partition table and its second partition is setup to serve as a the one single physical volume from which LVM creates logical volumes.
My goal is to access the partitions/filesystems that are represented by those logical volumes.
I setup loopback block device mapping for the hdd.img
via the command:
$ sudo losetup --partscan -f hdd.img
which results me seeing the two partitions contained in that image on the loopback device (it was loop17
)
$ lsblk | grep 'loop17'
loop17 7:17 0 30G 0 loop
├─loop17p1 259:4 0 1G 0 loop
└─loop17p2 259:5 0 29G 0 loop
The question now is. How can I inform the system to scan /dev/loop17p2 for the logical volumes I actually want to access
Update
Installing the package kpartx
and doing this:
$ sudo losetup -f hdd.img
$ sudo kpartx -a /dev/loop17
did generate the lvm mappings to the volumes contained on /dev/loop17p2
. While this solves my immediate needs it would yet still be great to know why vgscan
does not work once the losetup --partscan -f hdd.img
had already created the /dev/loop17p2
block device that contains the logical volumes?