Need to defrag ext3 (and don't tell me I don't need to)

Asked by ldillon

Despite the "smart" allocation features in ext3, one of my hard drives has become fragmented. Fsck report the drive as 55.4% non-contiguous.

The last time I looked in to this issue (about 15 years ago) the general advice for defraging unix filesystems was to tar it to a tape drive are restore it.

Other than that I might use rsync instead of tar, have we made any progress in the last decade and a half on this issue?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu yelp Edit question
Assignee:
No assignee Edit question
Solved by:
Thomas Krüger
Solved:
Last query:
Last reply:
Revision history for this message
Arnaudus (a-lerouzic) said :
#1

Short answer: you don't need to.

Long answer: ext3 partitions do not usually fragment. They do only if they are almost full. And fragmentation is not a problem per se (all systems fragment to some extent), so as long as your drives does not slow down significantly, just consider you don't have any problem.

So, if your drive is full (> 80%), free some space. The fragmentation level will decrease progressively.
If your drive is less full than it used to be, don't do anything.
If your drive has never been full, then you probably have a big problem and defrag will never fix it.

There are some very specific tools to defrag ext2 or ext3 partitions. The risk to destroy your partition doing that is several orders of magnitude higher than the benefits of degragging.

Useful readings:
http://ubuntuforums.org/showthread.php?t=712384
http://geekblog.oneandoneis2.org/index.php/2006/08/17/why_doesn_t_linux_need_defragmenting

Revision history for this message
Best Thomas Krüger (thkrueger) said :
#2

@Arnaudus: Yes, ext3 partition do fragment and they get slower and it is not always solved by deleting something. An experienced administrator know that and most have seen it. Most of the "unbelievers" just read about it.

Now to the question: There is still no fully reliable ext3 defrag tool but there is online defragmention planned for ext4: https://ols2006.108.redhat.com/2007/Reprints/sato-Reprint.pdf

So maybe you just have to wait an other 15 years. ;)

Revision history for this message
Sam_ (and-sam) said :
#3
Revision history for this message
Sam_ (and-sam) said :
#4

In case rewriting fragmented files
http://vleu.net/shake/

Revision history for this message
ldillon (ldillon) said :
#5

Short answer: No, but ext4 will have a defrag utility.

I respectfully withdraw the question.

One problem though,

When I try to click on the link: If this answers your question, please go to the following page to let us
know that it is solved: https://answers.launchpad.net/ubuntu/+question/71777/+confirm?answer_id=3

I get:

Not allowed here

Sorry, you don't have permission to access this page.

You are logged in as ldillon.

Revision history for this message
ldillon (ldillon) said :
#6

Short answer: No, but ext4 will have a defrag utility.

I respectfully withdraw the question.

One problem though,

When I try to click on the link: If this answers your question, please go to the following page to let us
know that it is solved: https://answers.launchpad.net/ubuntu/+question/71777/+confirm?answer_id=3

I get:

Not allowed here

Sorry, you don't have permission to access this page.

You are logged in as ldillon.

Revision history for this message
Campbell Hore (mozuku) said :
#7

ldillon, it looks like you created a second Launchpad account after posting your original question? As far as I know, only the original questioner can mark the question as solved, so you will probably need to log into your original Launchpad account ("<email address hidden>") to mark this question as solved.

Revision history for this message
Steve (stupendoussteve-deactivatedaccount) said :
#8

If you are not going to use one or the other launchpad account, please consider deactivating it as well.

Revision history for this message
ldillon (ldillon) said :
#9

Thanks Thomas Krüger, that solved my question.