[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Can't Defrag Ext3 File System



Leonard Chatagnier wrote:
Thanks for the reply as I would like to get to the bottom of this. I get the general message. However, contrary to what has been said, I have at least one partition with 4.5% fragmentation(e2fsck reports) which I don't consider a trivial amound.

It is a trivial amount. On ext3 filesystems with some fairly regular use you should see fragmentation always around 5%. This is normal, and has no impact in performance.

On DOS filesystems, the defrag program puts everything on the start of the drive. You may think that this is good for performance, but consider this:

- When a file has to be extended (after the fs having been defragged), the next block will be put after all the other files. This will is much worse than having a small amount of fragmented files on an ext3 fs, which will have all their blocks somewhat near.

This means that 5% fragmentation on an ext3 fs means basically nothing, whereas it may mean some performance degradation on a DOS fs.

Can you elaborate on why extension 3 file systems wont become fragmented over time.

*nix filesystems in general distribute files and their blocks in the fs, in ways that let them grow over time and reduce fragmentation. This could mean that some blocks are left free after some files are created, or that writes are deferred slightly in order to better know where to allocate new blocks and know if the file has potential to grow a lot or not.

Every fs has its own way to do it, but they don't suffer from performance degradation from fragmentation. Period.

Actually, there is one situation where this may actually happen: on very active filesystems, with almost no free space. In this case, fragmentation becomes an issue, but this mostly _never_ happens in real life, and when it does... dump/restore (move everything somewhere else, and then move it back).

Do I have to revert to ext 2 fs in order to defrag a hard drive safely? Debian appears to put out the message that ext3 file system is the greatest yet I don't seem to be able to use any utilities to maintain it.

You can't use e2defrag, which hardly qualifies as "any utilities".

Let me state this one more time: e2defrag is merely a proof-of-concept, nobody actually uses it (which is why it doesn't support the latest additions to ext3).

I know it is difficult to accept this, coming from a Windows background, but this is how things work in the unix world (or everywhere besides MS-land, for that matter).

Or if asking for comments on this is more than you care to do, perhaps you can offer some references(normal human readable types) that explains my concerns.

The references on this are mostly highly technical, and you can find a bunch of those by googling. But sometimes the best way to is just to try and forget the habits learned on MS-land and adopt a wait-and-see approach.

Just let your filesystems be, and in time you will realise that they works very well without the rituals you are used to perform on your Windows systems.

I know what I'm talking about, because I already asked the same questions you are asking now and it took me quite some time to finally believe it to be true.

And after 8 years using Linux all the time, I came to find the MS-land rituals somewhat exotic (if unix filesystems take care of themselves, why can't the so called New Technology File System?).

Why does Debian put out programs that will trash the system without at least giving some warning?

If it didn't give any warning, you would have a trashed fs by now. Refusing to work is enough warning, if you ask me.

Just to finish, I understand you wanting to know more before believing what we are saying, but understand that this is something that most unix folks know as fact, proven by everyday experience.

Most people don't actually know the specifics on why this is so, but know that their many-years-old filesystems don't turn slow just from using them.

Carlos Rodrigues



Reply to: