Linux - How do i know the block map of the given file and/or the free space map of the partition.

Posted by Inso Reiges on Stack Overflow See other posts from Stack Overflow or by Inso Reiges
Published on 2010-05-24T05:00:42Z Indexed on 2010/05/24 5:11 UTC
Read the original article Hit count: 279

Filed under:
|

Hello,

I am on Linux and need to know either of the two things:

1) If i have a regular file on some file system on a partition under Linux is there a way to know the set of the physical blocks that this file occupies on the drive from user space? Or at least the set of the file system's clusters?

2) Is there a way to get the same information about the whole free space of the given file system?

In both cases i understand that if there is any possible way to extract this info it will probably be totally unsafe and racy (anything could happen to these set of blocks between the time i see them and act on them somehow). I also really don't want an implementation that will have to know a lot about every filesystem.

© Stack Overflow or respective owner

Related posts about linux

Related posts about filesystems