Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I used 'dd' to create an image of my hard drive as a file on another drive. Question: how do I mount this image to see that it's valid? Notes:

  • "file image" yields (all one line, I just broke it up for readability):

file maindisk.image.out


maindisk.image.out: x86 boot sector, LInux i386 boot LOader; GRand Unified Bootloader,
stage1 version 0x3, boot drive 0x80, 1st sector stage2 0x44841, GRUB version 0.94;
partition 1: ID=0x83, active, starthead 1, startsector 63, 409600 sectors; partition 2:
ID=0x8e, starthead 127, startsector 409663, 312167042 sectors, code offset 0x48
  • The obvious mount command (as root) fails:

# mount -o loop -t ext3 maindisk.image.out /mnt/loop/ 

mount: wrong fs type, bad option, bad superblock on /dev/loop0, 
       missing codepage or helper program, or other error 
       In some cases useful info is found in syslog - try 
       dmesg | tail  or so

# dmesg | tail -1

# VFS: Can't find ext3 filesystem on dev loop0. 
  • The thing that I dd'd was /dev/sda, a block device. According to file (again, all on one line, no backslashes):
 
# cat /dev/sda | file - 

/dev/stdin: x86 boot sector, LInux i386 boot LOader; GRand Unified Bootloader, \
stage1 version 0x3, boot drive 0x80, 1st sector stage2 0x44841, GRUB version 0.\
94; partition 1: ID=0x83, active, starthead 1, startsector 63, 409600 sectors; \
partition 2: ID=0x8e, starthead 127, startsector 409663, 312167042 sectors, cod\
e offset 0x48 
  • According to "mount", here's how I have /dev/sda mounted:

/dev/mapper/VolGroup-lv_root on / type ext4 (rw) 
/dev/sda1 on /boot type ext3 (rw) 
  • Did I back up the wrong thing? Should I have backed up /dev/sda1 instead? Is my system doing some sort of volume management that's making this image mount difficult?
share|improve this question

migrated from stackoverflow.com Aug 25 '12 at 21:41

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer 1

up vote 3 down vote accepted

Based on Mounting a raw partition file made with dd or dd_rescue in Linux.

See that startsector 63 in file's output? It means there is an offset of 63 sectors * 512 bytes/sector = 32256 bytes from the beginning of the disk.

Try:

mount -o loop,offset=32256 -t ext3 maindisk.image.out /mnt/loop/ 
share|improve this answer
1  
Thanks! It turns out my main partition is LVM, so I'm doing more reading to figure out how to mount it. –  barrycarter Sep 2 '12 at 17:12
add comment

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.