View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


LinkBack Search this Thread
Old 09-26-2012, 03:12 PM   #1
LQ Newbie
Registered: Feb 2012
Posts: 3

Rep: Reputation: Disabled
Mount a .img file


I'm having trouble mounting two .img files.

I have tried mounting using "mount -oloop ...." and I have tried using
losetup but nothing seems to be happening.

I'm running OpenSUSE 12.1

If I run the "file" command on both of them, this is what I get..

CP_OS.img: x86 boot sector; partition 1: ID=0x63, active,
starthead 1, startsector 63, 71762292 sectors, code offset 0xc0
IMAGE_DATA.img: x86 boot sector, Microsoft Windows XP MBR, Serial
0xfc139932; partition 1: ID=0x63, active, starthead 1, startsector 63,
143556777 sectors, code offset 0xc0

As you can see, they are quite large files and I am desperate to get
the data from them

Does anybody have any ideas how I can get these mounted? I would
really appreciate it and may even buy you a drink, or some chocolates,
or whatever takes your fancy...!

Many thanks in advance
Old 09-26-2012, 03:31 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,345

Rep: Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945
well as that's an entire disk, not a single partition you can't mount it.

Have a look at how this guy found the partition offsets to mount a partition directly...
1 members found this post helpful.
Old 09-26-2012, 05:02 PM   #3
Senior Member
Registered: Aug 2009
Distribution: CentOS
Posts: 1,180

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Another option:
kpartx - Create device maps from partition tables
# losetup -f --show some_file.img
# kpartx -a -v /dev/loop0
add map loop0p1 ...
add map loop0p2 ...
add map loop0p3 ...
Mountable devices will now be /dev/mapper/loop0p1, /dev/mapper/loop0p2, ... . Use "kpartx -d /dev/loop0" and "losetup -d /dev/loop0" to remove the mappings and free up the loop devices.

See the manpages for losetup and kpartx for more info.
Old 09-26-2012, 07:46 PM   #4
Registered: Mar 2008
Posts: 10,283

Rep: Reputation: 1258Reputation: 1258Reputation: 1258Reputation: 1258Reputation: 1258Reputation: 1258Reputation: 1258Reputation: 1258Reputation: 1258
I tend to use qemu to run that sort of file.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount image-sdb.img with mount? patrick295767 Linux - Newbie 2 03-28-2012 02:09 PM
[SOLVED] how to mount .img file linuxboy2008 Linux - General 7 05-24-2011 09:07 PM
[SOLVED] Mounting .img file (chromiumos.img); can't mount it?? Help please? linus72 Linux - General 2 11-27-2009 08:11 PM
How to mount .IMG CD? PhillipHuang Linux - General 2 08-10-2007 12:21 PM
Mount *.img file - What fs type tobiasw Linux - General 14 10-17-2006 03:43 PM

All times are GMT -5. The time now is 03:16 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration