Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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