Why Linux doesn't need a defragmentation tool !?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

Why Linux doesn't need a defragmentation tool !?

Postby Hennen Dirk on Mon Jun 18, 2007 9:29 am

Another Newbie question !

All (ex) M$ Windows users know it. Windows writes data fragmented
to the harddisk , and sometimes makes a real mess of it !
So, now and then we need to run the defragmentation tool, to restore
fragmented data back to order, and speed up system performance again.
Linux doesn't use this tool, Why ??

I've noticed , every 26th boot , LinuxMint start up a general system check-up.
Maybe the defragmentation tool is build-in here !
Let's ask the forum about this ... ???

P.S. Specially for Mr. scorp123 and respect for the forum's netiquette standards, I've used only 3 question marks at the end of my story ! :)
Greetings to all Mint-lovers. I'm glad to be with you !
Hennen Dirk
Level 1
Level 1
 
Posts: 11
Joined: Tue Jun 05, 2007 7:40 am

Linux Mint is funded by ads and donations.
 

Postby ouilsen on Mon Jun 18, 2007 9:59 am

There are tools for defragmentation of ext2 filesystems. But first one has to see that usually defragmentation only results in small performance gains.

And at least for ext2/3 there is a simple rule to avoid defragmentation. Just keep some empty on your partition.

The filesystem check on every xth boot is only a consistency check. If everything is ok, nothing is changed.
ouilsen
Level 1
Level 1
 
Posts: 3
Joined: Sun Jun 17, 2007 6:37 pm

Postby clem on Mon Jun 18, 2007 10:00 am

Image
User avatar
clem
Level 15
Level 15
 
Posts: 5541
Joined: Wed Nov 15, 2006 8:34 am

Postby clem on Mon Jun 18, 2007 10:01 am

Checks every 30 boots, and you can change that with tunefs

Clem
Image
User avatar
clem
Level 15
Level 15
 
Posts: 5541
Joined: Wed Nov 15, 2006 8:34 am

Postby frank392 on Mon Jun 18, 2007 1:50 pm

frank392
Level 4
Level 4
 
Posts: 353
Joined: Wed Nov 22, 2006 1:29 pm

Re: Why Linux doesn't need a defragmentation tool !?

Postby scorp123 on Tue Jun 19, 2007 2:22 pm

Hennen Dirk wrote:Linux doesn't use this tool, Why ??
UNIX-like OS such as Linux but also the many *BSD variants (OpenBSD, FreeBSD, etc.) try everything they can to write any data in an intelligent way to the disks, e.g. they may reserve the right amount of data for a file that needs to be written in advance before the actual write operation happens. This helps to avoid fragmentation from happening in the first place.

Besides that you're not 100% precise. The modern XFS filesystem for Linux which originates from Silicon Graphics Inc. (sgi) and their IRIX Unix OS does have a xfs-defrag tool called xfs_fsr ... But you rarely rarely rarely will ever need it, because under normal circumstances XFS too will usually try everything it can to avoid fragmentation.

I am not 100% sure anymore about this, but I think that for example XFS auto-optimises itself in the background, you just need to leave the system running. If you're not happy you could still use various xfs-* tools to force a filesystem optimisation even while the filesystem is in use. (read the manuals ....)

Ext3 and ReiserFS try hard to avoid fragmentation from happening by paying attention how they write stuff to the disks in the first place; and even if stuff gets fragmented, they usually arrange all the needed extra-infos (inode tables, superblocks, indexes, and what not) in such a way that all the fragmented bits can be found as efficiently as possible.

So defraggers are really not an issue here on Linux (and the *BSD's).

On commercial UNIX platforms such as HP-UX and Solaris they don't even know what a defrag program is ... they never heard of such a stupid thing :D
User avatar
scorp123
Level 8
Level 8
 
Posts: 2287
Joined: Sat Dec 02, 2006 4:19 pm
Location: Switzerland


Return to Newbie Questions

Who is online

Users browsing this forum: baldrick.777, Bing [Bot] and 21 guests