LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Defrag in Linux? (https://www.linuxquestions.org/questions/linux-general-1/defrag-in-linux-49861/)

orange400 03-14-2003 03:58 PM

Defrag in Linux?
 
Just curious ... is it possible to defrag a ext3 hdd in Linux?

hegobald 03-14-2003 04:18 PM

You don't have to.

orange400 03-14-2003 04:21 PM

??

Is it automatic?

RolledOat 03-14-2003 04:25 PM

I have researched this before, and it usually isn't needed. As far as I have ever been able to research, Linux will only fragment if there is actually not enough physical space left on the partition contiguous that it has to split the file. Of course, unless it is a 2 gig file, you probably have other problems if you get that full. For very small partitions with lots of files, it can become fairly fragmented because a large number of files neccesarily need to be split and keep getting split. This is only with ext2. I haven't found a single instance of defrag on ext3

One way is to simply backup and restore the partition.
I ran Redhat 7.0 for 4 years (upgraded recently), and on power failures where fsck ran I always saw the same old 1.1% non contiguous. :)

You can always
fsck N
means run, but just state what you would do.

RO

references
http://www.extremetech.com/article2/0,3973,49641,00.asp
http://www.linux.org/docs/ldp/howto/...s-HOWTO-6.html

orange400 03-14-2003 09:36 PM

It doesn't fragment?? Niiiice ... Thanks for the great info.

RolledOat 03-14-2003 09:52 PM

Add to that, no Registry clutter, no lost files, no continual performance degradation. The performance you have today is EXACTLY what you will have 5 years from now with ZERO maintenance. (Of course, barring the changes/services you activate post today :D)

The only maintenance I ever do is backup all the program sources I download, backup my work to CD and test my firewall once in a while.

RO

On a side note, I think the performance degradation is an unexpected perk or possibly intentional with another type of OS. How many have heard, 'this computer is getting really slow, I guess time for a new one'

fsbooks 03-14-2003 10:10 PM

This is off the top of my head, so I offer no guarantees on my information. Actually, my understanding is that the ext2 (& by extension, the ext3) filesystem actually fragments on purpose, but in a way that in efficient mechanically to read and that leaves appropriate free space for future files to also be written efficiently.

Moreover, contiguous files are not necessarily desirable on a multiuser/process operating system like linux. Say you have two files, both continguous in themselves, but on opposite sides of the platter. Say you are running two processes each accessing one of these files (but different). What is the poor disk to do?

The point is, it is not files themselves that must be contiguous, but rather a design for efficiency, so yes, "The performance you have today is EXACTLY what you will have 5 years from now with ZERO maintenance", (with many caveats, like, will my 7 year-old scsi disk last 5 more years? ;-)

orange400 03-15-2003 02:32 AM

Wow, that's great to hear! Windows systems just get all junked up like a 2-stroke weedwacker that's been sitting around in the shed flooded for 3 years.


All times are GMT -5. The time now is 06:15 PM.