Ubuntu mount partition of raw harddrive images via loopback
First we need the device mapper kernel Module.
modprobe dm_mod
Then you have to install kpartx. It creates device maps from partition tables
apt-get install kpartx
Next we setup the image file - here harddrive.img - for use with /dev/loop0
losetup /dev/loop0 harddrive.img
Here is where we use kpartx - look at the example output.
kpartx -a -v /dev/loop0
gpt: 0 slices
dos: 6 slices
add map loop0p1 (254:0): 0 1333332 linear /dev/loop0 63
add map loop0p2 (254:1): 0 11309760 linear /dev/loop0 1333395
add map loop0p5 (254:2): 0 11309697 254:1 63
Finally we can mount the single partitions of the whole drive image file.
mount /dev/mapper/loop0p1 /mountpoint/
Did it work for you. Just drop a comment on it.
modprobe dm_mod
Then you have to install kpartx. It creates device maps from partition tables
apt-get install kpartx
Next we setup the image file - here harddrive.img - for use with /dev/loop0
losetup /dev/loop0 harddrive.img
Here is where we use kpartx - look at the example output.
kpartx -a -v /dev/loop0
gpt: 0 slices
dos: 6 slices
add map loop0p1 (254:0): 0 1333332 linear /dev/loop0 63
add map loop0p2 (254:1): 0 11309760 linear /dev/loop0 1333395
add map loop0p5 (254:2): 0 11309697 254:1 63
Finally we can mount the single partitions of the whole drive image file.
mount /dev/mapper/loop0p1 /mountpoint/
Did it work for you. Just drop a comment on it.
Comments
Using "VBoxManage internalcommands converttoraw" to convert the virtual drive to a raw disk image, then mounting the disk image using the method you've described has worked beautifully!
Thanks.
mount: special device /dev/mapper/loop0p1 does not exist
on executing
mount /dev/mapper/loop0p1 /mnt
mount: special device /dev/mapper/loop0p1 does not exist
on executing
mount /dev/mapper/loop0p1 /mnt
---------
Does loop0 have a partition table?
fdisk -l /dev/loop0
This is one possible reason /dev/mapper/loop0pN doesn't exist.
umount /mountpoint/
kpartx -d -v /dev/loop0
losetup -d /dev/loop0
pst recovery