Re: Editing-in-place of a large file

Ingo Oeser
2001-09-02T21:30:18Z

On Sun, Sep 02, 2001 at 03:21:37PM -0500, Bob McElrath wrote:
> I would like to take an extremely large file (multi-gigabyte) and edit
> it by removing a chunk out of the middle. This is easy enough by
> reading in the entire file and spitting it back out again, but it's
> hardly efficent to read in an 8GB file just to remove a 100MB segment.
>
> Is there another way to do this?

It's basically changing ownership (in terms of "which inode owns
which blocks") of blocks.

There is just no POSIX-API to do this, that's why there is no
simple way to do this.

Applications handling such large files usally implement a chunk
management, which can mark chunks as "unused" and skip them while
processing the file.

What's needed is a generalisation of sparse files and truncate().
They both handle similar problems.

For now I would seriously consider editing the ext2-structures
for this, because that's the only way you can do this right now.

Regards

Ingo Oeser
--
In der Wunschphantasie vieler Mann-Typen [ist die Frau] unsigned und
operatorvertraeglich. --- Dietz Proepper in dasr