Roberto Armenteros wrote:

>This is just a curiosity. Windows computers need to be
>fragmented very often. On the other hand, I once read
>somewhere that disk fragmentation in linux wasnt
>recomended "I am not how true this is." The fact is
>that disk fragmentation in linux is not often spoken
>about. Is there something special about the way linux
>handles the disk so it can have this privilege? I
>would appreciate anyinsight about this.
>
>Thanks a lot,
>  Roberto
>
>__________________________________________________
>Do You Yahoo!?
>Sign up for SBC Yahoo! Dial - First Month Free
>http://sbc.yahoo.com
>
>
>------------------------------------------------------------------------
>
>Want to buy your Pack or Services from MandrakeSoft? 
>Go to http://www.mandrakestore.com
>
Well, in Windows, the FAT32 filesystem is an outgrowth of the filesystem 
originally used for the IBM-PC on floppies (yes, the old 5.25" ones).

It keeps a map of what is used and what is not (a File Allocation Table) 
and a backup copy of that table near the front end of the disk.  One bit 
there corresponds to one cluster on the disk.  A cluster is variable in 
size from 1024 to fairly large though with FAT32 it is kept at 4096 or 
eight disk sectors.

When a (new) file is to be stored, the FAT is scanned and the first 
available clusters are used until all the file is soaked up.  When a 
file is deleted, the clusters in the map are marked as available for 
use.  When a file is updated with a larger version of itself, the old 
file spacer is used then the first available clusters are selected from 
the bitmap.

So, files fragment.  When a temporary file is removed, a hole opens up 
and the next save in place of a file being edited grabs that space, even 
though it may be nowhere near the rest of the file's data (it may well 
precede it).

IBM's JFS does something similar in its storage algorithm, but it tends 
to segment the disk a little better and it is in fact supplied with a 
defragmenter.

Reiserfs uses a very complex directory structure and stores the tails of 
the files (the part that won't take up a whole block) in the directory 
leaves (yes their directory is a tree structure) unless one specifies 
"notail" in the first mount.  It is designed to keep files strictly 
contiguous except for the tails.

ext2/ext3 splits the filesystem space into areas managed by superblocks. 
 Each superblock contains filesystem reconstruction information as well 
as inodes (directories and files) belonging to the local superblock.  By 
scattering the superblock areas across the disk and making no effort to 
pack all the data at one end, it is possible to implement two rules:

1.  Files that belong to a directory go into the same superblock as the 
directory if possible.

2.  Files are stored contiguously as long as space permits.

ext2 also reserves some area for system/scratch.  If this area is set to 
zero, fragmentation increases, but typical fragmentation of files as I 
see it from my own experience is perhaps as high as 2%, and usually much 
lower.  This rule does not hold for say a 3G partition designed to hold 
650Mb iso files, where the files are larger than the superblocks, but so 
what?

There is a defrag program for ext2.  Typical improvement in performance 
is not worth the computing time spent running it.

Civileme



Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to