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. |
.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. |
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 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 So the mount command would be Code:
mount -o loop,offset=65536 Stick.img /mnt/tmp |
Quote:
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 |
OK, the the image has a format unknown to me. Sorry, I can't help you with that.
|
Quote:
|
Quote:
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. |
Quote:
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/ |
Many, many thanks. All work perfectly.
|
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. |
Quote:
|
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. |
Quote:
Yes, I have noticed that but I had to thank him :) Thanks |
Quote:
|
Quote:
|
Quote:
Many years ago I had made an image file for backup purpose from my entirely 2.0 GByte pendrive using the 'dd' bash command. The pendrive was bootable, It had a bootable live-Devian version on it. Yesterday I was able to mount the image file by simply using the "mount" command without any offset at all and it worked pretty well. The other option that I had to access the image file content was to use again the 'dd' command to restore the image back to the original pendrive, but since the original pendrive has new content now, this option was discarded and I mounted the image file using: user~$ sudo mount -o loop /path/traveldata2gb.img /mnt/tmp [enter] My conclusion then is that apparently the "offset" statement (computed by using fdisk information on the image file) is not always mandatory. |
All times are GMT -5. The time now is 03:23 PM. |