2

In Linux, I created an image of a flash disk as follows:

sudo dd if=/dev/sdb of=test.img

which I now want to mount directly. I tried the following command

sudo mount -t ext3 -o loop test.img /mnt/flash

which resulted in the following error:

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 shows the entry

EXT3-fs (loop0): error: can't find ext3 filesystem on dev loop0.

which I am not able to interpret. I get the same message when I omit the option -o loop.

Any ideas how I am able to mount the file image to /mnt/flash? I am not talking about mounting the actual flash disk, I want to mount the file.

Alex
  • 5,700
  • Try fdisk test.img. If it works press p. You'll see the partition table from /dev/sdb, and this indicates what you really wanted to copy was /dev/sdb1. – goldilocks Nov 06 '13 at 13:01

1 Answers1

1

You can only mount partitions, if there is a /dev/sdb there is probably /dev/sdbn with n in {1..8}. If there are partitions, you can only mount the partitions, not the entire disk. A fdisk test.img could work and show you the partitions in your file.

If you don't have /dev/sdbn devices, check /dev/mapper/, as flash disks/roms often define partitions in address ranges and the ranges will then be mapped to block devices. Also check your output of dmesg as the driver (often) tells you the address ranges and the devices they are mapped to, when it performs the mapping.

There may be a lot of other problems and reasons for them. What exactly do you mean by flash disk? SSDs? Flash ROMS? Something completely different?

How do you know there is an ext filesystem to mount? Could it be something else as well? Try and ommit -t ext3, depending on that your "flash disk" is and how it is supposed to be used, this may work.

Bananguin
  • 7,984
  • I know how to mount the partition of the flash disk, and this works fine. But this is not the question! I want to know, how to mount the file. There is no flash disk involved in my actual problem. I only have an image of the flash disk itself. – Alex Nov 06 '13 at 12:37
  • I gladly repeat myself: you can only mount partitions. Therefore your copy of the entire disk, i.e. /dev/sdb, is not likely to yield anything mountable. Especially if you "know" there are partitions on the flash disk it is "certain", that you can neither mount /dev/sdb, nor a copy thereof, not even if the copy is a file. As I said: If there are partitions, you can only mount the partitions, not the entire disk. This of course holds true for any complete copy. You're not failing at mounting the file, yet. You're failing at creating a file that can be mounted. – Bananguin Nov 06 '13 at 13:34
  • Then I would like to rephrase my question: How to mount a 'partition' of something I copied from a flash disk to a file, using the file alone? – Alex Nov 06 '13 at 13:39
  • Do that then. After that check out the man page of losetup. You need the offset and sizelimit. Use sfdisk -d (need factor 512) to find out the offset and sizelimit. – Bananguin Nov 06 '13 at 13:50
  • When you know what you are doing you needn't use losetup but can use mount like this: mount -o loop,offset=1024,sizelimit=65536 test.img /mnt/flash – Bananguin Nov 06 '13 at 13:56