Ben's Blog

I.T., unix / linux ben April 20, 2011

Mounting a partition from a disk image

So you’ve dded a disk and you would like to mount its partitions from the resulting image file. Easy enough, first:

[bash]fdisk -l -u /path/to/disk.img[/bash]

Which will yield a variation of the following output:

[bash]You must set cylinders.
You can do this from the extra functions menu.

Disk disk.img: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000080

Device Boot Start End Blocks Id System
disk.img1 63 15631244 7815591 82 Linux swap / Solaris
disk.img2 * 15631245 113290379 48829567+ 83 Linux
Partition 2 has different physical/logical endings:
phys=(1023, 254, 63) logical=(7051, 254, 63)
disk.img3 113290380 210949514 48829567+ 83 Linux
Partition 3 has different physical/logical beginnings (non-Linux?):
phys=(1023, 254, 63) logical=(7052, 0, 1)
Partition 3 has different physical/logical endings:
phys=(1023, 254, 63) logical=(13130, 254, 63)[/bash]

Partitions available on the disk image are listed as disk.img1, disk.img2 & disk.img3. Great, pick which one you want to mount and look at where it starts.
disk.img2 starts at 15631245, multiply that by 512. 15631245 * 512 = 8003197440.
Finally, mount the disk image at the offset you calculated as such:

[bash]mount -o loop,offset=8003197440 -t auto /path/to/disk.img /mnt/disk_img_partition2[/bash]

And done!

Leave a Comment

Cancel reply

This blog is solar powered

Interactive

Handwriting Capture
Mandalagaba
IPv6 link-local to MAC converter
IPv6 MAC to link-local converter
Markov Text Generation
Markov Word Generation
Markov Music Generation
Duplogrifier
Flood Fill Algorithms
Homestead Metrics
RGB Playground
Web Games

Categories

  • aesthetics111
    • plots54
    • specular holography6
  • Books3
  • I.T.202
    • 3D modeling / printing21
    • AI6
    • all out geekery36
    • electronics27
    • homestead automation6
    • maniacal paranoia25
    • plotters49
    • unix / linux29
    • video games4
    • web development29
    • web games3
  • Lego / Duplo67
  • life in the U.S.42
  • miscellaneous202
  • nature encounters114
  • old vinyls3
  • organs2
  • self sustainability560
    • agriculture105
    • apiculture38
    • apple20
    • building131
    • canning3
    • crochet6
    • foraging6
    • hunting10
    • maple syrup47
    • poultry39
    • preserving2
    • solar power28
    • water23
    • wood84
  • trip to a new life6
Theme by Bloompixel. Proudly Powered by WordPress