Hodžův blog

17 Dub

HowTo: Mounting a image file made with dd or dd_rescue

1. Make a drive image
# pv -tpreb /dev/sdb | dd of=/mnt/backup/disk_image.img bs=1M

2. Detect mount offset (mount offset=sector size*partition start)
# fdisk -l /mnt/backup/disk_image.img

Disk /mnt/backup/disk_image.img: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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: 0xcf4cef05
 
Device Boot Start End Blocks Id System
/mnt/backup/disk_image.img1 * 2048 206847 102400 7 HPFS/NTFS/exFAT
/mnt/backup/disk_image.img2 206848 1953521663 976657408 7 HPFS/NTFS/exFAT

Sector size: 512 bytes
Partiton start: 206848
Offset: 512*206848=105906176

Alternative procedure – detect offset using GNU parted
# parted disk_image.img
GNU Parted 2.3
Using disk_image.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit B
(parted) print
Model: (file)
Disk disk_image.img: 1000204886016B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
 
Number Start End Size Type File system Flags
1 1048576B 105906175B 104857600B primary ntfs boot
2 105906176B 1000203091967B 1000097185792B primary ntfs
(parted) quit

3. Mount partition
# mkdir -p /mnt/loop
# mount -o ro,loop,offset=105906176 /mnt/backup/disk_image.img /mnt/loop/

One Response to “HowTo: Mounting a image file made with dd or dd_rescue”

  1. 1
    lzap Says:

    Or just use guestfs.

Leave a Reply

Hodžův blog is is proudly powered by Wordpress and the Magellan Theme