On Wed, Jul 2, 2014 at 11:15 AM, Carlos E. R. <robin.listas@telefonica.net> wrote:
To totally avoid fragmentation, you have to assign the full space for each file at the instant of creation, and separate files one from another sufficiently so that they can grow. When the disk gets quite filled, the strategy fails. It is possible to move about files while the system is running, if designed carefully. The easiest is to move unused files on iddle system periods - but I don't know of any operating system doing it.
I'm not quite sure what you're saying. e4defrag will defrag an extent based filesystem (as opposed to a block based filesystem like ext2). It does it with the filesystem online. Several years ago I had studied the code and as I recall for a non-sparse file it calls fallocate to allocate a new file of the same size, then compares the number of extents in the original and new file. If the number of extents is less in the new file, it moves the blocks from the old locations to the new ones. The move is handled in the kernel directly so the locking is pretty granular as I recall. It wasn't extremely robust 4 or 5 years ago, but I assume the bugs have been worked out by now and it is safe to call it via cron as desired. Admittedly, I haven't used it much myself. I was evaluating the code base for a different use case. Greg -- Greg Freemyer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org