Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   EXT3 Users (http://www.linux-archive.org/ext3-users/)
-   -   DataBlock information Help (http://www.linux-archive.org/ext3-users/343781-datablock-information-help.html)

Andreas Dilger 03-18-2010 10:13 PM

DataBlock information Help
 
On 2010-03-18, at 16:48, MirJafar Ali wrote:
I am using e2fsprogs and found it very nice. I want to know
datablocks for a given a given file.
I was going through the document and did lots of google search, but
I am not sure what is the best way to get this information. Which
"e2fsprogs" function can give all the datablock IDs. There is one
function i.e. ext2fs_block_iterate, but I am not sure how it works.
It wasn't clear from the

document.



If you use "dumpe2fs -c -R 'stat /path/to/file' /dev/XXX", where /path/
to/file is the filesystem relative pathname, that will dump all of the
blocks.


On newer kernels you can also use "filefrag -v" to list the blocks,
though the output format is less than ideal right now.


Programatically, on a newer kernel you can use the fiemap() API to get
the list of all blocks for any file, regardless of the filesystem type.


Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

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

Eric Sandeen 03-19-2010 01:16 AM

DataBlock information Help
 
MirJafar Ali wrote:
> Hello,
>
> I am using e2fsprogs and found it very nice. I want to know datablocks
> for a given a given file.
> I was going through the document and did lots of google search, but I am
> not sure what is the
> best way to get this information. Which "e2fsprogs" function can give
> all the datablock IDs. There
> is one function i.e. ext2fs_block_iterate, but I am not sure how it
> works. It wasn't clear from the
> document.
>
> Can someone please help without getting angry on this simple question ?
>
> Mir
>

>From the commandline, you can just use filefrag (-v)

If you want to do it programatically, you can look at how filefrag uses
the FIBMAP and/or FIEMAP ioctls.

If you want to do it with the filesystem unmounted, you can look at
how the debugfs "stat" command shows you the blocks.

-Eric

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


All times are GMT. The time now is 10:10 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.