Detect filesystem type (can't mount filesystem image .img)

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?


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)

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