2

I am trying to recover the data from an external HDD for a friend.

I am using Knoppix latest version booting it from USB.

I created an image (.img) using a tutorial for ddrescue, but now I have the copia.img file and can't mount it.

If I try to mount the terminal says:

mount: wrong fs type, bad option, bad superblock on .....

The drive was used to storage photos and does not contain any OS or similar.

If I run File command to the copia.img file it says:

DOS/MBR boot sector, code offset 0x52+2, OEM-ID "NTFS", Media descriptor 0xf8, sectors/track 63, heads 255, hidden sectors 63, dos <4.0 BootSector (0x80), FAT (1Y biy by descriptor);NTFS, sectors/track 63, sectors 1953520001, $MFT start cluster 21931768, $MFTMirror start cluster 477176, clusters/RecordSgement 2, clusters/index block 8, serial number 0d2c6a522c6a507b5; contains Microsoft Windows XP/Vista bootloader BOOTMGR

Also, if I run dmesg command it says:

enter image description here

Please can you please help me recovering it?

7
  • What does file copia.img say? What is the mount command you are using (I assume you are mounting through a loop device, but it's best if we can see exactly)?
    – dhag
    Feb 10, 2017 at 17:12
  • @dhag i use "mount -o loop,ro copia.img mountpoint but it says:mount: wrong fs type, bad option, bad superblock on .....
    – jfim88
    Feb 10, 2017 at 17:35
  • What does file copia.img say?
    – dhag
    Feb 10, 2017 at 17:46
  • i don't understand what you are asking me...sorry i'm very noob in Linux @dhag
    – jfim88
    Feb 10, 2017 at 17:51
  • It means "please run the command file copia.img in a terminal and edit your question to add this and its output".
    – dhag
    Feb 10, 2017 at 18:02

1 Answer 1

4

From the output of your call to file, it appears that your file is an image of a whole block device, containing several partitions, rather than a single filesystem. This explains why mount could not mount it: that command supports mounting single filesystems.

To mount a filesystem that is within a disk image, you have to:

  1. run fdisk -l on the image to find the file system offsets;
  2. compute <offset> * <block size> to get the offset in bytes;
  3. create a loop device from the file at that offset;
  4. mount using that loop device explicitly.

I'm taking excerpts from https://web.archive.org/web/20170917154947/http://madduck.net/blog/2006.10.20:loop-mounting-partitions-from-a-disk-image/ which has complete instructions; this could look like:

$ /sbin/fdisk -lu disk.img
[...]
Units = sectors of 1 * 512 = 512 bytes

      Device Boot      Start         End      Blocks   Id  System
[...]
disk.imgp7        10860003    68372639    28756318+  83  Linux

# losetup /dev/loop0 disk.img -o $((10860003 * 512))
# file -s /dev/loop0
/dev/loop0: Linux rev 1.0 ext3 filesystem data
# mount /dev/loop0 /mnt
[...]
# umount /mnt
# losetup -d /dev/loop0

That same blog post indicates that a newer package named "kpartx" may be able to automate the computation.

6
  • Thanks! I am trying but it does not run. fdisk shows "Unidades: sectores de 1 * 512 = 512 bytes", and /media/sdf1/Copia/copia.img starts at 539915109, but when I try to run losetup /dev/loop0 /media/sdf1/Copia/copia.img -o $((539915109 * 512)) I get "losetup: /media/sdf1/Copia/copia.img: error al configurar dispositivo de bucle: Dispositivo o recurso ocupado" (Device or resource occupied)
    – jfim88
    Feb 10, 2017 at 19:21
  • i can see that there are 4 partitions but when i try the losetup command it says that device is occuped
    – jfim88
    Feb 10, 2017 at 20:56
  • The device loop0 may have been created by your first attempt; either release it, or try with e.g. loop1.
    – dhag
    Feb 10, 2017 at 21:29
  • Seems that now runs. When tipe command File -s /dev/loop0 it shows "data". But when i try mount /dev/loop0 /mnt it shows an error. Says that codepage or auxiliar program lacks or another error. Incorrect file system type, incorrect option...
    – jfim88
    Feb 10, 2017 at 21:58
  • I just executed the command parted and it only shows 1 partition. Start 0B and ends 1000202241023B in NTFS.
    – jfim88
    Feb 10, 2017 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.