There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen boot bsod computer connection crash css dell display driver drivers email error excel explorer firefox firefox 3 freeze game hard drive internet internet explorer itunes laptop lcd linux malware monitor network networking nvidia outlook outlook 2003 outlook express partition printer problem router slow sound startup trojan usb video virus vista windows windows xp wireless
UNIX/Linux
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > UNIX/Linux >
Solved: Defrag question again!


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
brokenhead's Avatar
Computer Specs
Member with 61 posts.
 
Join Date: Oct 2006
Experience: Intermediate
29-Jan-2008, 06:01 PM #1
Solved: Defrag question again!
Quote:
Originally Posted by saikee
It is just one of the many design aspects that makes Linux or any Unix-like system a more stable and secure. For example an user never needs to defrag a Linux partition because a swap is used.
I've seen it claimed that defrag is either unnecessary or harmful or both. Saikee said the above in one thread, but I'm not sure I follow the logic. Windows also uses a swap file and has at least since 3.x, yet its performance is markedly improved by regular defrags. I know a pagefile in Windows is memory emulation, i.e., virtual memory. I was under the impression that is pecisely what a Linux swap is.

I use ext3 fs on my Ubuntu 7.10 install. I love it. I keep it updated. But constant updating just has to cause fragmentation. I know there are defrag utilities packaged with Ubuntu, at least for ext2 and ext3.

So far I have been frightened out of trying to run any defrag. But could someone please explain why it is either harmful or unnecessary?
bearqst's Avatar
Senior Member with 161 posts.
 
Join Date: May 2004
Location: Interior Alaska
Experience: Advanced
30-Jan-2008, 08:47 AM #2
A good description of the need / no need to defrag is at

http://www.linuxquestions.org/questi...-linux-331862/

Post #10
lotuseclat79's Avatar
Distinguished Member with 10,520 posts.
 
Join Date: Sep 2003
Location: -71.45091, 42.27841
30-Jan-2008, 09:09 AM #3
Hi brokenhead,

Linux ext2 and ext3 file systems calculate and allocate disk space on the fly to allow contiguous writing of files. This prevents files being written in pieces all across the disk, rather, they get written linearly.

There is no online ext3 defragmentation tool working on the file system level. An offline ext2 defragmenter, e2defrag, exists but requires that the ext3 filesystem be converted back to ext2 first. But depending on the feature bits turned on the filesystem, e2defrag may destroy data; it does not know how to treat many of the newer ext3 features.

There are userspace defragmentation tools like Shake and defrag, which work by copying each file and hoping the newly allocated file was not fragmented. However this only works if the filesystem is reasonably empty, and such filesystems are not usually fragmented. A true defragmentation tool does not exist for ext3.

The Linux System Administrator Guide states, "Modern Linux filesystem(s) keep fragmentation at a minimum by keeping all blocks in a file close together, even if they can't be stored in consecutive sectors. Some filesystems, like ext3, effectively allocate the free block that is nearest to other blocks in a file. Therefore it is not necessary to worry about fragmentation in a Linux system.

-- Tom
__________________
The independence created by philosophical insight is - in my opinion - the mark of distinction between a mere artisan or specialist and a real seeker after truth. - Einstein wrote in 1944.

Some say knowledge is power, I say knowledge without action is powerless. - lotuseclat79

Don't confuse action with movement. - Hemingway to Gardner

Imagination is more important than knowledge. - Einstein
brokenhead's Avatar
Computer Specs
Member with 61 posts.
 
Join Date: Oct 2006
Experience: Intermediate
30-Jan-2008, 03:16 PM #4
Thanks for the responses! You have convinced me that fragmentation is nothing to be concerned about with my Linux install. One less thing to worry about is always welcome!
RobLinux's Avatar
Computer Specs
Senior Member with 383 posts.
 
Join Date: Nov 2007
Location: UK
Experience: UNIX/Linux Pro, M$ 'doze Sufferer
03-Feb-2008, 12:55 PM #5
The file system lay out is clever using cylinder groups, and allocations for extensions of files is in the cylinder group. ext4 is looking at extent based allocation to improve large file performance, ext3 & ext2 try to be fairly intelligtent about it. Fragmentation is however inevitable, *BUT* it doesn't matter, as the disk i/o prioritisation minimises the effect of fragmentation, so long as a file has runs of blocks, in the same cylinder group, then moves to a different one every few megabytes, performance will stay good.

Windows degrades badly due to fragmentation, but "defragging" actually tends to make the situation worse, as subsequent deletes, and extends of files cause a vast increase in fragmentation, which would be avoided by using a sparser (more scattered) lay out.

Of course partitioning the disk into a number of file systems, reduces seek times, and fragmenation of heavily re-written areas (like /var which should be mostly empty) and reduces times on fsck(8) when that becomes necessary.

To defrag, copying out, deleting and restoring files should prove perfectly adequete. In my experience this has tended only to be necessary where large amount of small synchronous writes were performed (NFS v2 access to file system).
RootbeaR's Avatar
Computer Specs
Distinguished Member with 2,079 posts.
 
Join Date: Dec 2006
Location: Ontario, Canada
Experience: Getting it
07-Feb-2008, 11:26 AM #6
Here is a link to an article that tells why windows needs it.
http://forums.techguy.org/random-dis...ml#post5581672
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 04:22 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.