Re: DataBlock information Help
Andreas Dilger <[email protected]>
| Newsgroups | gmane.comp.file-systems.ext3.user |
|---|---|
| Message-ID | <[email protected]> |
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.