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

Michael <[email protected]> Wed, 13 May 2026 13:05:53 +0100
Newsgroups gmane.linux.gentoo.user
Message-ID <2192095.KlZ2vcFHjT@rogueboard>
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.
signature.asc (application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE-----

iQJPBAABCAA5FiEEXqhvaVh2ERicA8Ceseqq9sKVZxkFAmoEaSEbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJELHqqvbClWcZHT4P/3r+P3+Vna/Y7TrfViq8
9/JtCHFzmzx9iDqd6btSQUSvcQnnN74eqD7vxLe4K0OVABqvduymyPGfWyE0PweY
hjY5ShpR68pvrG2I+z/rM7NexAh746cAlXap0+7BPFWTobbJ9F9O+ftSEgITIA/x
TKDLD6RK68Qc3N+fhBq0M2Co9DDd7SSgX2N840tGxQsr95Ot1yvEJi2Qrfb7VXl2
snwleu30vX6Slugpwiv8yqaYXdFdPQK8afORzt4ouxQDa/vvYY58GV2XlKDUK26n
3oiPCFGalrK/jAYjzjfhMa0ANWcre5v1Z/4Q8gnx39pA18RbW/0jfGzEo1blV8CV
X2E42qp2MZ5c78TQ2jgdlE1nUacLb1M+df9Rff0v9ozgTaZkeOavwzWlXgUmuy5I
vh6mTWmWn5nK0j2zIkVS5OLE5upoHYSjjJScFlKSk1QS5D39AEjgQq1Ith31G1ul
WofWnrwdlqxpGOZMfjheLQIqobXljHALT9XtRtLKyHA3Q7H+9Iy4QGBCl0+GJ3cg
4MRiKobmfpiRj9JvbrViprCQspejBsQRXJV5qDmnP8+iY7I4IF9OsI/pgOqtc4ll
YPC6w9Wo2r96IbtsqgaEmNIwO88ukB9reUefkojhiAlJ1Z3cOTgsIUSN45aeLIpa
oq9LXOcx1WUpBWGW896/E5in
=fZVB
-----END PGP SIGNATURE-----