LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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: 3
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.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-24-2011, 02:37 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,453

Rep: Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342
.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: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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
 
11 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: 3
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
 
1 members found this post helpful.
Old 05-24-2011, 05:53 AM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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: 3
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: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
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.
 
3 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: 3
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/
 
2 members found this post helpful.
Old 11-27-2014, 04:10 AM   #9
gopyan
LQ Newbie
 
Registered: Jul 2014
Posts: 5

Rep: Reputation: Disabled
Many, many thanks. All work perfectly.
 
Old 12-04-2014, 09:00 AM   #10
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,927
Blog Entries: 45

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Moderator response

@gopyan
Please do not resurrect necro threads without adding constructive information to thread via posts. If you wish to honor the help then just press 'Did you find this post helpful?' Yes to find the post helpful. Or you can give Rep by pressing the scales icon under the members profile.
 
Old 09-07-2018, 05:08 AM   #11
Yakooza
LQ Newbie
 
Registered: Sep 2018
Posts: 25

Rep: Reputation: Disabled
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
I just wanted to thank you. It just solved my problem.
 
Old 09-07-2018, 03:07 PM   #12
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,019

Rep: Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630
Yakooza, hello and welcome to LQ.

Glad it still works.
Be sure you watch the age of the threads. A lot can change in 7 years.
 
1 members found this post helpful.
Old 09-09-2018, 08:02 PM   #13
Yakooza
LQ Newbie
 
Registered: Sep 2018
Posts: 25

Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
Yakooza, hello and welcome to LQ.

Glad it still works.
Be sure you watch the age of the threads. A lot can change in 7 years.
Thank you for your welcome.
Yes, I have noticed that but I had to thank him

Thanks
 
Old 09-10-2018, 04:06 AM   #14
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by Yakooza View Post
Thank you for your welcome.
Yes, I have noticed that but I had to thank him

Thanks
The chances are the poster in question doesn't even post on here any more. So, I'm afraid to say that, like this post, your post added noise, not signal.
 
Old 09-10-2018, 09:58 AM   #15
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,382

Rep: Reputation: 2761Reputation: 2761Reputation: 2761Reputation: 2761Reputation: 2761Reputation: 2761Reputation: 2761Reputation: 2761Reputation: 2761Reputation: 2761Reputation: 2761
Quote:
The chances are the poster in question doesn't even post on here any more.
Hehehe - Check the badge. Nothing like a good moderator spank to sharpen you up.
 
1 members found this post helpful.
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:29 PM.

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
Open Source Consulting | Domain Registration