POV-Ray : Newsgroups : povray.off-topic : Why is defragging so slow? : Re: Why is defragging so slow? Server Time
5 Sep 2024 19:25:55 EDT (-0400)
  Re: Why is defragging so slow?  
From: Darren New
Date: 1 Jun 2009 17:20:12
Message: <4a24460c$1@news.povray.org>
Warp wrote:
> Luckily this didn't cause any errors in the partition.

That's part of the reason. There's a sync before and after each block of 
file movement, which makes for a tremendous amount of seeking. (Not each 
allocated cluster, but each read/write pair. I don't know how big a buffer 
it uses.) It also re-reads the free space bitmap for each file, so if you're 
moving lots of small files to make room for a big one, that might take a 
majority of the time right there. But it's all designed that you wont lose 
data if someone else opens the file while it's defragging (read or write) or 
if you pull the plug while it's going.

Plus, Windows defrags online, which means it has to keep the buffers up to 
date in memory and things like that, not stomp on blocks just allocated to 
another file, etc.  I.e., you can be reading through a file while it's 
defragging and not get errors from reading the wrong buffers and such.

Was this Vista or XP? Vista intentionally yields the disk up to other 
processes while defragging. I also think Vista has a problem with a really 
highly fragmented file. For example, I had a file with 300,000+ fragments 
that Vista just choked trying to defrag. I fell back to sysinternals contig 
(which works nicely and lets you do just individual files or directories 
too). So it's not the kernel bit broken, but the UI/app on top of it.

>   Why does it take such a humongous amount of time? I can't understand.

It *is* a lot faster if you have lots of room on the disk, IME. The Vista 
defragger seems much slower than even the XP defragger.

>   I also noticed that both defragmenters failed to use the free space
> in the partition (over 80 GB) to their advantage, and instead moving
> small clusters around one at a time. I'm pretty certain that if all the
> free available space was used to copy data, the whole process could be
> a lot faster.

That bit is in the kernel. You just say "move clusters X thru Y of this file 
into the free space starting at Z" and it moves it. The likelihood that a 
different version of the defragger will be significantly faster at 
defragging a bunch of files is low, if the bottleneck is the I/O, because 
they all use the same FCNTL calls.

http://technet.microsoft.com/en-us/sysinternals/bb897427.aspx

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.