Re: debugfs Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jon,

thanks a bunch!! that explains it now. 

-Aravind.

--- Jon Burgess <jburgess777@xxxxxxxxxxxxxx> wrote:

> On Thu, 2007-04-19 at 23:19 -0700, Aravindan
> Raghuveer wrote:
> > Hello!
> > 
> > I had recently posted a question on this list
> about
> > getting LBAs for a file on ext3. Andreas Dilger
> had
> > provided a very handy solution to solve the above
> > problem [Message attached along].
> > 
> > My goal is to be able to read files on a ext3
> > filesystem through the scsi generic (sg) driver. 
> > I first use debugfs to extract the block addresses
> for
> > every file. I then multiply the block address by 8
> > [4K/ 512] to obtain the LBAs. I then use a progam
> > sg_dd in the sg toolkit to read the data stored in
> the
> > LBA obtained above. 
> > 
> > However, the data I read through the sg driver
> does
> > not match the data in the file. Through some
> tinkering
> > of my code, I found that when I offset the
> original
> > LBA [obtained as block_address*8] by 63 sectors
> > [63*512 bytes], the data perfectly matches. That
> is
> > LBA' = LBA + 63 corresponds to the actual address
> used
> > for the file. I have tested this well when the
> file is
> > not fragmented. Initial testing on fragmented
> files
> > also shows similar behavior.
> > 
> 
> Are you accessing the raw disk or the partition
> containing the
> filesystem? 63 sounds suspiciously like the typical
> sector offset of the
> first partition on the disk. The filesystem block
> numbers are relative
> to the containing partition.
> 
> 
> # sfdisk -l -uS /dev/sda
> 
> Disk /dev/sda: 24321 cylinders, 255 heads, 63
> sectors/track
> Units = sectors of 512 bytes, counting from 0
> 
>    Device Boot    Start       End   #sectors  Id 
> System
> /dev/sda1   *        63   2104514    2104452  fd 
> Linux raid autodetect
> /dev/sda2       2104515 390716864  388612350  fd 
> Linux raid autodetect
> /dev/sda3             0         -          0   0 
> Empty
> /dev/sda4             0         -          0   0 
> Empty
> 
> 
> > I googled around but could not find a convincing
> > answer as to where this offset crops up from. Has
> > anyone in the group done a similar experiment? I
> would
> > really appreciate any pointers on this issue. 
> > 
> > thanks again, 
> > 
> > regards,
> > 
> > -Aravind.
> > 
> > 
> > --- Andreas Dilger <adilger@xxxxxxxxxxxxx> wrote:
> > 
> > > On Apr 16, 2007  11:17 -0700, Aravindan
> Raghuveer
> > > wrote:
> > > > I need to write a user space tool that can
> dump
> > > > logical block addresses used by every file in
> a
> > > ext3
> > > > file system. For example, if file foo uses
> LBAs
> > > 2,3
> > > > and file bar uses LBAs 100,102,156, then the
> > > ouptut
> > > > should read:
> > > > 
> > > > FILENAME    LBAs 
> > > > foo         2, 3
> > > > bar         100,102,156
> > > > 
> > > > Is there a tool that exists that can do this?
> If
> > > not,
> > > > what would be a good strategy to write this
> tool.
> > > I am
> > > > learning filesystem programming and would
> really
> > > > appreciate any pointers.
> > > 
> > > "debugfs -c -R 'stat /path/to/file' /dev/XXX"
> > > reports, among other things
> > > the blocks used by that file.
> > > 
> > > Cheers, Andreas
> > > --
> > > Andreas Dilger
> > > Principal Software Engineer
> > > Cluster File Systems, Inc.
> > > 
> > > 
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> > http://mail.yahoo.com 
> > 
> > _______________________________________________
> > Ext3-users mailing list
> > Ext3-users@xxxxxxxxxx
> > https://www.redhat.com/mailman/listinfo/ext3-users
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

_______________________________________________
Ext3-users mailing list
Ext3-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/ext3-users

[Index of Archives]         [Linux RAID]     [Kernel Development]     [Red Hat Install]     [Video 4 Linux]     [Postgresql]     [Fedora]     [Gimp]     [Yosemite News]

  Powered by Linux