News for hackers. Stuff that matters.
Re:Why Linux Doesn’t Need Defragmenting by ars on Thursday May 31, 2012 @05:15PM (#4050414)
The trouble is I did use a filesystem all the way to completely full, and now it's severely fragmented (despite me resizing it larger) and I have no practical way of unfragmenting it.
Re:Why Linux Doesn’t Need Defragmenting by joejohnson on Thursday May 31, 2012 @05:23PM (#4050455)
From the article: "If you actually need to defragment a file system, the simplest way is probably the most reliable: Copy all the files off the partition, erase the partition, then copy the files back onto the partition. The file system will intelligently allocate the files as you copy them back onto the disk."
Re:Why Linux Doesn’t Need Defragmenting by gouranga on Thursday May 31, 2012 @05:39PM (#4050518)
Isn't that a form of defragmenting? It also contradicts the point that it is unecessary to defragment the volume.
Re:Why Linux Doesn’t Need Defragmenting by dredmorbius on Thursday May 31, 2012 @06:58PM (#4050879)
It's extremely rare to need to do this.

It's generally a sign that you're running your disks / filesystems overutilized. Retaining 10-20% free space is generally encouraged.

If you do elect to do the "copy out, wipe, copy in" method, you can do this, in general, while not completely losing the use of your system. There are some tricks (union mounts, remounting filesystems) which will allow you to flip between filesystems, in most cases. Specifics will depend on your partitioning scheme, use case, and the filesystems under consideration (usually you'd be dealing with user files under /home, spool or variable files under /var, source trees, etc.).

As the article states, Linux systems generally experience very minimal fragmentation, and dynamically resolve the issue for you, unlike Windows. You can typically run a Linux system for years, given a 10-20% disk reserve, without running into appreciable fragmentation issues. The gains from any sort of manual defragmentation would be minimal compared to the cost of performing the task.

Re:Why Linux Doesn’t Need Defragmenting by Lerc on Thursday May 31, 2012 @05:46PM (#4050563)
That is true for any filesystem that needs defragging. The entire notion of a disk defragmentor is that it fixes the problem without needing to do this step.

It's like saying "Our car never breaks down so you don't need to be able to repair it. Even if it does break down you can still walk."

Re:Why Linux Doesn’t Need Defragmenting by sltkr on Thursday May 31, 2012 @05:38PM (#4050515)
There are tools like Shake [1] that can semi-intelligently copy fragmented files around to defragment them, which typically results in less fragments if there is enough free space on the volume.

1. http://www.vleu.net/shake/

Re:Why Linux Doesn’t Need Defragmenting by drostie on Thursday May 31, 2012 @06:08PM (#4050660)
I had that problem at one point. I vaguely recall that I unmounted my home partition and fscked it at one point to find the fragmented inodes, then there was complicated magic to find the filenames that those inodes referred to, and then there was a script which copied them all to a tmpfs (i.e. into memory), deleted the original, and copied the copy back out.

One of the goals of recent ext4 work was to get support for "online defragmentation" but I don't know to what extent it's automatic, what tools exist, et cetera. It sounds like pyfragtools also has attempted to solve this problem.

Re:Why Linux Doesn’t Need Defragmenting by gcr on Friday June 01, 2012 @01:22AM (#4052097)
If your filesystem is completely full, fragmentation should be the last of your worries.
Re:Why Linux Doesn’t Need Defragmenting by ars on Friday June 01, 2012 @05:25AM (#4052641)
It was full, now I expanded it, but the old data is still heavily fragmented.
Re:Why Linux Doesn’t Need Defragmenting by ajross on Thursday May 31, 2012 @06:57PM (#4050874)
Uh... attaching new media and using "tar" isn't a practical way of unfragmenting it? Hard drives are almost free in the modern world.
Re:Why Linux Doesn’t Need Defragmenting by shawnz on Thursday May 31, 2012 @08:19PM (#4051185)
When compared to having a (reasonably simple) tool which will do it for free, using only one volume, while still allowing r/w access? Yes, it's impractical.