Need help for getting hard-disk traces

When we write a programme,we declare variables and compiler allocates memory to them.I want to get access to the physical block number of hard-disk where actually the data is stored by the programme "

Some one help me out

Hope my question is clear

Usually programs don't have access to this, or need for it for that matter. So the answer to what you want is probably filesystem-specific, what filesystem are you using?

I am using ext-3 ... how will i be able to get exact places on hard-disk where it places them...I need to get the trace of them.....so that i can get a pattern where/how data is stored on hard-disk ...
hoping for reply

I think you're in luck, filefrag is a standard part of e2fsprogs (utilities for ext2, ext3, and ext4) which seems able to report what extents a file is using. Try filefrag -v filename. It reports in extents and filesystem blocks, not disk blocks, so a little research into how ext2 works may be necessary to translate this into physical disk locations. Reviewing its source code may point the way to finding more detailed information, if needed.

2 Likes