In the linux kernel, are there any data structures that automatically always hold the last written block number for a partition? I can't find any built-in kernel source that could be used to get this information. Any help is appreciated.
+1
A:
If you want to know the last block of a partition that has ever been writen by the system, you're probably not going to find that.
If what you want is to know where you could truncate a partition without loosing "useful" data, knowing the last writen block is not enough, since you would have to deal with the filesystem's structure so that it "knows" the size of the partition has change.
If your intention is being able to programaticaly resize a partition without data loss, I recommend using libparted for that.
goedson
2010-04-06 12:48:04