# Defragment disks?



## mikasjoman (May 15, 2002)

Hi..

On the PC you can use Defrag, is there somthing for the mac? Is there a unix command for the same?

I know there is Norton speed disk, but is there anything out there for free? Otherwise I think OS X sux in disk management. THIS SHOULD BE A PART OF THE OS!

Kind regards


----------



## rharder (May 15, 2002)

There are no defrag utilities for OS X other than some half-baked solutions like booting into os 9 on a separate partition and using speed disk or one or two other similar products.

I sure hope this gets addressed some time.

-Rob


----------



## hazmat (May 16, 2002)

Rob is correct.  But, if you are using UFS, you shouldn't need to defrag.  That's one of the nice things about UFS, it's constantly optimizing itself, at least under Solaris.


----------



## rharder (May 16, 2002)

Is it that it defrags itself as time goes on or is UFS one of the file systems that simply doesn't support non-contiguous files thus "defragging" and "optimizing" as it goes?

-Rob


----------



## hazmat (May 16, 2002)

> _Originally posted by rharder _
> *Is it that it defrags itself as time goes on or is UFS one of the file systems that simply doesn't support non-contiguous files thus "defragging" and "optimizing" as it goes?
> *



It continuously optimizes itself, keeping everything contiguous.


----------



## ladavacm (May 17, 2002)

> _Originally posted by hazmat _
> *
> 
> It continuously optimizes itself, keeping everything contiguous. *



Please read on design and implementation of FFS by Marshall Kirk McKusick before posting.

FFS (a.k.a UFS) does in fact pre-fragment large files, but puts the fragments near to each other.  The fragment sizes are relatively large, and tries to be equal to the read-ahead size (usually 64k; parameter maxcontig is used for that) so that the file fragmentation is not really noticed by the process reading the file.

The advantage of this approach is that FFS does not really deteriorate below this level, unless there are many very small files (which are placed in so called "fragments", buddy based partial blocks).

Please take this with some salt, as the last time I have read the description has been more than 5 years ago


----------



## rharder (May 17, 2002)

I don't think I want a filesystem that tries to optimize as I write, though if the last post is correct, then UFS isn't the horrendous technique that I described previously.

If a filesystem *must* keep its files contiguous, then in the middle of a long write, you may find your hard drive rearranging its contents right in front of you. That would be bad if you're streaming from a digital video camera.

-Rob


----------

