Disk defragmenter in Linux

John Summerfied debian at herakles.homelinux.org
Fri Dec 30 04:58:48 UTC 2005


Jim Cornette wrote:
> John Summerfied wrote:
> 
>> Jeff Vian wrote:
>>
>>>
>>> Exactly, and IIRC the filesystem knows that if it needs X amount of
>>> space for a file, then Y number of inodes are marked for use for that
>>> file at the beginning.  Thus space allocated is as contiguous as is
>>> efficient for read/write on the disk.
>>
>>
>>
>> If "the filesystem knows that if it needs X amount of space for a 
>> file," that implies there's a way of telling it that.
>>
>> How's that done? I don't recall any system call for *x (there is one 
>> for OS/2), and one could do it in JCL in IBM's OS in the 60s), but in 
>> the *x world I've never seen a way to do it.
> 
> 
> 
> Since the discussions regarding fragmentation on ext3 filesystems was 
> pretty long running. I decided to try
> filefrag /usr/bin/* |sort |grep 'would be'
> and the output showed a lot of fragmentation. One of the files was up to 
> 45.
> /usr/bin/postgres: 45 extents found, perfection would be 1 extent
> I outputted the findings to a file which ended up being around 75 kb
> The log files didn't seems to be as fragmented as  I expected. Another 
> pecularity was that some of the files did not seem to be things that I 
> use much.
> Another excerpt from the query.
> /usr/bin/php: 52 extents found, perfection would be 1 extent
> /usr/bin/php-cgi: 62 extents found, perfection would be 1 extent
> 
> My system is running development. This of course means frequently 
> updated programs. Checking usr/lib showed fragmentation also.
> /usr/lib/libXm.so.4: 48 extents found, perfection would be 1 extent
> /usr/lib/libXm.so.4.0.0: 48 extents found, perfection would be 1 extent
> ..
> /usr/lib/libxvidcore.so.4: 49 extents found, perfection would be 1 extent
> 
> I guess fragmentation is present on the system and probably needs 
> addressed or a less fragmented filesystem type needs implemented.

extent ^= fragmentation. On filesystems I know, extents can be on 
consecutive areas (sectors, blocks, tracks) of disk. You need better 
info than that to see whether you have a fragmentation problem. filefrag 
will give it to you, but it needs a wrapper to make sense to Mere Mortals.


fwiw
summer at bilby ~]$ sudo filefrag /usr/sbin/postfix /usr/X11R6/lib/libXm*
/usr/sbin/postfix: 1 extent found
/usr/X11R6/lib/libXm.a: 1 extent found
/usr/X11R6/lib/libXm.so: 1 extent found
/usr/X11R6/lib/libXm.so.2: 1 extent found
/usr/X11R6/lib/libXm.so.2.1: 1 extent found
/usr/X11R6/lib/libXm.so.3: 1 extent found
/usr/X11R6/lib/libXm.so.3.0.2: 1 extent found
/usr/X11R6/lib/libXmu.a: 1 extent found
/usr/X11R6/lib/libXmu.so: 2 extents found, perfection would be 1 extent
/usr/X11R6/lib/libXmu.so.6: 2 extents found, perfection would be 1 extent
/usr/X11R6/lib/libXmu.so.6.2: 2 extents found, perfection would be 1 extent
/usr/X11R6/lib/libXmuu.a: 1 extent found
/usr/X11R6/lib/libXmuu.so: 1 extent found
/usr/X11R6/lib/libXmuu.so.1: 1 extent found
/usr/X11R6/lib/libXmuu.so.1.0: 1 extent found

This system was installed as Fedora Core 3, and all these package 
subsequently replaced (with force where necessary) with packages I built 
myself from RHEL 4 source. That is, they have all been updated after 
installation.

Checking lib and bin directories under /usr, I see no more than three 
extents.

I note my file placement's different from yours.


-- 

Cheers
John

-- spambait
1aaaaaaa at computerdatasafe.com.au  Z1aaaaaaa at computerdatasafe.com.au
Tourist pics http://portgeographe.environmentaldisasters.cds.merseine.nu/

do not reply off-list




More information about the fedora-list mailing list