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
82 replies

Jan 23, 2012 3:09 PM in response to lweileman

The question hasn't yet been asked; why do you feel you need to defrag? Do you work with multi-GB audio or video files?

Are you experiencing slowing down of the system? If yes to that one, defragging is probably the least useful thing you'll need to do.


If you really, really, feel the need, James' final comment is the best and safest method. Clone the entire HD to an external HD, boot from the external and use DU to erase the Macintosh HD then clone the system back to the Macintosh HD.


Result - a freshly written copy of all your stuff in fully defragmented form.

Bonus - you now have a bootable back-up drive (which everyone ought to have anyway).

Jan 23, 2012 4:43 PM in response to OrangeMarlin

I didn't have external drives back then.


Nothing difficult about cloning a drive. Certainly safer than many defrag programmes, most of which only defrag files, not the free space, so their effectiveness is limited.


But unless you're handling large audio or movie files, or possibly raw images, you're more likely to run out of disk space before there's any significant fragmentation.

Jul 28, 2012 10:19 AM in response to lweileman

OSX will automatically, as a background process, defragment files under 20mb in size. Files over 20mb are never defragmented and nor does OSX make any effort to prevent directory defragmentation. Both can result fragemented free space across the drive which can affect performance given enough use.


The easy/cheap way to defragment an OSX drive is move as many of the large files off the drive as you possiblycan then let OSX make the best job it can of defragmenting all the sub-20mb files. Once done, copy all the other files back. Or you could use a tool like iDefrag - http://www.coriolis-systems.com/iDefrag.php


The benefit of using such tools is highly contentious. I've found that iDefrag can noticeably improve the performance of HDDs that get a huge amount of write/re-write activity of large (20mb+) files, but your mileage may vary. Defragmenting OSX is certainly notwhere near as much of a problem as it is on Microsoft's platform.

Jul 28, 2012 11:21 AM in response to lweileman

I guess I should weigh in here



1: Only hard drives require defragging. SSD's no need.


2: You don't need to regularly defrag a Mac's hard drive, OS X writes small files in one batch, eliminating a lot of the need to defrag a Mac regularly.


3: Hard drives are fastest at the beginning of the drive.


4: The first 50% of the drive is faster than the second 50% due to larger sectors and longer tracks which the heads have less to move and can gather more data at one time.


5: However over time a Mac can slow down as the adding and reduction of data, OS X upgrades and normal operation tends to move data making it less optimized.


6: If one wants to create a Bootcamp or second partition on the boot drive, there might be OS X data near the bottom where the second partition will go, it's sometimes not easy to move this data further up on the drive.


7: If there are bad or failing sectors on the drive, it can substantially slow down read speeds and the spinning beach ball effect occurs.

8: I don't advise using defragmentation software on a "live" system. If anyone has defragged a PC before knows it's never really complete in actuality.



So my solution if your serious about performance, have large files like video that stretch across many sectors and want it in one piece, want to reduce bad sectors that can corrupt large and even small files, need to free up space for a patition or large file.


(Note: If you have Filevault enabled, forget it, I can't confirm if this will work or not with this proceedure, consider not using it as it slows down a machine anyway and is currently cracked.)



Reduce your boot drive user content so it's less than 50% of the drive filled (ideal) but not more than 80% filled.


Use a blank powered external drive and a copy of Carbon Copy Cloner to clone the OS X boot partition (aka Macintosh HD) to the external drive.


The reboot the machine holding the option key down, you can boot from the clone.


Use Disk Utility to Secure Option Erase with the "Zero" or middle secure selection (10.7/10.8) the internal OS X boot partition, this will "Zero" out all the bits, and when it reads it back for confirmation, map off any bad sectors in the process, never to be written to again.


When completed, reverse clone. Run Disk Utility > Repair Permissions on both and all the OnyX (Macupdate.com) maintenance and cleaning aspects and reboot. OnyX cleans out the caches and lets them rebuild.



You will solve your Bootcamp partition formatting problem, your bad sectors problem, your defrag problems, corrupt or bloated caches and your optimization problems all in one batch. Also have a working bootable backup in the process which is loads safer than a live defrag.


Your Applicaiton's will be written to the "hot zone" the fastest part of the drive. They will load as fast as possible.


Your OS X system files will be written next, followed by your User account data last which tends to grow, expand and contact, suffer with more changes so the defragmentation that occurs will occur at the end and into the slow sections of the hard drive, not where Applications and System are.


Sure over time with OS X updates, upgrades, new app installs and such you can start seeing a loss in performance again (over many years), but another clone/reverse clone will solve that problem.


Also if you want to backup and defrag Windows Bootcamp partiton (CCC doesn't do that), there is WinClone for that. I don't know how effective it is as I haven't used it.

Sep 20, 2012 10:00 AM in response to ds store

Hi Everyone. Some interesting information on this discussion thread. I would welcome your thoughts on a slight twist to the defrag question.


I use a MacBook Air with 128GB SSD. I do have to support some software which runs (walks) on windoze. So I use Parallels to run a couple of Virtual Machines (Win XP Home and Win 7 Pro), which are clones of my old PCs.


As I only have 128GB I find I have to store the VM files on a network drive (because they were about 40GB each). I have 100Mbps connection so whilst it's slow to access them. It's not impossible. Naturally I would love to use the SSD of the MacBook Air and so I have recently cleaned up one of the VMs and removed loads of programs from windows, deleted old data etc. I got the size down to 20GB and so it's capable of copying the whole VM to the MBA and running it locally.


Naturally I wonderred what the impact of Defrag would be for both the VM which is being served over the network, and the VM which would be on the MBA's SSD.


Thought this might add an interesting twist to the conversation thread. Thoughts and opinions are welcome.


Regards,


Zygomac

Sep 20, 2012 11:00 AM in response to lweileman

Don't believe the hype. "Until the hard drive is near full"? Well, that might include you! If you do a lot of VM, Video, or just have a near full drive, you might start to see permormance loss (I did).


If you run a Carbon Copy Cloner to an external drive, then boot off of it, erase your internal and Carbon Copy Cloner back, YOU WILL see a performance increase. This WILL defrag your drive. There are third party products out there but it's a shame that OS X doesn't include a native app to do this.

Sep 20, 2012 2:24 PM in response to scarroll

scarroll wrote:


Don't believe the hype. "Until the hard drive is near full"? Well, that might include you! If you do a lot of VM, Video, or just have a near full drive, you might start to see permormance loss (I did).


If you run a Carbon Copy Cloner to an external drive, then boot off of it, erase your internal and Carbon Copy Cloner back, YOU WILL see a performance increase. This WILL defrag your drive. There are third party products out there but it's a shame that OS X doesn't include a native app to do this.

Do what? clone?


Disk Utility does that very well.

Sep 20, 2012 2:43 PM in response to Csound1

I meant the physical location where it saves, an actual physical disk vs circuit boards.


I goooooooooogle it 😉


Wikipedia:

Left SSD, right Hard Disk Drive

There is no benefit to reading data sequentially (beyond typical FS block sizes), making fragmentation irrelevant for SSDs. Defragmentation would cause wear by making additional writes of the NAND flash cells, which have a limited cycle life.[73][74]Files, particularly large ones, on HDDs usually become fragmented over time if frequently written; periodic defragmentation is required to maintain optimum performance.[75]


So back to OP, defragmentation of your MacBook Air SSD would be irrelavant.

Feb 18, 2013 3:44 PM in response to lweileman

hi guy's, i'm having a discussion on an dutch forum with a guy who claims he is a Apple Certified Technician and am looking for the truth about this issue.

He claims: OS X needs 10 to 15 percent free disk space, otherwise auto-defragment won't work.


googling for more info in this i found sources like

macrumors guide saying: having at least 10 GB of free space (after a restart) would help for normal usage.

Another source (about Mac's) writes: you should have at least 15 percent free as bare minimum.


I can bring my question down to: is it gigabyte or percent ?

it means a Hugh difference.

Keeping 15 percent free at least on a 3TB drive means 450 GB.


Another way to put my question is:

How much free space does OS X need to do his automatic disk defragment?

Feb 18, 2013 4:14 PM in response to bonimac

You assume incorrectly. That answer is as credible as any you are likely to find. Ask your Apple Certified Technician for documentation to support his claim of any particular minimum percentage. Please post the reference in a reply.

Keeping 15 percent free at least on a 3TB drive means 450 GB.


That illustrates the reason that 10 GB is approximately correct... "for normal usage".

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

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.