LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

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

Rep: Reputation: Disabled
Mount a .img file


Hi,

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, 04:31 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
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...
http://www.andremiller.net/content/m...ns-using-linux
 
1 members found this post helpful.
Old 09-26-2012, 06:02 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 1,599

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Another option:
kpartx - Create device maps from partition tables
Code:
# losetup -f --show some_file.img
/dev/loop0
# 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, 08:46 PM   #4
jefro
Guru
 
Registered: Mar 2008
Posts: 12,073

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


Reply


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


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


All times are GMT -5. The time now is 05:57 AM.

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