Image Mount

I've been working on an embeded device which uses a compact flash card for storage and when I'd finally got it all installed and working I wanted to back it up. As it was only a 4Gb card I was going to use dd to just image the whole disk but I realised I didn't know how to mount a single partition on the image if I wanted to access individual files. A quick post to the PaulDotCom mailing list brought an answer from Matt Erasmus which pointed me at this article from SANS which explains how to use the offset option in the mount command to get at individual partitions. Reading through the article it was prime for being scripted so here it is.

image_mount takes up to three parameters:

  • the disk image - show all partitions on the disk
  • the disk image and a partition number - show the mount command to mount that partition
  • the disk image, partition number and a directory - mount the chosen partition

This hasn't had much testing but worked fine on the images I had available, if you find an image that doesn't work please get in touch and I'll see what I can do to handle it.

Download Image Mount

Support The Site

I don't get paid for any of the projects on this site so if you'd like to support my work you can do so by using the affiliate links below where I either get account credits or cash back. Usually only pennies, but they all add up.