no "defrag" in Linux?

Alexander Skwar listen at alexander.skwar.name
Fri Jul 21 06:02:20 UTC 2006


ยท Peter Garrett <peter.garrett at optusnet.com.au>:

> On Thu, 20 Jul 2006 15:34:47 -0700
> "Henk Postma" <henkpm at gmail.com> wrote:
> [snip]
>> Go ahead and try the following.
>> 1) locate a large file (divx movie?).
>> 2) sudo filefrag $movie, note the level of fragmentation
>> 3) time cat $movie > /dev/null, note the time it took
>> 4) now make a copy of the movie:
>> cp $movie $movie.new
>> 5) sudo filefrag $movie.new Most likely, you will find that it is less
>> fragmented
>> 6) time cat $movie.new > /dev/null
>> 
>> I guarantee you will see a big reduction in time it takes to dump the
>> file to /dev/null

> $ time cat ED_1024.avi > /dev/null
> 
> real    0m11.178s
[...]
> $ time cat ED_1024-new.avi > /dev/null
> 
> real    0m11.470s

I've only got a 206M file - dbCache.dat from Google Earth.

alexander at knospe:~/.googleearth/Cache$ du -h dbCache.dat
206M    dbCache.dat

alexander at knospe:~/.googleearth/Cache$ sudo filefrag dbCache.dat
dbCache.dat: 167 extents found

alexander at knospe:~/.googleearth/Cache$ time cat dbCache.dat > /dev/null

real    0m10.301s
user    0m0.008s
sys     0m0.380s
alexander at knospe:~/.googleearth/Cache$ cp dbCache.dat dbCache.dat.defragged
alexander at knospe:~/.googleearth/Cache$ sudo filefrag dbCache.dat.defragged
dbCache.dat.defragged: 1 extent found

alexander at knospe:~/.googleearth/Cache$ time cat dbCache.dat.defragged > /dev/null

real    0m7.392s
user    0m0.008s
sys     0m0.288s

But as I wrote - how much is this influenced by the filesystem cache?
I actually don't trust my test.

What's the best way to trash the cache?

Alexander Skwar
-- 
Moderne Musik ist Instrumentenstimmen nach Noten.
                -- Igor Strawinsky






More information about the ubuntu-users mailing list