Re: parse raw image to read block group desc table!

Andreas Dilger <[email protected]> Mon, 28 Sep 2015 13:55:11 -0600
Newsgroups gmane.comp.file-systems.ext3.user
Message-ID <[email protected]>
--===============7158793578157518559==
Content-Type: multipart/alternative;
	boundary=Apple-Mail-AAF3577E-0B99-4384-BA01-31E5E1C9E614
Content-Transfer-Encoding: 7bit


--Apple-Mail-AAF3577E-0B99-4384-BA01-31E5E1C9E614
Content-Type: text/plain;
	charset=us-ascii
Content-Transfer-Encoding: quoted-printable

On Sep 28, 2015, at 01:07, gagan chhabra <[email protected]> wrote:
>=20
> Hi,
>=20
> I am writing a piece of code to open a raw image file of a virtual machine=
 which has ubuntu installed in it. The virtual disk is formatted using MBR p=
artitioning method and has 3 primary and 1 extended partition.
>=20
> I want to open up that file and read the block group descriptor table and i=
node table for each partition. I have written some lines of code and success=
fully able to read the partition entries and the superblock of each partitio=
n.

First question is why you are writing your own code to do this? Much
better would be to attach a loop device to the image file to handle
the partition table offset, then use libext2fs to open and access the
filesystem any way you want.

I don't think it is possible to directly access a filesystem within an image=

directly, but if that is a requirement and loop devices cannot be used,
then this would be WAY easier to fix in libext2fs compared to rewriting
the full ext3/4 access yourself.=20

That ensures it will be able to handle the myriad of different ext3/4
options and combinations thereof, both now and in the future.=20

Cheers, Andreas

> But now I am stuck and unable to read  block group descriptor table and in=
ode table. Shall I post my code here? Any suggestion or resource would be of=
 great help.
>=20
> Thanks,
> Gagan
> Mob: +91 97049 28427
>=20
> _______________________________________________
> Ext3-users mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/ext3-users

--Apple-Mail-AAF3577E-0B99-4384-BA01-31E5E1C9E614
Content-Type: text/html;
	charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=3D=
utf-8"></head><body dir=3D"auto"><div>On Sep 28, 2015, at 01:07, gagan chhab=
ra &lt;<a href=3D"mailto:[email protected]">[email protected]<=
/a>&gt; wrote:</div><div><br></div><blockquote type=3D"cite"><div><div dir=3D=
"ltr"><div><div><div>Hi,<br><br></div>I am writing a piece of code to open a=
 raw image  file of a virtual machine which has ubuntu installed in it. The v=
irtual disk is formatted using MBR partitioning method and has 3 primary and=
 1 extended partition.<br><br></div>I want to open up that file and read the=
 block group descriptor table and inode table for each partition. I have wri=
tten some lines of code and successfully able to read the partition entries a=
nd the superblock of each partition.<br></div></div></div></blockquote><div>=
<br></div><span style=3D"background-color: rgba(255, 255, 255, 0);">First qu=
estion is why you are writing your own code to do this? Much</span><div><spa=
n style=3D"background-color: rgba(255, 255, 255, 0);">better would be to att=
ach a loop device to the image file to handle</span></div><div><span style=3D=
"background-color: rgba(255, 255, 255, 0);">the partition table offset, then=
 use libext2fs to open and access the</span></div><div><span style=3D"backgr=
ound-color: rgba(255, 255, 255, 0);">filesystem any way you want.</span></di=
v><div><span style=3D"background-color: rgba(255, 255, 255, 0);"><br></span>=
</div><div><span style=3D"background-color: rgba(255, 255, 255, 0);">I don't=
 think it is possible to directly access&nbsp;</span>a filesystem within an i=
mage</div><div>directly, but if that is a requirement and loop devices canno=
t be used,</div><div>then this would be WAY easier to fix in libext2fs compa=
red to rewriting</div><div>the full ext3/4 access yourself.&nbsp;</div><div>=
<div><span style=3D"background-color: rgba(255, 255, 255, 0);"><br></span></=
div><div><span style=3D"background-color: rgba(255, 255, 255, 0);">That ensu=
res it will be able to handle the myriad of different ext3/4</span></div><di=
v><span style=3D"background-color: rgba(255, 255, 255, 0);">options and comb=
inations thereof, both now and in the future.&nbsp;<br><br>Cheers, Andreas</=
span><div><br><blockquote type=3D"cite"><div><div dir=3D"ltr">But now I am s=
tuck and unable to read&nbsp; block group descriptor table and inode table. S=
hall I post my code here? Any suggestion or resource would be of great help.=
<br><div><div></div><div><br clear=3D"all"></div><div><div><div><div><div cl=
ass=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=
=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><font color=3D"#888888"=
><div dir=3D"ltr"><span><font color=3D"#888888">Thanks,<br>Gagan<br>
Mob: +91 97049 28427<br></font></span></div><div><span><font color=3D"#88888=
8"><br></font></span></div></font></div></div></div></div></div></div></div>=
</div></div></div></div>
</div></div></div></div></div>
</div></blockquote><blockquote type=3D"cite"><div><span>____________________=
___________________________</span><br><span>Ext3-users mailing list</span><b=
r><span><a href=3D"mailto:[email protected]">[email protected]</a></=
span><br><span><a href=3D"https://www.redhat.com/mailman/listinfo/ext3-users=
">https://www.redhat.com/mailman/listinfo/ext3-users</a></span></div></block=
quote></div></div></div></body></html>=

--Apple-Mail-AAF3577E-0B99-4384-BA01-31E5E1C9E614--


--===============7158793578157518559==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Ext3-users mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/ext3-users
--===============7158793578157518559==--