LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2004, 06:33 PM   #1
CrimZon
LQ Newbie
 
Registered: Aug 2003
Location: none
Distribution: none
Posts: 15

Rep: Reputation: 0
Defrag using a Linux system


I'm trying to find a program that allows me to defrag my HD through Linux.

Before anyone tells me that "Linux doesn't fragment", bear with me.

I have a 60 GB drive I access from both Win and Mandrake, Obviously, Win is the culprit for fragmenting the drive in the first place; however, using the drive in MDK appears to have little or no effect on the fragmentation on that drive.

From what I've seen, ' fsck ' and similar programs only check for errors.

Only for games and a handfull of programs do I actually use Win, MDK for everything else. Quite frankly, Win's ' Disk Defragmenter ' sucks.

ps - i found a program at freshmeat.net, aptly called ' defrag ' , but this seems to be back along the lines of filesystem checking (like ' fsck ') than anything.


Simply put: How can I defragment a HD in a Linux environment?

thanx in advance
 
Old 03-28-2004, 07:12 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
I don't know of any Linux tools to defragment FAT32
partitions ... one way of achieving this (if you have
enough spare disk-space in Linux) would be to
tar --remove-files -cvzf /<big_filesystem>/fat32.tar.gz /<fat32>/

After success, remove any possible remainders
(empty direcotries) ...

tar xvzf /<big_filesystem>/fat32.tar.gz -C /<fat32>/


If you have LOTS of space, and speed is more
important, omit the z :)



Cheers,
Tink
 
Old 03-28-2004, 08:11 PM   #3
karlan
Member
 
Registered: Aug 2003
Location: San Francisco, California
Distribution: Slackware
Posts: 158

Rep: Reputation: 30
I don't know how it linux, but I found this nifty utility which defrags ext2 partitions( ftp://ftp.uk.linux.org/pub/linux/sct/defrag/ )? I haven't used it yet
 
Old 03-28-2004, 08:30 PM   #4
vi0lat0r
Member
 
Registered: Aug 2003
Location: Lewisville, TX
Distribution: Kubuntu
Posts: 295

Rep: Reputation: 30
The one true defragmentation method:
Code:
mkdir newdir
cp -ar currentdir/* newdir/
mv currentdir/ olddir/
mv newdir/ currentdir/
rm -rf olddir/
Works like a charm.

Last edited by vi0lat0r; 03-28-2004 at 08:31 PM.
 
Old 03-28-2004, 09:10 PM   #5
CrimZon
LQ Newbie
 
Registered: Aug 2003
Location: none
Distribution: none
Posts: 15

Original Poster
Rep: Reputation: 0
Looks like the only real defrag is the gool ol' move-n-moveagain trick.

Hmmmmm. . . .oh well.

thanks anyhow guys!
 
Old 03-28-2004, 11:02 PM   #6
Soulful93
Member
 
Registered: Dec 2003
Location: Denver, CO
Distribution: SuSE 9.2 Slackware 10.1
Posts: 137

Rep: Reputation: 15
Oh, this brings up something I've been wondering about.

From what I've read and heard there really isn't any need to defrag a linux system due to the fact that it doesn't spit data out in the sloppy manner that windows does.

Does anyone know if this is true or am i offbase?
 
Old 03-28-2004, 11:10 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally posted by Soulful93
Does anyone know if this is true or am i offbase?
That's correct - Linux' filesystems newer than ext
are "fragmentation repellent" which means that
fragmentation CAN occur, but is less likely. It
only happens if you fill a partition pretty much
to the brink, delete small files and write big ones.


Cheers,
Tink
 
  


Reply


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 on Linux ashley75 Linux - General 27 02-05-2009 05:21 PM
Linux Defrag Hero Doug Linux - General 9 01-23-2004 09:24 PM
Does Linux have defrag... kjp_72 Linux - Software 7 04-19-2003 01:57 PM
Defrag in Linux? orange400 Linux - General 7 03-15-2003 03:32 AM
defrag causes mandrake to wipe out system dick19272000 Linux - General 1 02-17-2002 04:57 PM


All times are GMT -5. The time now is 08:19 AM.

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