| Scott Lurndal 2005-04-21, 5:46 pm |
| "Anthropos" <Anthropos@SWBell.net> writes:
>Are there system calls (or file system utilities) available in Linux to do
>the following:
>
>1. Obtain the data sector addresses for all sectors containing a specific
>file's data (not the pointers to the data)?
>
Yes. You can get this information, but depending on the filesystem
(i.e. is it mounted or not), it may be stale by the time you use it. you
would need a fair amount of filesystem expertise to even attempt this.
> (Obviously, the pointers for a file contain that information. The
>question is: can it be accessed?)
>
>2. Write to a specific sector address?
Yes.
One must be very careful to do this only on a non-active (i.e. not mounted)
filesystem. You can read and write any sector by accessing the partition
directly through the appropriate device. Unless you are familiar with the
metadata organization of the filesystem, I wouldn't even try.
Why not just open the file with open(2) and write to it with pwrite(2)?
scott
|