LinuxQuestions.org
Help answer threads with 0 replies.
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 01-22-2014, 11:21 AM   #1
yukta
LQ Newbie
 
Registered: Jan 2014
Posts: 7

Rep: Reputation: Disabled
defragment harddisk


How can we defragment harddisk in linux. I am using fedora 14
please reply
 
Old 01-22-2014, 12:18 PM   #2
strick1226
Member
 
Registered: Feb 2005
Distribution: Arch, CentOS, Fedora, OS X, SLES, Ubuntu
Posts: 327

Rep: Reputation: 63
You're probably using ext3 as the filesystem and one of its features is that is doesn't become fragmented over time like many Windows-based filesystems.

In short, there aren't any "defragmentation" programs for linux as there is no need.

Hope this helps.
 
2 members found this post helpful.
Old 01-22-2014, 12:36 PM   #3
MaquinaX
LQ Newbie
 
Registered: Nov 2012
Posts: 4

Rep: Reputation: Disabled
Hello Yutka,
I find this to be some what funny, because I asked that same question when I first made my transition to Linux. If your harddrive is Formated under linux file system, such as ext2, ext3, ext4... or other linux variants, fragmentation does not occur because at the time that a file is created, it also allocates additional space for future changes, which actually keeps the file in location. If your system is acting slow, there may be other causes... such as a process taking
up all your memory, a program that didn't install properly, low system memory, or last... failing Hard Drive. Hope this helps.


MaquinaX
 
1 members found this post helpful.
Old 01-22-2014, 12:58 PM   #4
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 491Reputation: 491Reputation: 491Reputation: 491Reputation: 491
I have noticed that with kernels 3.10.x and newer, they've changed something in filesystem or file handling that really does make defragmenting obsolete. There are plenty of scripts out there that can defragment, and I do use one, but with kernel 3.10.x it doesn't need to defrag anything, because it seems to be done automatically, or at least file placement is such that it is not needed.

So, I would agree that it is no longer needed with newer kernels.
 
Old 01-22-2014, 06:00 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,702

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
There hasn't been any need to defragment disks since version 1... and the Ext2 filesystem.

What happens is that the disk uses a more optimum allocation that minimizes fragmentation.

Fragmentation only becomes an issue if you operate the filesystem for long periods of time at 98% capacity or higher.

By default, Linux native filesystems prevent that (well, reduce the occurance) by reserving 10% of the disk capacity for the root user, and being able to relocate blocks itself. This allows a reasonable overhead that minimizes the impact of fragmentation (it keeps it under around 1.5%). The 10% amount is only a default, it can be tuned for TB filesystems (where 10% is 10G) and set to 1% for such filesystems (see tunefs).

Some of the newer filesystems (btrfs, ext4fs) have an internal defragmenter that does optimize storage, but it isn't necessary to invoke it as it is built in. There are commands to defragment, but I believe these are just passed to the filesystem code to reallocate data.
 
3 members found this post helpful.
Old 01-22-2014, 08:08 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 16,671

Rep: Reputation: 2454Reputation: 2454Reputation: 2454Reputation: 2454Reputation: 2454Reputation: 2454Reputation: 2454Reputation: 2454Reputation: 2454Reputation: 2454Reputation: 2454
One could get into a fragmented situation. Kind of rare. I doubt you'd have an issue.

The suggested method is to tar off the data and return it. A backup and restore.
 
Old 01-22-2014, 09:29 PM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,702

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
The only time things got a bit dicey for me was when I filled the disk... Cleanup, get the free space down to 40/50 percent, and the fragmentation takes care of itself.
 
Old 01-22-2014, 09:36 PM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,702

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
The only time things got a bit dicey for me was when I filled the disk... Cleanup, get the free space down to 40/50 percent, and the fragmentation takes care of itself.

In my case, it was the root filesystem - and it was the logs that filled it. As the fragmented logs were deleted (age), the recovered space was no longer fragmented. I just needed to keep up with the logs better...
 
  


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
defragment EXT4? cccc Debian 29 11-04-2012 09:29 PM
Defragment Dovid Linux - Software 4 04-26-2005 01:46 PM
Low Harddisk space. Can I just transfer the entire Linux to a bigger harddisk? davidas Linux - Newbie 12 04-13-2004 02:03 AM
Defragment Anmar Linux - Hardware 2 09-09-2003 11:30 PM
defragment nautilus_1987 Linux - Software 45 12-11-2002 07:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:56 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration