<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>On Sep 28, 2015, at 01:07, gagan chhabra <<a href="mailto:gagan.13031990@gmail.com">gagan.13031990@gmail.com</a>> wrote:</div><div><br></div><blockquote type="cite"><div><div dir="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 virtual 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 written some lines of code and successfully able to read the partition entries and the superblock of each partition.<br></div></div></div></blockquote><div><br></div><span style="background-color: rgba(255, 255, 255, 0);">First question is why you are writing your own code to do this? Much</span><div><span style="background-color: rgba(255, 255, 255, 0);">better would be to attach a loop device to the image file to handle</span></div><div><span style="background-color: rgba(255, 255, 255, 0);">the partition table offset, then use libext2fs to open and access the</span></div><div><span style="background-color: rgba(255, 255, 255, 0);">filesystem any way you want.</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">I don't think it is possible to directly access </span>a filesystem within an image</div><div>directly, but if that is a requirement and loop devices cannot be used,</div><div>then this would be WAY easier to fix in libext2fs compared to rewriting</div><div>the full ext3/4 access yourself. </div><div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">That ensures it will be able to handle the myriad of different ext3/4</span></div><div><span style="background-color: rgba(255, 255, 255, 0);">options and combinations thereof, both now and in the future. <br><br>Cheers, Andreas</span><div><br><blockquote type="cite"><div><div dir="ltr">But now I am stuck and unable to read  block group descriptor table and inode table. Shall I post my code here? Any suggestion or resource would be of great help.<br><div><div></div><div><br clear="all"></div><div><div><div><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font color="#888888"><div dir="ltr"><span><font color="#888888">Thanks,<br>Gagan<br>
Mob: +91 97049 28427<br></font></span></div><div><span><font color="#888888"><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="cite"><div><span>_______________________________________________</span><br><span>Ext3-users mailing list</span><br><span><a href="mailto:Ext3-users@redhat.com">Ext3-users@redhat.com</a></span><br><span><a href="https://www.redhat.com/mailman/listinfo/ext3-users">https://www.redhat.com/mailman/listinfo/ext3-users</a></span></div></blockquote></div></div></div></body></html>