I have a complete disk image (dd if=/dev/sda of=foo.bin) that contains several partitions and LVM logical volumes on which there are ext4 filesystems. How do I mount one of the filesystems on this diskimage?

I have the output of fdisk -l from when the image was made.

I assume I have to use a loopback device somehow, but I am not sure how to do it when I have the entire device as an image and not just one filesystem.

Hope you can help.

Operating system is Linux.


Try to use kpartx, which will export the partitions on the image as device nodes, which you can simply mount.

  1. Get the list of available partitions with kpartx -l imagefile.
  2. Activate the mapping with kpartx -a imagefile
  3. Mount the partition. The nodes are in /dev/mapper.
  4. Do stuff.
  5. Unmount.
  6. Unmap with kpartx -d imagefile.

For more infos, see man kpartx.


it can be done out of the box using a combination of fdisk and dd. First, use fdisk's p command to show partition boundaries, then do

dd if=device-image.bin of=partition-image.bin skip=<number in Start column> count=<number in Sectors column>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.