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.
Subscribe to:
Post Comments (Atom)








11 comments:
Just what i was looking for sweet worked perfectly
Thanks man, this was very useful. I've been playing around with VirtualBox and I've been looking for an easy way to copy files from a virtual drive.
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!
Works fine with SD card image.
Thanks.
It gives me following error:
mount: special device /dev/mapper/loop0p1 does not exist
on executing
mount /dev/mapper/loop0p1 /mnt
It gives me following error:
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.
Thanks for the recipe. Works for me on an SD card image.
thanks man!
Great tip. And once you are done, repeat the steps in the reverse order:
umount /mountpoint/
kpartx -d -v /dev/loop0
losetup -d /dev/loop0
Thanks for your post, you have done a terrific job. Keep it up.
pst recovery
mount needs to know the filesystem type. what is it?
is there a way to do this with windows ?
Post a Comment