LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 05-24-2011, 12:49 AM   #1
linuxboy2008
LQ Newbie
 
Registered: Feb 2011
Location: South
Distribution: ubuntu 10.04,debian 6.0
Posts: 19

Rep: Reputation: 1
how to mount .img file


hi,
i want to install arch-live-usb from harddisk instead of usb ;but i have occured a problem :

# file arch-live-usb_201105070115.img arch-live-usb_201105070115.img: x86 boot sector; partition 1: ID=0x83, starthead 32, startsector 2048, 591872 sectors, extended partition table (last)\011, code offset 0x0

from ID=0x83 we it's ext3

# mount -t ext3 -o loop arch-live-usb_201105070115.img /mnt/
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

# dmesg | tail
[13986.478722] VFS: Can't find ext3 filesystem on dev loop0.

# losetup -f arch-live-usb_201105070115.img
# losetup -a
/dev/loop0: [0809]:262025 (/home/sense/software/test/arch-live-usb_201105070115.img)
# mount /dev/loop0 /mnt/
mount: you must specify the filesystem type
# mount -t ext3 /dev/loop0 /mnt/
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
# dmesg | tail
[13986.478722] VFS: Can't find ext3 filesystem on dev loop0.

thank you.
 
Old 05-24-2011, 02:37 AM   #2
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,299

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
.img files are often compressed with gzip or cpio or both. To gather a distro into one file needs cpio or tar, cpio being preferred as it offers some compression.

run file on it.
 
Old 05-24-2011, 04:37 AM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,580
Blog Entries: 2

Rep: Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037
The problem is that the .img files are not images of a partition, but of a whole disk. That means they start with a bootloader and a partition table. You have to find out the offset of the partition and mount it with the offset option of mount.
If you do a
Code:
fdisk -l /path/to/image
it will show you the block-size and the start-block of the partition. You can use that to calculate the offset.
For example, I have an image of a bootable stick with a 4GB FAT32 partition. The output of the fdisk command is
Code:
Disk Stick.img: 3984 MB, 3984588800 bytes
249 heads, 6 sectors/track, 5209 cylinders, total 7782400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004bfaa

    Device Boot      Start         End      Blocks   Id  System
Stick.img1   *         128     8015999     4007936    b  W95 FAT32
So I have a block-size of 512 bytes and the start-block is 128. The offset is 512 * 128 = 65536.
So the mount command would be
Code:
mount -o loop,offset=65536 Stick.img /mnt/tmp
 
1 members found this post helpful.
Old 05-24-2011, 05:04 AM   #4
linuxboy2008
LQ Newbie
 
Registered: Feb 2011
Location: South
Distribution: ubuntu 10.04,debian 6.0
Posts: 19

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by TobiSGD View Post
The problem is that the .img files are not images of a partition, but of a whole disk. That means they start with a bootloader and a partition table. You have to find out the offset of the partition and mount it with the offset option of mount.
If you do a
Code:
fdisk -l /path/to/image
it will show you the block-size and the start-block of the partition. You can use that to calculate the offset.
For example, I have an image of a bootable stick with a 4GB FAT32 partition. The output of the fdisk command is
Code:
Disk Stick.img: 3984 MB, 3984588800 bytes
249 heads, 6 sectors/track, 5209 cylinders, total 7782400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004bfaa

    Device Boot      Start         End      Blocks   Id  System
Stick.img1   *         128     8015999     4007936    b  W95 FAT32
So I have a block-size of 512 bytes and the start-block is 128. The offset is 512 * 128 = 65536.
So the mount command would be
Code:
mount -o loop,offset=65536 Stick.img /mnt/tmp

thank you

that is the info on my computer:
# fdisk -l arch-live-usb_201105070115.img
You must set cylinders.
You can do this from the extra functions menu.

Disk arch-live-usb_201105070115.img: 0 MB, 0 bytes
248 heads, 19 sectors/track, 0 cylinders
Units = cylinders of 4712 * 512 = 2412544 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xff978785

Device Boot Start End Blocks Id System
arch-live-usb_201105070115.img1 1 127 295936 83 Linux
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(0, 32, 33) logical=(0, 107, 16)
Partition 1 has different physical/logical endings:
phys=(36, 247, 19) logical=(126, 10, 18)

# mount -o loop,offset=512 arch-live-usb_201105070115.img /mnt
mount: you must specify the filesystem type
# mount -t ext3 -o loop,offset=512 arch-live-usb_201105070115.img /mnt
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

# dmesg |tail
VFS: Can't find ext3 filesystem on dev loop0.

now i don't know how to do
 
Old 05-24-2011, 05:53 AM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,580
Blog Entries: 2

Rep: Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037Reputation: 4037
OK, the the image has a format unknown to me. Sorry, I can't help you with that.
 
Old 05-24-2011, 06:05 AM   #6
linuxboy2008
LQ Newbie
 
Registered: Feb 2011
Location: South
Distribution: ubuntu 10.04,debian 6.0
Posts: 19

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by TobiSGD View Post
OK, the the image has a format unknown to me. Sorry, I can't help you with that.
Thank you for the same
 
Old 05-24-2011, 08:56 AM   #7
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,008

Rep: Reputation: 367Reputation: 367Reputation: 367Reputation: 367
Quote:
VFS: Can't find ext3 filesystem on dev loop0.
You do not know for sure that the partition is formatted as ext3

The partition type of 0x83 just means "linux", and although that can mean ext3, it ain't necessarily so.

Try reading this post by David the H. where he is using the -t auto option to mount, to mount a partition within an image.
 
2 members found this post helpful.
Old 05-24-2011, 09:07 PM   #8
linuxboy2008
LQ Newbie
 
Registered: Feb 2011
Location: South
Distribution: ubuntu 10.04,debian 6.0
Posts: 19

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by tredegar View Post
You do not know for sure that the partition is formatted as ext3

The partition type of 0x83 just means "linux", and although that can mean ext3, it ain't necessarily so.

Try reading this post by David the H. where he is using the -t auto option to mount, to mount a partition within an image.
thank you very much!

it's work good now

# fdisk -lu arch-live-usb_201105070115.img
You must set cylinders.
You can do this from the extra functions menu.

Disk arch-live-usb_201105070115.img: 0 MB, 0 bytes
248 heads, 19 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xff978785

Device Boot Start End Blocks Id System
arch-live-usb_201105070115.img1 2048 593919 295936 83 Linux
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(0, 32, 33) logical=(0, 107, 16)
Partition 1 has different physical/logical endings:
phys=(36, 247, 19) logical=(126, 10, 18)

# mount -t auto -o loop,offset=$((2048*512)) arch-live-usb_201105070115.img /mnt/
 
1 members found this post helpful.
  


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] Mounting .img file (chromiumos.img); can't mount it?? Help please? linus72 Linux - General 2 11-27-2009 08:11 PM
How to mount/extract a .img ? linus72 Linux - General 11 08-06-2009 11:49 AM
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
Mount initrd.img? sti2envy Linux - General 3 02-12-2006 08:53 PM


All times are GMT -5. The time now is 03:55 PM.

Main Menu
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