Skip to contentSkip to conversation

open image file

DISCUSSION horseriver 6 participants 9 messages Feb 3, 2013 – Feb 5, 2013

lore
Share & tools
lore

horseriver

author
#0 lore raw

hi:

Is there mothod to look into a image file ?
How can I know its filesystem?

I have mounted my fd0 to /mnt with -t tmpfs ,but I find nothing under /mnt.How can I touch the files in image?

thanks!

#1 lore raw
Quoted 9 lines · horseriver

hi:

Is there mothod to look into a image file ?
How can I know its filesystem?

I have mounted my fd0 to /mnt with -t tmpfs ,but I find nothing under /mnt.How can I touch the files in image?

I think you need to mount it as loopback device

http://www.andremiller.net/content/mounting-hard-disk-image-including-partitions-using-linux

Quoted 8 lines

thanks!

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Signature · 6 lines
Thank you
Warm Regards
Anuz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130203/19d8acc0/attachment.html 
#2 lore raw
Quoted 18 lines · Anuz Pratap Singh Tomar

On Sun, Feb 3, 2013 at 2:03 AM, horseriver <[email protected] <mailto:[email protected]>> wrote:

hi:

Is there mothod to look into a image file ?
How can I know its filesystem?

I have mounted my fd0 to /mnt with -t tmpfs ,but I find nothing under /mnt.How can I touch the files in image?

I think you need to mount it as loopback device
http://www.andremiller.net/content/mounting-hard-disk-image-including-partitions-using-linux

Quoted 21 lines

thanks!

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
<mailto:[email protected]>
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Signature · 9 lines
Thank you
Warm Regards
Anuz


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Hi,

in case of image with multiple partitions, easier to use kpartx, then get the offsets with parted:
http://ppadala.net/blog/2010/09/kpartx-to-mount-vm-disk-images/

of course with image with one partition, it doesn't matter

Signature · 4 lines
br,
Zoltan Gyarmati
mail: mr.zoltan.gyarmati at gmail.com
freenode nick: zgyarmati
#3 lore raw
Quoted 7 lines · Zoltan Gyarmati

Hi,

in case of image with multiple partitions, easier to use kpartx, then get the offsets with parted:
http://ppadala.net/blog/2010/09/kpartx-to-mount-vm-disk-images/

of course with image with one partition, it doesn't matter

I think you meant an image of a drive with no partitions:

Ie.
mkfs /dev/sdb. Create a filesystem on the entire disk, there is no offset and no partitions (the entire disk is the filesystem, no mbr or gpt).

mkfs /dev/sdb1. Create a filesystem on the first partition, there is an offset even if it is the only partition. You examine the mbr or gpt to determine the offset.

Or possibly you meant an image of a partition:

dd if=/dev/sdb1 of=image_file. Create the image of a partition, no offset needed for loopback mount.

Greg

Signature · 1 line
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
#4 lore raw
Quoted 16 lines · Greg Freemyer
Quoted 7 lines · Zoltan Gyarmati

Hi,

in case of image with multiple partitions, easier to use kpartx, then get the offsets with parted:
http://ppadala.net/blog/2010/09/kpartx-to-mount-vm-disk-images/

of course with image with one partition, it doesn't matter

I think you meant an image of a drive with no partitions:

Ie.
mkfs /dev/sdb. Create a filesystem on the entire disk, there is no offset and no partitions (the entire disk is the filesystem, no mbr or gpt).

Quoted 8 lines

mkfs /dev/sdb1. Create a filesystem on the first partition, there is an offset even if it is the only partition. You examine the mbr or gpt to determine the offset.

Or possibly you meant an image of a partition:

dd if=/dev/sdb1 of=image_file. Create the image of a partition, no offset needed for loopback mount.

Greg

Indeed!
I was not accurate enough, thx for the comment.

Signature · 4 lines
br,
Zoltan Gyarmati
mail: mr.zoltan.gyarmati at gmail.com
freenode nick: zgyarmati
author
#5 lore raw
In reply to Greg Freemyer

hi:)

I have a image file ,after I input this command:

******
sh> losetup /dev/loop0 xx.img
sh> mount -t tmpfs /dev/loop0 /mnt

******

I find no content under /mnt ,But this image file contains a bootloader. What is the reason ? How can I check out the file tree structure of this image ?

thanks!

#6 lore raw
Quoted 8 lines · horseriver

hi:)

I have a image file ,after I input this command:

******
sh> losetup /dev/loop0 xx.img
sh> mount -t tmpfs /dev/loop0 /mnt

Quoted 8 lines

******

I find no content under /mnt ,But this image file contains a bootloader. What is the reason ? How can I check out the file tree structure of this
image ?

Determine the file type of your image file.
I suspect you are trying to look into the initrd images. These image files are compressed gzip images.

You can try extracting the image file then examine it's content.

gunzip -c <path_to_image_file> | cpio -id
The above command would extract the content of the image file in the current directory.

Hope this solves your problem.

thanks!

Quoted 7 lines

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130205/84795851/attachment.html

author
#7 lore raw

hi:

It is not a cpio archive , so that command can not work .

its file system type is tmpfs.

thanks!

#8 lore raw
Quoted 5 lines · horseriver

hi:

It is not a cpio archive , so that command can not work .

its file system type is tmpfs.

Umm. No. It's not tmpfs.

tmpfs is a specific ram/swap based filesystem - basically, take enough 4K pages for the size= parameter and do it in memory. Major user-visible difference from the older 'ramfs' is that tmpfs pages can move to swap space, and ramfs pages are nailed down in RAM.

mount -t tmpfs /dev/loop0 /mnt

This never actually looks at /dev/loop0 *at all*. You could even say this:

mount -t tmpfs none /mnt

and it would work just fine. Try leaving the '-t tmpfs' off entirely and
let the mount command figure out what type it is, and see if that works
any better for you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130205/70699028/attachment.bin