2
1
Is there a way I can see which sectors of the hard disk a given file occupies?
The filesystem is ext3 or ext4 on Linux.
2
1
Is there a way I can see which sectors of the hard disk a given file occupies?
The filesystem is ext3 or ext4 on Linux.
2
If you are looking for blocks for file /tmp/squiggle/smurf.tgz, in the /tmp/ filesystem, mounted from /dev/sdg4, you would type:
# debugfs /dev/sdg4
> bmap /squiggle/smurf.tgz 0
> bmap /squiggle/smurf.tgz 1
> bmap /squiggle/smurf.tgz 2
> bmap /squiggle/smurf.tgz 3
....
Is that what you're looking for?
Yes, this seems to be what I'm looking for. I have a couple of follow-up questions:
It should be scriptable. I'd say piping your commands in on stdin would probably do the trick. Be very careful with that though, as you can do a LOT of damage to a filesystem with debugfs. As for doing this without root priv's, I don't know, but I suspect not. The filesystem is intended to be an abstraction that hides those details from the user. – Slartibartfast – 2010-06-23T02:44:03.927
Of course there is a way but it is not exactly what one would call "easy". What are you trying to accomplish? – msw – 2010-06-22T05:08:42.097
I'm performing an operation that requires reading a large amount of input data, and I want to pinpoint the cause of some anomalies in the performance of the reading. I want to know whether there is a correlation between the read performance and the physical layout of the input files on disk. This requires knowing what the physical layout of the input files is on the disk. – HighCommander4 – 2010-06-22T07:22:22.237