1

I have an unusual .img file that I wish to mount on my Debian 7 system. I tried mount but that does not work:

sudo mount -t udf overlay1.img /mnt/vehicle/ -o 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.

Next I tried to determine the partition system in this .img file:

sudo fdisk -l overlay1.img

Disk overlay1.img: 4 MiB, 4194304 bytes, 8192 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
Disklabel type: dos
Disk identifier: 0xcd42b400

Device        Boot      Start        End   Sectors   Size Id Type
overlay1.img1 ?    3892371390 4109164418 216793029 103.4G 72 unknown
overlay1.img2 ?    3287936629 3304577640  16641012     8G  6 FAT16

Partition table entries are not in disk order.

Any suggestions on how to mount this file system are welcome. I have only worked with simple .iso mounts before and would like to learn how to mount these as well.

  • 1
    the output from fdisk seems totally bogus. Try file overlay1.img to see what type of file it is. – meuh Jul 31 '16 at 18:47
  • file overlay1.img overlay1.img: DOS/MBR boot sector – learnerX Jul 31 '16 at 18:58
0

If this is a normal "single partition" image then just try to mount it normally and let the OS auto-guess the type:

mount -o loop -r overlay1.img /mnt/vehicle

If this is a raw disk image, including all the partition data then you can use losetup to add the device

losetup loop0 overlay1.img

That will setup /dev/loop0. You can verify it's been setup with

losetup -l

Now you need to setup the partitions:

kpartx -av /dev/loop0

This will create the entries such as /dev/mapper/loop0p1 and /dev/mapper/loop0p2.

Now you can mount them

mount -r /dev/mapper/loop0p1 /mnt/vehicle

When you have finished:

umount /mnt/vehicle
kpartx -dv /dev/loop0
losetup -d loop0
  • I am getting the following error: sudo kpartx -av /dev/loop0 device-mapper: resume ioctl on loop0p1 failed: Invalid argument create/reload failed on loop0p1 device-mapper: resume ioctl on loop0p2 failed: Invalid argument create/reload failed on loop0p2 – learnerX Jul 31 '16 at 18:56
  • That confirms the initial fdisk output - it looks corrupt; it's a 4Mb file but with a 100Gb partition inside? Looks wrong... You might want to examine it further with a hexdump (eg xxd) and look at the contents. – Stephen Harris Jul 31 '16 at 19:01

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.