10

I am trying to mount a file image, like this

mount -o loop /tmp/apps.img /media/apps

But I get the following:

mount: you must specify the filesystem type

I try ext3:

mount -o loop /tmp/apps.img /media/apps -t ext3

dmesg says:

error: can't find ext3 filesystem on dev loop6.

I've also tried ext2, vfat etc. How can I detect the filesystem type of apps.img?

4
  • Could you try mount -o loop /tmp/apps.img /media/apps -t auto or does auto not work for filesystem images?
    – Mokubai
    Mar 11, 2011 at 13:39
  • Is the image an image of a partition or an entire disk?
    – Majenko
    Mar 11, 2011 at 13:55
  • @Matt: I don't know, this is linux embeded device firmware files, like : 100AEO6C0-1001H-apps.img, 100AEO6C0-1001H-loader.img, 100AEO6C0-1001H-rootfs1.img, 100AEO6C0-1001H-splash.img, 100AEO6C0-1001H-kernel.img
    – halorty
    Mar 16, 2011 at 12:07
  • @Mokubai , I tried, It doesn't work.
    – halorty
    Mar 16, 2011 at 12:08

3 Answers 3

6

I would use the file command combined with dd.

Full disk with MBR (change file.img to your file name):

$ dd if=file.img | file -
/dev/stdin: x86 boot sector; partition 1: ID=0x7, [.........snip.........]

So it is a full disk image and you want info on the first partition?

$ seq 100 | while read i ; do dd if=file.img bs=512 skip=$i | file - ; done | grep -v '/dev/stdin: data'
....garbage lines with perhaps useful informations,
if it's the case, give more info here.....

Perhaps it is compressed.

$ dd if=file.img | file -
/dev/stdin: gzip compressed data, from Unix, last modified: Wed Feb 23 19:26:14 2011

No problem, uncompress it on the fly:

$ dd if=file.img | gunzip | file -
/dev/stdin: ASCII cpio archive (SVR4 with no CRC)
4
  • 1
    I try $ dd if=file.img | file - output is: /dev/stdin: data
    – halorty
    Mar 16, 2011 at 6:29
  • /dev/stdin: SysEx File - /dev/stdin: SysEx File - /dev/stdin: DOS executable (COM) /dev/stdin: DBase 3 data file /dev/stdin: DBase 3 data file with memo(s) /dev/stdin: MPEG-4 LOAS, 4 or more streams, 8 or more streams /dev/stdin: DBase 3 data file with memo(s)
    – halorty
    Mar 16, 2011 at 12:02
  • @halorty: mostly unusable garbage... let's try dd if=file.img | strings | head -20 and see if there are readable things.
    – shellholic
    Mar 16, 2011 at 14:10
  • I try, output : Linux-2.6.17.14_stm22_0041-STB10, 1.00(AEO.6), kernel and messy strings.
    – halorty
    Mar 17, 2011 at 7:01
6

While the @shellholic answer has merit, the easier tool is "disktype" from: http://disktype.sourceforge.net/

Here's an example:

> sudo disktype /mnt/data0/xxxx.img 

--- /mnt/data0/xxxx.img
Regular file, size 30 GiB (32212254720 bytes)
DOS/MBR partition map
Partition 1: 29.99 GiB (32201938944 bytes, 62894412 sectors from 63, bootable)
  Type 0x07 (HPFS/NTFS)
  Windows NTLDR boot loader
  NTFS file system
    Volume size 29.99 GiB (32201938432 bytes, 62894411 sectors)

The programs "blkid" and "file" can detect filesystem type in some simple cases, but "disktype" is easier and more comprehensive. Depending on your distribution, you may need to compile it yourself with "make".

1
  • perfect! I also needed to knew what were the partitions!
    – rodvlopes
    Jul 31, 2014 at 0:54
5

blkid -o value -s TYPE /tmp/apps.img

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .