LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 01-08-2007, 08:49 PM   #1
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Rep: Reputation: 30
Does a Linux system get fragmented when 20% or less is free


I've heard before Linux systems don't get fragmented. I read a guide why and it seemed pretty interesting. However, one thing I thought of was that a Linux system will not get fragmented as long as there's say 20% free space available. What I'm wondering is if almost all the space is taken will the partition become fragmented? More importantly if the space is freed up again will Linux correct the partition?
 
Old 01-08-2007, 08:58 PM   #2
Okie
Member
 
Registered: Mar 2002
Location: Oklahoma
Posts: 964

Rep: Reputation: 34
Linux does not make a mess out of the system like Windows does so defragmenting is not necessary, as something as important as this i would tend to think the top dawgs that develop Linux and the GNU tools would have made a defragmenting utility for it...

i have a Slackware-10.2 install well over a year old that never gives me problems...
 
Old 01-08-2007, 09:01 PM   #3
shorty943
Member
 
Registered: Dec 2006
Location: Tailem Bend. South Australia
Distribution: Mandriva 2006
Posts: 124

Rep: Reputation: 15
Unlike some other OS's, Linux does not put little pieces of a file all over the place. The Linux filing system puts all of the file, any file, in the one cubby hole. So there is never any file fragmentation. If your system is getting cluttered, it may be log files, Linux logs lots. Search your system, and rid it of old log files. Maybe even buy a bigger hard drive and install it as a new /home/user partition. Myself, I don't have space problems. Installed a raid set of 4x40Gb disks to my server, got me big bit bucket.
Linux does not fragment like MS Winslows, period.

Shorty943.

registered Linux user 437639
 
Old 01-08-2007, 09:22 PM   #4
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Original Poster
Rep: Reputation: 30
Reply

I saw the way Linux organizes files. If I got this right Windows stores their files:

aaaaaaabbbbccccc****************************
********************************************
********************************************
********************************************

If someone deleted file b and created d it would be added like this:

aaaaaaaddddcccccddddddddeeeee***************
********************************************
********************************************
********************************************

b is deleted and d is first written to the space that b left over. d then writes the rest to the next area of free space. Hence the data is fragmented. Linux on the other hand writes the data.


***************aaaaaaa**********************
***************bbbb*************************
***************ccccc************************
********************************************

So when b is deleted, d is written in it's place which avoids fragmentation. However if Linux has very little space left it can't possibly use this method and would need to look for free space anywhere it could. So how could this not get fragmented?
 
Old 01-08-2007, 10:17 PM   #5
shorty943
Member
 
Registered: Dec 2006
Location: Tailem Bend. South Australia
Distribution: Mandriva 2006
Posts: 124

Rep: Reputation: 15
Quite simple. Stop thinking the Microsoft way. Just stop thinking and accept, that Linux DOES NOT FRAGMENT FILES.

Shorty943.
 
Old 01-08-2007, 10:27 PM   #6
fudam
Member
 
Registered: Feb 2006
Distribution: FC
Posts: 86

Rep: Reputation: 15
It seems like HGeneAnthony is asking a good, technical question. In the end, whether it's linux, windows, or os/2 a partition is still a bunch of clusters and there's got to be some methodology to how you store data.

I wouldn't expect "Just stop thinking and accept" as a reply on a Linux forum. Linux is all about thinking, and not at all about accepting...
 
Old 01-08-2007, 10:42 PM   #7
Sepero
Member
 
Registered: Jul 2004
Location: Tampa, Florida, USA
Distribution: Ubuntu
Posts: 734
Blog Entries: 1

Rep: Reputation: 31
Run fsck on your filesystem. After it is finished, it will say X.X% non-contigious files. That percentage is how much fragmentation you have on your system.

Yes, as space goes down, fragmentation can tend to go up. I have roughly 40 to 0 Megs available at given time on one of my systems. Last time I checked it, I think it was between 5-10% fragmentation. (That is really HIGH for Linux!)
 
Old 01-10-2007, 12:36 AM   #8
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Original Poster
Rep: Reputation: 30
Reply

Really surprised to get a shut up and accept it without question answer on a Linux forum. Sepero made a good point. He on occasions has had between 5 to 10% fragmentation on his system. So shorty943 what's your response to this?
 
Old 01-10-2007, 01:37 AM   #9
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
Fragmentation can happen on Linux filesystems, but only if the disk is almost full. There are many articles on the net that discuss this issues, so doing a search on Google might be helpful.
 
Old 01-10-2007, 03:39 AM   #10
eyebrowsoffire
Member
 
Registered: Sep 2004
Location: Goleta, CA
Distribution: Fedora Core 6
Posts: 55

Rep: Reputation: 15
I don't really know very much about this, but I thought I'd put in my two cents:

I read somewhere that even when linux filesystems get fragmented that it has very little or no effect on performance.
 
Old 01-10-2007, 04:20 AM   #11
Sepero
Member
 
Registered: Jul 2004
Location: Tampa, Florida, USA
Distribution: Ubuntu
Posts: 734
Blog Entries: 1

Rep: Reputation: 31
Quote:
Originally Posted by HGeneAnthony
Really surprised to get a shut up and accept it without question answer on a Linux forum.
Please don't be. There are members that help more, and members that help less in every community. The Linux community is no exception.

I posted my fragmentatin to prove a point. IMHO, even on a highly congested system with 5-10% fragmentation, it is not going to have much effect at all. It is not enough to worry about. Linux takes care of fragmentation so you don't have to.

On my desktop system, I've never seen it even reach 2%.
 
Old 01-10-2007, 06:06 AM   #12
Daws
Member
 
Registered: May 2006
Location: UK
Distribution: Debian, Linux From Scratch
Posts: 416
Blog Entries: 1

Rep: Reputation: 32
Hmmm. When I was at school contiguous meant touching or adjacent to. Don't quote me on this but I believe that non-contiguous files do not affect performance (the file is still at one location).

****aaaabbbbcccc****

here a, b and c are contiguous.

If you delete b:

****aaaa****cccc****

a and c are non-contiguous, but not fragmented. It is the free space that is fragmented. This will inevitably lead to file fragmentation as the disk fills up though.

--

I'm not entirely sure how it all works but I think in the windows world if I write an 8* file, d:

ddddaaaaddddcccc****

this would happen. File d is now fragmented.

I think in linux either c is moved before writing

****aaaaccccdddddddd

or it is written fragmented as in windows and fixed later on.

It does entirely depend on the filesystem in use however. I quite like XFS, but I have no idea how it deals with fragmentation.
 
Old 01-10-2007, 08:09 AM   #13
shorty943
Member
 
Registered: Dec 2006
Location: Tailem Bend. South Australia
Distribution: Mandriva 2006
Posts: 124

Rep: Reputation: 15
Red face

Quote:
Originally Posted by HGeneAnthony
Really surprised to get a shut up and accept it without question answer on a Linux forum. Sepero made a good point. He on occasions has had between 5 to 10% fragmentation on his system. So shorty943 what's your response to this?
1 I did not say shut up. Period. My statement was stop thinking the windows way. Maybe my system does not get that choked up that it begins to fragment.

2 I regret my frustration showing, sorry.

3 So. Happy?

A thank you to sepero for the understanding mind.


Shorty.

Last edited by shorty943; 01-10-2007 at 08:15 AM.
 
Old 01-10-2007, 09:04 AM   #14
jerril
Member
 
Registered: Nov 2005
Location: Ontario, Canada
Distribution: Ubuntu
Posts: 114

Rep: Reputation: 15
When you get to the point where a Linux partition is fragmenting, a windows system would become almost unusable, there would be no room for virtual memory let alone a defrag run.

I haven't filled up a drive in a long time; most of my files are stored on one huge drive. From what I remember, you don't want to let any drive on any system get too full, ever.

jer
 
Old 01-10-2007, 01:10 PM   #15
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Original Poster
Rep: Reputation: 30
Reply

Thanks for the replies although it doesn't really answer my question. Now if Linux reorganizes the disk on the fly it would eliminate fragmentation once the free space is over 20% again, however I never got an answer on whether this was the case. I'm just trying to understand why it never gets fragmented for when I talk to my Windows friends rather than I'm concerned about fragmentation.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
any know a free or very cheap Point of Sales system for Linux? TravisOSF Linux - Software 3 08-25-2006 10:01 PM
Mandriva Linux 2006 Free BOOT FAILED, system hang after LILO menu (WinXP&Linux) js703 Mandriva 1 04-13-2006 01:46 PM
where can i find free tutorials for learning perl in linux for system adminstration syedabdul Programming 2 03-04-2006 05:23 AM
Fragmented Hd fredfmah Linux - Newbie 6 10-10-2003 04:00 PM
Three-boot system Win XP - Linux RH - Free BSD does not work tuanito *BSD 6 02-24-2003 05:16 AM


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