Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a .img file and I want to see what's inside of it. I tried mounting it, but I don't know what filesystem type it is. Is there a way to detect what it is so I can mount it? I'm using Ubuntu.

Essentially the command I think I need to do to browse it is:

mount -t <FS TYPE HERE> myimage.img /path/to/mount/dir/
share|improve this question
Try file, what's the output? Also, there's -t auto in mount, which will (try to) autodetect it. And you need -o loop to mount an image which is not a real device. – njsg Dec 29 '12 at 20:57
Not sure if it works with files, but try blkid -o value -s TYPE <file> – BitsOfNix Dec 29 '12 at 21:03
@njsg file gives image.img: data. Using -t auto still ask me for a fs type. Thanks for the -o loop tip. @AlexandreAlves The output of that command is blank. – gsingh2011 Dec 29 '12 at 21:04
Where did this image file come from? Can you share the first three or so lines of hexdump -C image.img to see if there is any clue? – njsg Dec 29 '12 at 21:10
@njsg afaik the -o loop isn't needed any more with the current mount on linux. – peterph Dec 29 '12 at 22:03
up vote 2 down vote accepted

mount itself has an autodetection option, -t auto, you can always try that.

To check the type of some file, I usually find file to be a pretty good tool, perhaps file -k if you want to be sure it does not stop at the first match.

If file fails to give you any useful information, you will have to look at the file yourself and try to find some clue (say, for example, by looking at hexdump -C). Some file types will have the file type name or some type-specific code at the beginning. That's what file relies on to detect many of the filetypes.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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