Mount a partimage file as a loopback device

Note: most (if not all) commands have to be issued as root. sudo is your friend.
Note: we're dealing with images of entire partitions. This means that you need a lot of free space on disk to work. You've been warned.

  • Check whether the partimage file is compressed:
    1. file -s <image file name>
    if so, first of all gunzip it. Hereafter we assume you've an uncompressed partimage dump file.
  • Create a file to receive the partimage dump. Size the file as if it were a partition, wide enough to hold the partimage dump
    check how much space you need with
    1. partimage imginfo <image file name>
    Then use dd to create the image file
    1. dd if=/dev/zero of=<image file name> bs=1024 count=0 seek=$[1024*1024*<size in GB>]
  • Associate that file to a block device, use a free device under /dev/loop* (e.g. using losetup -a),
    1. losetup /dev/loop0 <image file name>
  • Do a partimage restore
    1. partimage /dev/loop0 <partimage image file>
  • Remove the file from the loopback
    1. losetup -d /dev/loop0
  • Finally, mount the image file
    1. mount <image file name> <mountpoint> -o loop
  • You can also mount directly the loop device:
    1. mount -t <file system type> /dev/loop/0 <mountpoint>