Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 04-06-2006, 07:58 AM   #1
Registered: Mar 2006
Distribution: Lilidog!
Posts: 337

Rep: Reputation: 33

Yeah, just that. Do I need a defragmentation program? is there one? does linux even work that way? hmmmmm......
Old 04-06-2006, 07:59 AM   #2
Senior Member
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Nope, linux filesystems do not need defragging, as they don't get fragmented the way windows does.

Makes me laugh every time I see a defrag screen...or for that matter a scandisk screen that takes SOOOO long to finish
Old 04-06-2006, 01:03 PM   #3
LQ Veteran
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
Correct - fragmentation really isn't an issue/concern with Linux file systems

This article may be of interest, personally I got a kick out of the phrase "fragmentation resistance" in describing *nix file systems
Old 04-06-2006, 01:25 PM   #4
Registered: Mar 2006
Distribution: Lilidog!
Posts: 337

Original Poster
Rep: Reputation: 33
Heh! Thanks for the article. I.m also looking for all the basic settings and such. I guess a kind of tweak guide for linux.
Old 04-06-2006, 02:00 PM   #5
Registered: Aug 2004
Location: Windsor Ontario
Distribution: Ubuntu, Debian, Redhat
Posts: 44

Rep: Reputation: 15
I really love the whole trend thats going around for windows boxes...
Got a problem running a game?? DEFRAGMENT!! cause defragging your hdd really makes your game work.. lol
Program won't launch? DEFRAG!!

Old 04-06-2006, 06:26 PM   #6
Senior Member
Registered: Sep 2004
Distribution: slackware
Posts: 4,441
Blog Entries: 7

Rep: Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551
Originally Posted by JakeX
Program won't launch? DEFRAG!!
Yeah. Didn't you know Defrag fixes all?

Back in the ol' dark DOS days, you'd have to use Norton Speed Disk to fix everything because MS didn't ship a defragger.
Old 04-06-2006, 06:44 PM   #7
Registered: Oct 2005
Location: Ontario, Canada
Distribution: Arch, Gentoo
Posts: 98

Rep: Reputation: 15
Disclaimer: the following seems (to me)like a logical way to defragment a partition. I just used these steps myself and nothing died. Please don't blame me if you kill something!

It's not exactly true that your linux filesystems don't get fragmented. If you are using ext2 or ext3 you can see an approximation of the fragmentation using e2fsck -f /dev/hdx. ONLY RUN THIS ON UNMOUNTED PARTITIONS!! This might mean you need to boot from a live CD.

You can 'defrag' any filesystem using this method (AFAIK), although if i remember correctly the resierfs tool to check the filesystem doesn't show and indicator of fragmentation. I have heard reiserfs fragments more easily than ext2 & 3 but i've never tested this.
linuxbox portage # umount /dev/vg/distfiles
linuxbox portage # e2fsck -f /dev/vg/distfiles 
e2fsck 1.38 (30-Jun-2005)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
distfiles: 565/262144 files (12.9% non-contiguous), 348321/524288 blocks
This shows 12.9% fragmentation. However, there are only 565 files using 1.3GB so this is not a big deal. It's possible to defragment this partition by remounting it and creating a tar archive of all the files on it. You can then remove all the files on the partition, format it if you really want, and then uncompress the archive back in place.
linuxbox portage # mount /dev/vg/distfiles
linuxbox portage # cd distfiles/
linuxbox distfiles # tar cpf /tmp/distfiles.tar *
linuxbox distfiles # rm -r *    
linuxbox distfiles # tar xpf /tmp/distfiles.tar
unmounting the partition again and running e2fsck -f /dev/vg/distfiles shows 5.0% non-contiguous.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
defrag? dna9 Linux - Software 3 11-18-2004 06:55 PM
defrag dreakon Linux - Newbie 1 11-13-2004 05:29 PM
Is it necessary to defrag? simsjr Linux - Newbie 7 04-27-2004 02:33 AM
How to defrag arsham Linux - General 2 04-01-2004 12:05 AM
Defrag dunmarie Linux - General 4 10-27-2003 02:42 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:46 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration