Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
1  
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
1  
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
show 3 more comments

1 Answer

up vote 1 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
add comment

Your Answer

 
discard

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.