LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 01-05-2005, 07:26 AM   #1
fhameed
Member
 
Registered: Oct 2003
Location: Pakistan
Posts: 59

Rep: Reputation: 15
how to defragment a linux partition??


Hello everyone

1.I'm intrested in defraging my linux partition just as we do in windows.

2.How to install packages from command line.


It's been 2 years since i've defragment my servers and it's about time.

Thanks

Fahad
 
Old 01-05-2005, 07:30 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Reboot into single user mode and run a manual fsck which will tell you the percentage of fragmentation.. majority of the time, I'd say 95% of the time you will never need to defrag your Linux drives, the Lnux filesystems are superior to Windows and don't get fragmented.
 
Old 01-05-2005, 07:37 AM   #3
scinerd
LQ Newbie
 
Registered: Jan 2005
Location: usa
Distribution: Ubuntu, Centos
Posts: 16

Rep: Reputation: 0
trickykid is right you shouldn't have to do this. In the past when I have asked about this I was told the only way to do it is to backup the file system remove it and recreate it then restore the data. I wouldn't worry about it I run a ton of servers for long periods of time and have never had a framation problem.
 
Old 01-05-2005, 07:44 AM   #4
cidrolin
Member
 
Registered: Jul 2004
Distribution: Fedora c2
Posts: 89

Rep: Reputation: 15
you might want to read that :

https://www.redhat.com/archives/redh.../msg01240.html

no need, no way, no work ! I like this OS !
 
Old 01-05-2005, 08:33 AM   #5
Cron
Member
 
Registered: Jun 2004
Location: Lithuania
Distribution: FreeBSD, Arch, Ubuntu
Posts: 145

Rep: Reputation: 15
As for packages: What distro are you using?
 
Old 01-07-2005, 09:23 AM   #6
fhameed
Member
 
Registered: Oct 2003
Location: Pakistan
Posts: 59

Original Poster
Rep: Reputation: 15
My distros RH

Hello

I'm using RH 9.

However if ever i'm intrested in defrag is their a proper way from command line.

Thanks everyone

Fahad
 
Old 01-07-2005, 10:24 AM   #7
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
I would very much doubt it.

A defragmenting tool is actually quite difficult to implement. For performance, you have to try and keep files together that are likely to be accessed at about the same time, as well as just putting file fragments together and consolidating the free space. Also, you need to allow read/write access to the filesystem during this time, to prevent the need to take the machine offline. For performance, you also need to minimize the number of disk reads/writes, which is not an easy requirement to accommodate.

This is all much easier to do in the filesystem driver than it is in a user-space utility, so I doubt that we'll see a user-space defrag tool anytime soon; it's far more likely that we'll just keep seeing better and less fragmentey filesystems. I guess that Windows can't do this because of the need to support old legacy programs that access the disk directly.

The easiest and safest way to defragment a hard disk is still to take all the files off it and then put them back onto it again. Works every time.
 
Old 01-07-2005, 10:37 AM   #8
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Quote:
However if ever i'm intrested in defrag is their a proper way from command line.
You need to have the partition unmounted as in boot up from a rescue cd.
For example: to run this on /dev/hdb1
You can run the command: e2fsck -f /dev/hdb1
You can try it without the -f ( force ) switch first. More commands with e2fsck --help
 
  


Reply



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
defragment for Linux alaios Linux - General 1 08-16-2005 03:15 AM
defragment linux glock19 Linux - General 11 09-14-2004 06:22 PM
No Defragment for Linux weronpc Linux - Newbie 6 02-11-2004 12:21 PM
Defragment in Linux ras123 Linux - General 5 02-05-2004 04:10 PM
filesystem: linux needs to "defragment"? sirpelidor Linux - Newbie 6 01-02-2004 08:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:15 PM.

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
Open Source Consulting | Domain Registration