Disk defragmenter in Linux

John Summerfied debian at herakles.homelinux.org
Sat Dec 31 01:31:35 UTC 2005

Mike McCarty wrote:
> David G. Miller (aka DaveAtFraud) wrote:
>> mike.mccarty at sbcglobal.net wrote:
>> Yes, but...
> No, Yes PERIOD.
> The point being made is to refute the idea that ext3 inherently
> does not fragment files.
>> [root at bend ~]# filefrag /bin/* | sort -k2 -nr | grep 'would be'
>> /bin/netstat: 2 extents found, perfection would be 1 extent
>> /bin/login: 2 extents found, perfection would be 1 extent
>> Files that are frequently updated will often have some level of 
>> fragmentation.  Files that are relatively unchanged tend to be in a 
>> single extent.
> Again, the point was that some claim that ext3 does not and will
> not fragment files which are not dynamic. I claimed that fragmentation
> can occur simply due to install of software, which some claimed
> will not and does not occur with ext3. I think that I have demonstrated
> my point. In fact, I was quite shocked that it was as bad as that,
> frankly.

A while ago I differentiated between extents and fragments.

I see an extent as a section of contiguous storage, normally allocated 
together. In systems that support preallocation, if you ask for 50 
Mbytes the OS will normally try to give it to you in a single extent. If 
it can't, the result is implementation-dependent, and unimportant here.

If you want more space, probably it will create a new extent. Depending 
on the implementation and availability, this might be contiguous with 
the first extent. One would not ordinarily describe these two extents as 
fragments, unless they were separated in (disk) space.

Even when files are fragmented, if the fragments are close together the 
fragmentation is relatively unimportant because it has relatively little 
impact on performance.

Take this file:
[summer at bilby var]$ sudo filefrag swapfile
swapfile: 13 extents found, perfection would be 5 extents
[summer at bilby var]$

Is that separation into 13 extents important? How close are they?
I'll leave it to someone else to draw a map:
summer at bilby var]$ sudo filefrag -v swapfile
Checking swapfile
Filesystem type is: ef53
Filesystem cylinder groups is approximately 18832
Blocksize of file swapfile is 4096
File size of swapfile is 536870912 (131072 blocks)
Discontinuity: Block 7 is at 5571073 (was 5538311)
Discontinuity: Block 13 is at 5603841 (was 5571079)
Discontinuity: Block 20 is at 5625473 (was 5603847)
Discontinuity: Block 27 is at 5636609 (was 5625479)
Discontinuity: Block 34 is at 5664937 (was 5636615)
Discontinuity: Block 3957 is at 5669384 (was 5668863)
Discontinuity: Block 30035 is at 5695496 (was 5695487)
Discontinuity: Block 36165 is at 5702152 (was 5701631)
Discontinuity: Block 68382 is at 5734920 (was 5734399)
Discontinuity: Block 78860 is at 5745416 (was 5745408)
Discontinuity: Block 100591 is at 5767688 (was 5767167)
Discontinuity: Block 129036 is at 5796168 (was 5796160)
swapfile: 13 extents found, perfection would be 5 extents
[summer at bilby var]$

if only because I don't understand the report, and the man page doesn't 



-- 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