You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

how to do a disk defragment on a mac book

How do i do a disk defragment on my mac book pro

MacBook Pro

Posted on Jan 23, 2012 1:45 PM

Reply
Question marked as Top-ranking reply

Posted on Jan 23, 2012 1:53 PM

It's just not necessary or done on a Mac. Some people do it (and you can find apps that help you out), but most old grizzled Mac users never do it. Don't bother, it won't do much.


Mac OS X's formatting system is quite advanced and doesn't use every nook and cranny of your hard drive. The only time when it "might" matter is when or if your hard drive is near full, and OS X is trying to find those nooks and crannies.


  • 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.


Message was edited by: OrangeMarlin

82 replies

Feb 19, 2013 10:22 AM in response to Chewyid

yo chewyid, i knew what you meant :-)


Well, A or B (or 1 & 2 as i changed it), i've been thinking about it... maybe it's not that important to know if it's 10, 15 or 20 percent or gigabyte.


If anyone is filling up his drive till 80% or more, it's about time he should start thinking about deleting or moving a lot of movies to a NAS of DAS for example.


Probably it's true OS X is fine with 20, 30 GB for working and optimizing on whatever size of drive, but why filling up a 1, 2 or 3 TB drive that far?


On the other hand, keeping 600 GB free on a 3TB drive, being guided by the 20% rule still sounds absurd to me.

Unless an Article from Apple shows up this is indeed a good free-space safety guide.


I would now recommend a 27 inch iMac with b.t.o. 3TB owner who reached the '100 GB' left border to start thinking urgently about cleaning / deleting / moving / expanding.


thx all.

Mar 10, 2013 4:00 PM in response to davscanlon

SDD does fragment, even on a Mac.


The problem about fragmentation:

Let's say that you're opening a file of 1GB, the speed of read will depend on the speed of the disk.

But if the same 1GB file is splited in 100 parts and spread across the disk, you will have 100 chunks of 10mb of data, and even if you can read the 1gb file very fast, the HDD will read 10mb and then move the head to the next chunk, read 10mb... and the head will be moving back and forth, and the head have a mechanic latency to move from one place to another before it can read the next chunk of data, slowing down the whole process.


About SDD:

You probably know that SDD doesn't have any moving parts, that's what SSD means. And it means that accessing any location of the flash memory will have the same latency. Doesn't matter if the you're reading the address 0x00000001 and then the 0x00000002 and then 0x00000003 or if you're reading 0x0003405103 and then 0x00000004 and then the 0x503040506, the latency is fixed. So the speed is constant like RAM memory (random access memory).


This doesn't meand that fragmentation doesn't exist on SDD, that's mean that you don't need to bother about fragmentation on a SSD.


Hope I made it clear.

Mar 10, 2013 4:16 PM in response to lweileman

This is my method for defragmenting a OS X boot drive.


How to safely defrag a Mac's hard drive



It requires to make sure the operating system is working perfectly first, then reducing the user content of the boot drive so it's ideally below 50% filled (for best hard drive performance, but not more than 80% filled) then cloning the OS X boot volume to a blank external drive (formatted GUID OS X extended J in Disk Utility) then booted from (hold option key on wired keyboard) and then Disk Utility Zero Erase (one notch to the right on 10.7+) the internal boot drive, then reverse clone.


It's a lot more work, but it's extremely effective as every single file is defragmented and Applications folder are written to the "hot band" of the drive where reading is fastest. Also the Zero erase maps off any potential bad sectors it finds.


It also creates a bootable backup in the process, which ensures one can get online and use the machine while booted off the clone drive.


Users folder, which is subjective to the most radical changes, is at the end of the data as it's written last (in alphabetical order of the root directory) thus it ca expand and contract into the more slower parts of a hard drive, namely the second 50% of the drive, thus not seriously messing up OSX or Applicaitons which are written before Users folder.


I have done this and haven't had a slowdown issue in over 2 years, because apps and OS X updates are usually small and I keep my boot volume under the 50% filled mark (the second 50% is a bootable clone of the first for mobile backups)


Good Luck. 🙂

Mar 10, 2013 5:02 PM in response to Vitimtk

SSDs by the nature of the way they store data are fragmented. It is not that they Get Fragmented, They are supposed to be fragmented. Good SSDs with good write systems place new data on different parts of the drive so one set of memory cells don't get worn out. It is called Wear Leveling. There is no need to do anything to a SSD

Vitimtk wrote:


SDD does fragment, even on a Mac.




This doesn't meand that fragmentation doesn't exist on SDD, that's mean that you don't need to bother about fragmentation on a SSD.


Hope I made it clear.

Mar 10, 2013 7:25 PM in response to Shootist007

Yeah, that's true, even if the data seems to be stored sequentially by the OS or any other program, the SSD controller addresses NAND gates in a specific pattern across the chip. Which is very similar to the way RAMs work.


I just wanted to put in simple words and emphasize that file fragmentation on SSD does not slow down the speed, due to the fixed latency in random accesses.


And because I often seen people saying that SSDs does not fragment, which is incorrect, it happens, you just don't need to worry about it.

Mar 10, 2013 7:44 PM in response to lweileman

I have a reason to defragment a HDD on a mac, I'm doing it right now. But on a external HDD, which I was running windows on a laptop for 3 years, the laptop died months ago, and I'm using it on a usb case since then on my mac.

I was running Windows for more than a year everyday, with less than a gig free and at some points I was with less than 10mb free. File fragmentation got **** high, that the hard drive turned very very slow, and very noisy (annoying clicking noise).


I'm running defragmentation for the first time on that HDD on my mac, for more that 6 hours, the file fragmentation was more than 49%. I'm thinking in formating it later to Mac Journaled format, if I get somewhere to backup this data.

Mar 30, 2013 5:17 AM in response to Csound1

I need to defrag the data drive in my MBP (2 drives) to ensure I have contiguous space for writing large data files, i've cleared the drive of data, then want to do a format to clear everything and then copy back on the 5% of data I need on there initially to hoepfully give me a nicely defragged drive 🙂


Is it worth doing any other Disk Utility checks after the format ? Or does it not really matter with it not being the boot drive ?

Feb 27, 2014 1:41 PM in response to lweileman

It's absolutely helpful to defragment a mac disk, everyone in here saying you don't need to are either ignorant or not power users. Coming from someone who works on lots of data regularly i can tell you fragmentation definitely occours on disk drives (ssd and flash storage are an other story). idefrag is pretty good. defragging will save your drives from dying an early death and you'll be able to access large clumps of data (like uncompressed audio and video) much faster.

how to do a disk defragment on a mac book

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.