Defragmenting your Mac's hard disk

Go on then, tell me why.
Defragmenting a full disk can, in some cases (depending on disk cluster size, the average size distribution of your files and the number of those files), save on disk space.

However, the biggest advantage from defragmenting a disk is an advantage in performance - the closer together the files are (and the closer they are to the start of the disk), the quicker they can be accessed in relation to each other.

If you have a fairly empty disk, you are bound to have a sparser distribution of files across the disk. Therefore, the mean access time between each file (relative to each file) will be higher than if the space covered by files were more densely packed.

So, on average, the likelihood is that someone with a big disk and not many files will see a better average performance gain from defragmenting than someone with a densely packed disk.



* file system and HDD controller dependant
 
Defragmenting a full disk can, in some cases (depending on disk cluster size, the average size distribution of your files and the number of those files), save on disk space.

However, the biggest advantage from defragmenting a disk is an advantage in performance - the closer together the files are (and the closer they are to the start of the disk), the quicker they can be accessed in relation to each other.

If you have a fairly empty disk, you are bound to have a sparser distribution of files across the disk. Therefore, the mean access time between each file (relative to each file) will be higher than if the space covered by files were more densely packed.

So, on average, the likelihood is that someone with a big disk and not many files will see a better average performance gain from defragmenting than someone with a densely packed disk.



* file system and HDD controller dependant

The difference in speed will be negligible. Can you show me otherwise?
 
• Testing by independent laboratory NSTL resulted in performance gains of 67.9%
to 176.1% for systems running Microsoft Outlook. Performance with Microsoft
Excel improved 83.6 percent.
• Tests by Windows IT Pro documented fragmentation related performance
degradation of up to 198% with Internet Explorer, and up to 123% when
performing a comprehensive anti-spyware scan. Saving a large document in
Microsoft Word resulted in fragmentation related performance degradation of up
to 1,489%.


Of course, when SSDs are commonplace, this discussion will become entirely pointless :p
 
1) That's Windows - they could have been using FAT32 (there is absolutely no info surrounding the test platform, configuration etc.).
2) That quote is from DisKeeper - vested interest?
 
mine feels like it needs a defrag.
I've ran OnyX and done the usual repair permissions but my mac pro is a hell of a lot slower than when I bought it!
 
Disks, defragment. It's not as bad as a Windows file system but they can/do fragment.

I bought iDefrag some some time ago, not used it in ages. Might give it another go having seen this thread.

:)

Now, not necessarily defragging, but at least seeing what the disk looks like had me intrigued :D iDefrag has a trial so everyone else post up their disk!

160GB HDD

20090425-thkxwgde6pmshhx6nc81qbj7e8.jpg


20090425-pnejfhqmc37cdgpkba3igpea4p.jpg


I should add that the last 20-25GB did have a bootcamp partition on it (for a Windows only app I needed for my degree) so there wasn't much space left. Is deleted now though.
 
I don't really know what this is telling me.

My OS/Applications drive:
boot-20090425-111431.gif

boot-1-20090425-111504.gif


My Home drive:
home-20090425-111555.gif

home-1-20090425-111626.gif


OS/Apps drive is a 320Gb with 200Gb free and the Home drive is 1Tb with 235Gb free.
 
I'll shed some light on to this - from a OSX perspective.

Defrag systems have three main reasons to exist:
1. Optimising access of files by making the files into continuous blocks on the drive meaning the heads don't have move.
2. Optimising the freespace by consilidating the files to allow large continous free space blocks to exist thus making allocation of file space quicker.
3. Optimising the location of the files so that when the system performs an operation (booting up) all the files accessed are available in sequence with the minimum number of head movements. Usually this requires the defrag software to watch the use of the drive and plan file moves accordingly.

OSX HFS+ filing system automatically defragment freespace by moving small files on the fly - the technique is called Adaptive Hot File Clustering where it basically has a zone where it keeps the small files together which prevents them from causing fragmentation by dividing large free space areas with small files spread over the entire disk. For large files it decides that it doesn't need todo this as the drive heads will spend the majority of their time reading sequentially.
This is why the fragmentation returned is low and people state "macs don't need defragging" - which is partially true. Defragging can still be done - large files and optimisation of file access sequence on performance an operation can still be done.

All this boils down to two drives:
a) reducing mechanical hard drive head movements (seek time)
b) reducing the number of lookups (list pointers) to get to a file data. Which is really down to the number of files on the drive (hence the more files the slower it gets) and then at a more minor level how to get to the file data in multiple locations.

SSDs don't have (a) but still benefit from (b) at a file level and at a wear levelling level (although this is a complete drive initialisation to fix).
 
Last edited:
The home drive is seriously fragmented there :eek:

(Simply, red colour = bad)

Is it?

1% is quite low. I think it's the rendering to pixels at the window level that's causing it to look more red than if the display had more resolution.. but that freespace fragmentation is pretty rough!
 
i have once or twice fake-defragged. Backup to my firewire external and then copy back onto the main drive.... This writes every file contiguously. This is handy for freeing up large area of contiguous free space if you want to add a bootcamp partition (Boot Camp Assistant partitioning will fail without explanation on a near full, slightly fragmented disk. but succeeds on a nearly full compacted disk).

If you do a lot of bit torrenting, without pre-allocating room for the full file, then even Mac OS X will suffer fragmentation from the continuous small writes. I have a separate partition for torrents.
 
The difference in speed will be negligible. Can you show me otherwise?

Obviously got no statistical evidence, but all i can say is that running a full, proper defrag with iDefrag made significant differences to boot times and application startup times on three Macs; two Intel iMacs and a PowerBook G4. My friends (the owners of said Macs) were undoubtedly sceptical about doing it, but I think we were all surprised with the results.

Perhaps Macs don't need defragmenting as often, but it does seem there are decent gains to be had from doing it every now and again.
 
If you do a lot of bit torrenting, without pre-allocating room for the full file, then even Mac OS X will suffer fragmentation from the continuous small writes. I have a separate partition for torrents.

Mines probably in the state it is due to doing an awful lot of video conversion and I also recently re-ripped my entire collection of CDs into lossless, so I've been doing a lot of file handling, moving, creating, deleting etc.

It doesn't feel sluggish at all, certainly no different to when I started using that drive for media.
 
Eighteen hours of full offline defrag later. Don't ask me why there's a gap in the middle.
home-df-20090503-101907.png

home-df-1-20090503-101952.png
 
Back
Top Bottom