Mount or extract data from LVM partiiton inside of a RAW IMG File?

1

1

I have a raw disk .img file (running file indicates that it is a "DOS/MBR boot sector" file).

Running mmls produces the following output:

DOS Partition Table
Offset Sector: 0
Units are in 512-byte sectors

     Slot    Start        End          Length       Description
00:  Meta    0000000000   0000000000   0000000001   Primary Table (#0)
01:  -----   0000000000   0000002047   0000002048   Unallocated
02:  00:00   0000002048   0000411647   0000409600   Linux (0x83)
03:  00:01   0000411648   0020971519   0020559872   Linux Logical Volume Manager (0x8e)
04:  -----   0020971520   0067108863   0046137344   Unallocated

When I try to mount partition "03", I get the error: mount: unknown filesystem type 'LVM2_member'

I can mount "02", but that just brings up a small MBR GRUB Parition.

Is there any way I can mount the LVM partition from the image file, or extract the data from it?

caseyamcl

Posted 2015-04-01T12:59:20.770

Reputation: 131

Answers

2

Figured out out (thanks to this thread):

On an Ubuntu box with a GUI:

sudo apt-get install kpartx
sudo losetup /dev/loop0 disk.img
sudo kpartx -a /dev/loop0

Then, disk drives appear in the Nautilus file manager (GUI) under Devices. Click on them to see the contents.

caseyamcl

Posted 2015-04-01T12:59:20.770

Reputation: 131

This answer really helped with recovering files from my daughter's laptop after a disk failure - thanks! – Rich Sedman – 2016-12-18T19:47:46.310