Re: File system defragmentation. Something that can resume after stopping.

Dale <[email protected]> Wed, 13 May 2026 10:56:21 -0500
Newsgroups gmane.linux.gentoo.user
Message-ID <[email protected]>
On 5/13/26 7:05 AM, Michael wrote:
> On Wednesday, 13 May 2026 12:35:50 British Summer Time Dale wrote:
>
>> Well, as it is, I'm kinda stuck.  I'd have to buy at least 3 or 4 hard
>> drives to put a different file system on and then transfer everything
>> over.  Given the price of hard drives, I don't plan to buy any hard
>> drives any time soon.  Plus, for most of my uses, ext4 does fine.
>> The biggest thing on this one file system, the files are always being
>> added to and plus new stuff being added.  My other file systems, I
>> copy files over but they are all done with one long write since they
>> are complete which makes them more likely to not be fragmented.  Once
>> they there, they don't change anymore.
>>
>> I was just hoping someone with some serious scripting skills had
>> invented this wheel already.  If they have, it sure is well hidden. Me
>> and Duck Duck Go couldn't find it and it seems no one else is aware
>> of it either.  LOL
>>
>> I'll just have to leave it running and maybe skip updates this
>> weekend.  Maybe it will finish by next weekend.  I should have ran it
>> within screen.  I just wonder how long it will stay with the lower
>> amount of fragmentation.  It's not like it isn't going to continue to
>> change a lot.  Heck, it's adding about 5 to 6MB/s as I type.  By the
>> time it finishes running, it may need to be run again.  :/
>>
>> Well, it was a thought.
>>
>> Dale
>>
>> :-)  :-)
> Another thought, are all the files requiring defragmentation in the same
> directory?  If not, then you can create directories/subdirectories and
> defrag them individually.  The defrag operation will not be any more
> efficient in itself, but directories which have had no changes in their
> content will not need to be defragmented again.  After the first run
> future defragmentation operations will last a shorter time.
>
> Someone more capable at scripting could probably hack something to check
> file modification times and feed the output directories to e4defrag, to
> save you the trouble performing the above manually.
>
>


I may be wrong on this but I think when you defrag, it kinda has to be 
done from start to finish.  I notice that file 1 is not the first file 
when I sort alphabetically but seems to be close when sorted by created 
first.  If I recall correctly, when you defrag a file somewhere in the 
middle of the drive, it changes other files as well as it is trying to 
make things fit.  That is what I sort of recall Spinrite and such doing 
way back in the day.  It could be that ext4 has a new method of doing 
this tho.  To be honest, I'm not sure it is going to do any good to have 
a resume option as it may not actually work if files it previously 
defragged has changed, which on this file system is totally possible and 
even likely.

It could be that the reason that e4defrag doesn't have this option is 
because it doesn't work well.  It may trip over its own feet or 
something.  It might be why no one else has did something to work around 
it either.

Oh well.  Maybe it will finish, in a week or two.  It's on file 74,041 
of 162,725.  It's eating the elephant.  One bite at a time. LOL

Dale

:-)  :-)