Do I need to defragment Mac OS X?

9

3

Does windows need to be defragmented regularly?

Why does MacOS not have a Defragmentation utility?

Please teach a detailed person

ffffff

Posted 2009-08-03T03:02:52.287

Reputation: 217

1Don't downvote. This is a valid question, although somewhat badly written. Will somebody please edit it. ;-) – GeneQ – 2009-08-03T03:14:49.940

1I have tidied this up, I tried to keep it as close to the original as possible whilst making it readable. – Bruce McLeod – 2009-08-03T03:24:04.633

Answers

17

I think the best answer for this comes straight from this apple support KB

About optimization and fragmentation

Disk optimization is a process in which the physical locations of files on a volume are "streamlined." Files and metadata are re-arranged in order to improve data access times and minimize time moving a hard drive's head.

Files can become "fragmented" over time as they are changed and saved and as the volume is filled, with different parts of a single file stored in different locations on a volume. The process of collecting file fragments and putting them "back together" is known as optimization. However, if a failure occurs during optimization, such as power loss, files could become damaged and need to be restored from a backup copy.

Do I need to optimize?

You probably won't need to optimize at all if you use Mac OS X. Here's why:

  • Hard disk capacity is generally much greater now than a few years ago. With more free space available, the file system doesn't need to fill up every "nook and cranny." Mac OS Extended formatting (HFS Plus) avoids reusing space from deleted files as much as possible, to avoid prematurely filling small areas of recently-freed space.

  • Mac OS X 10.2 and later includes delayed allocation for Mac OS X Extended-formatted volumes. This allows a number of small allocations to be combined into a single large allocation in one area of the disk.

  • Fragmentation was often caused by continually appending data to existing files, especially with resource forks. With faster hard drives and better caching, as well as the new application packaging format, many applications simply rewrite the entire file each time. Mac OS X 10.3 Panther can also automatically defragment such slow-growing files. This process is sometimes known as "Hot-File-Adaptive-Clustering."

  • Aggressive read-ahead and write-behind caching means that minor fragmentation has less effect on perceived system performance.

Bruce McLeod

Posted 2009-08-03T03:02:52.287

Reputation: 5 490

4That's the theory, but in practise if you're not a light user you may well have to defrag. – alimack – 2010-03-01T15:43:22.637

And don't forget the final note from that article: Mac OS X systems use hundreds of thousands of small files, many of which are rarely accessed. Optimizing them can be a major effort for very little practical gain. There is also a chance that one of the files placed in the "hot band" for rapid reads during system startup might be moved during defragmentation, which would decrease performance. – Arjan – 2010-03-01T15:49:18.440

1A decent defragmenter is "hot band aware", and won't behave like this. Trust me I've seen considerable gains from defragmenting on a Mac, not least that bootcamp actually works. – alimack – 2010-03-19T15:56:59.367

That article has been archived and is no longer updated by Apple. (February 2010 edition removed a reference to another archived article; it's otherwise no different from the June 2008 edition (crawled around that time). Not applicable to Snow Leopard Mac OS X 10.6 or Lion Mac OS X 10.7.

– Graham Perrin – 2011-08-18T08:21:18.240

10

I suggest also taking a look at Server Fault's answers as well:

My answer on Server fault fits here as well :

It's a bit of a yes, no answer. Useful in certain circumstances but it's less of an issue than it was with FAT or regular HFS. All filesystems will fragment but newer ones are more resistant to fragmenting so badly.

Speaking for Mac OS X specifically HFS+ does a decent enough job of trying to keep things from being fragmented compared to older systems but it still happens just not on the same scale. The OS itself also defrags "small" (20MB or smaller) files on the fly since 10.3 (Panther).

Fragmenting still happens and you can see performance drop because of it, especially in video editing systems or a workflow that requires the ability to read or write large files quickly to the disk. For your standard user - a near non-issue.

The most popular options for defragmenting a hard drive for OS X I've used and run across are:

  • Cloning the hard drive to another drive and back. This is done using Carbon Copy Cloner or SuperDuper and requires an extra hard drive. If done as part of a backup routine the time hit may not be terrible but it's free to do it this way.

  • iDefrag, Drive Genius and a handful of other utilities will all defragment your hard drive as well. Personally I prefer iDefrag.

Chealion

Posted 2009-08-03T03:02:52.287

Reputation: 22 932

1I've found iDefrag to be a very good solution +1 – Darren Newton – 2009-08-03T12:07:23.900

I hadn't heard of iDefrag, i'll have a look at it. – Bruce McLeod – 2009-08-06T14:05:37.140

2

You will need to defragment under certain circumstances - while it's true that Mac OS X eliminates file fragmentation (split files) for files under 20 MB, it doesn't eliminate directory fragmentation (spaces between files). If your drive gets very full >80%, or if you want to install Windows 7 under Boot Camp you may well get an error despite having enough free space as the drive fragmentation prevents the OS from grabbing enough contiguous space.

In my experience iDefrag does a great job - version 2 is out but it's paid software.

alimack

Posted 2009-08-03T03:02:52.287

Reputation: 527

Check versions carefully on iDefrag site, latest version causes havoc with el capitan and older OSs. – alimack – 2017-02-01T14:36:42.920

2

It's not that OS X doesn't need to be defragmented. It's that like Windows Vista and Windows 7, OS X automatically defragments your drive in the background when the computer is idle. You shouldn't ever need to manually defragment your drive in OS X.

Dan Walker

Posted 2009-08-03T03:02:52.287

Reputation: 8 869

OSX defragments files under 20MB. It doesn't remove directory fragmentation (spaces between whole files). So you do need to defragment if your drive is very full (>80%) or if you use large files (video and image work, typically). – alimack – 2010-02-22T12:08:40.520

Nor does it defragment in the background, it actually defrags on the fly during file access (read and write operations). – alimack – 2010-03-23T09:07:45.760

I hope that works better than other background defraggers. I had to give up using Diskkeeper because of the constant drive nuisance. – Lance Roberts – 2009-08-03T03:10:18.747

In some cases, one-off defragmentation is a necessity. I'll add an answer under Do Macs need to be defragmented? in Ask Different.

– Graham Perrin – 2011-08-18T08:06:25.800