Defrag a MAC

How do I defrag a MAC?



[Re-Titled by Moderator]


iMac 21.5", macOS 10.14

Posted on Jul 19, 2019 11:56 AM

Reply
Question marked as Top-ranking reply

Posted on Jul 19, 2019 6:04 PM

I found this as well, https://www.macworld.co.uk/how-to/mac/defrag-3600241/

If you are from the future please refer the link to the waybackmachine at the internet archive



Mac do not need to be defragmented because the file system (initially HFS+ and more recently APFS) prevents fragmentation and automatically defrags files if necessary - if the file has more than eight fragments, or is smaller than 20MB, it will be automatically defragged.

HFS+, which was introduced in 1998, could defrag files on the fly thanks to Hot File Clustering. Then in Mac OS X 10.2, which arrived in 2002, the system got even cleverer at avoiding fragmentation. A year later, in 2003, Hot File Adaptive Clustering arrived, which identifies files that are frequently accessed but rarely updated and moves them to a special area of the drive, defragging them during the process.

Apple then introduced APFS (Apple File System) in High Sierra in 2017. APFS was initially only available on SSDs (which as we’ve already said, shouldn’t be defragged anyway), but it arrived on hard drives and Fusion drives in 2018 with Mojave. Like its predecessor, APFS automatically defragments your drive on the fly, although it works a little differently as it creates snapshots of files so you can access different versions of the same files.


How to defrag a Mac (and why you don't need to)

By Karen Haslam

14 replies
Question marked as Top-ranking reply

Jul 19, 2019 6:04 PM in response to shariff80

I found this as well, https://www.macworld.co.uk/how-to/mac/defrag-3600241/

If you are from the future please refer the link to the waybackmachine at the internet archive



Mac do not need to be defragmented because the file system (initially HFS+ and more recently APFS) prevents fragmentation and automatically defrags files if necessary - if the file has more than eight fragments, or is smaller than 20MB, it will be automatically defragged.

HFS+, which was introduced in 1998, could defrag files on the fly thanks to Hot File Clustering. Then in Mac OS X 10.2, which arrived in 2002, the system got even cleverer at avoiding fragmentation. A year later, in 2003, Hot File Adaptive Clustering arrived, which identifies files that are frequently accessed but rarely updated and moves them to a special area of the drive, defragging them during the process.

Apple then introduced APFS (Apple File System) in High Sierra in 2017. APFS was initially only available on SSDs (which as we’ve already said, shouldn’t be defragged anyway), but it arrived on hard drives and Fusion drives in 2018 with Mojave. Like its predecessor, APFS automatically defragments your drive on the fly, although it works a little differently as it creates snapshots of files so you can access different versions of the same files.


How to defrag a Mac (and why you don't need to)

By Karen Haslam

Jul 19, 2019 7:55 PM in response to shariff80

Back up your Mac before you do anything, because the sudden onset of poor performance without having installed something that might be the culprit is often a symptom of a hard disk drive that is operating in a state of failure.


To learn how to use Time Machine please read Back up your files with Time Machine on Mac.


Don't prematurely conclude the cause of a problem, and especially don't install some magical cure-all claiming to fix something that isn't broken to begin with. As others already pointed out "defragmenting" is a long-outdated practice that has not been applicable to Macs for many years: About disk optimization with Mac OS X - Apple Support.

Jul 19, 2019 12:15 PM in response to shariff80

Are you having a problem for which you think defragging is the answer? Perhaps you should just describe the problem you are having.


If you are just curious because you always did it in Windows:

The OS automatically defragments files on the fly if they are smaller than 20MB*. If you often edit very large files (20+MB), it is possible that it will get fragmented.

If you do that regularly, the way to defragment is to Clone the drive to another, then clone it back.


*I don't know if that is still an accurate size. They may have changed it.

Jul 19, 2019 12:58 PM in response to shariff80

Download and run Etrecheck. Etrecheck is a diagnostic tool that was developed by one of the most respected users here in the ASC and recommended by Apple Support  to provide a snapshot of the system and help identify the more obvious culprits that can adversely affect a Mac's performance.


Copy the report


and use the Add Text button to include the report in your reply. How to use the Add Text Feature When Posting Large Amounts of Text, i.e. an Etrecheck Report


Before running Etrecheck assign Full Disk Access to Etrecheck so that it can get additional information from the Console and log files for the report:




Then we can examine the report and see if we can determine what's causing the problem..



Jul 19, 2019 5:56 PM in response to shariff80

reading between the lines here. I know you are being specific but I imagine what you are after is higher performance. Disk Warrior can optimize the directory. It would be an expensive purchase for that single feature.


Getting a little curious I did the following:

iMac:~ admin$ apropos defragment
defragcli(8)             - targeted userspace defragmentation tool
defragx(8)               - targeted userspace defragmenter daemon


SSDs don't need defragmenting.

HDDs generally won't benefit, it's very time consuming and adds heat generation to the device. Overall, the larger the drive, the more data, the more time to defragment; hence defragmenting such a drive would only contribute to the softening of the HDD's lifecycle.


This being said, I think Mac OS does some defragmenting in the background, this is what I understood from years back but never truly verified the claim.

Jul 19, 2019 5:59 PM in response to LostAccount

I think Mac OS does some defragmenting in the background, this is what I understood from years back but never truly verified the claim.


Yes & no, if you did defrag all the files totally as well as the directory in DW, the OSX would immediately start fragmenting them.


Not mentioning the Defrag tools because they don't work with APFS or past 10.13.6

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.

Defrag a MAC

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