inserting/deleting into/from the middle of large files?
'lo there, =)
having a DVB-S receiver running Linux (PPC) I found myself wondering how to delete data from the middle of a large file (stripping a recording of ads, for example - or messing around in a virtual disk file, etc.). Currently, the common way of doing this seems to be by copying the file (leaving a part behind) and then deleting the original. Of course, on a large file (say 12 GB) this can take an eternity; also you can run into trouble if the filesystem is nearly full...
Is it me, or doesn't that make any sense? Having a block-oriented filesystem, operations like this should only take an instance.
So basically I'm looking for functions to:
- insert a chunk into a file
- delete a chunk from a file
- move a chunk from one file into another
All of the above would be very useful when dealing with large data, such as DVB-recordings (Linux being the nr.1 OS on those receivers, naturally:-).
Seeing a large file as a chain of blocks, making such an operation on a block-sized basis should already be easy to accomplish. However, if you want full support there should be the possibility to insert "sparse blocks" (less content than the usual) within a chain of blocks (including the beginning).
Is this already possible?
Would it be difficult to implement?
Think about it: instead of copying gigabytes with the drive's heads clicking around - taking minutes to hours, such operations could be performed in (milli)seconds.
I think that there should indeed be a standard (Posix?) for providing such functionality. (One call could be to determine if the filesystem supports those operations fast - it could return a version for instance, 0 meaning that the operations, although provided, will be slow.)
What is needed in the first place however, is a filesystem supporting those operations - making it first choice for VDRs running Linux. (The others would surely follow soon after, at which point there should be the chance for establishing a standard.)
Looking forward for some enlightenment... :-)
LC ([email protected])
Signature · 2 lines
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kanns mit allen: http://www.gmx.net/de/go/multimessenger