3/17/10
9:28 am

MacMost Now 373: Do You Need to Defrag Your Mac?

Defragmentation was a common technique among Mac-using professionals in the 1990s. But with Mac OS X and today's hardware, do you still need to run defragmentation software?

Video Transcript
Hi, this is Gary with MacMost Now. On today's episode, let's find out of you need to defrag your Mac hard drive. So, if you're not familiar with the term, defrag is short for defragment. And basically what it means is to take your hard drive and optimize it. You see, files on a hard drive don't exist just in one spot. A large file may actually be written to different parts of the hard drive. Defragmenting it means it takes all the parts of a single file and places it on just one part of the hard drive. Let me show you.
Okay, so let's say these grey blocks represent blocks of data on your hard drive. They're all empty right now. But let's say we write three files to the drive. The first one's represented by the red blocks, and then there's a small one represented by green blocks, and then a larger one by the yellow. Now, what happens if we delete the green file? Now we freed up those two blocks, so they're grey again. And we still have the red and yellow file there. Now let's say we want to write a new file. Now what used to happen is the hard drive would put the beginning of the file in the first free space it could find you can see those two purple blocks there and then you would end up with the rest of the file in the rest of the free space. So, you can see how the purple file is now divided up into two parts.
So we can defrag, and what that would do, basically, is move those two blocks so purple is all together. Matter of fact, it would do even more than that. It would actually move all the files, so it would move yellow up, taking up those two spaces there, and move purple right after it. So all the free space is after the files. Matter of fact, it may even do more than that. It may go ahead and rearrange the files completely to optimize them. So it may determine that purple is used more than the yellow file is, so it may put that first, earlier on the hard disk, where it's easier and quicker to access.
So, this was actually very useful. Especially in the old days, when hard drives were smaller, and before the introduction of Mac OS X Extended File Format. You see, then things would actually slow down as files got more and more fragmented. You may have files that took up hundreds of different places on the hard drive, and trying to read them was quite a chore. You see, it would read part of the file, and then the head on the hard drive would have to jump and start reading another part of the file, and that would really slow down the reading of the file. Whereas one continuous block, it would read it very quickly.
So, the question is, Do you still need to defragment your Mac hard drive now in 2010, using Leopard or Snow Leopard? And the answer is no. See, first of all, hard drives are a lot bigger and faster. They're bigger, so there's a lot more space to write files continuously. And they're faster, so those jumps from sector to sector really don't take as much time as they did before. Also, Mac OS X Extended File Format, which is used by Leopard and Snow Leopard, doesn't really need defragmentation because it takes care of it on its own. So, what it'll do is it'll do simple things. Like, it won't write a file in separate places. It will simply write it continuously as long as it has space, only relying on putting them in separate places if you're running low on drive space.
Here's some more reasons. You see, when computers and hard drives were slower, applications would simply append the end of a file, as you continue to edit it and use it. Now that drives are faster, most applications will just rewrite the entire file every time you save. So the defragmentation that would happen that would add bits to the end doesn't happen anymore. It simply rewrites the file as a completely new file.
So also, two things about Mac OS X. First, it will automatically defragment small files. So if for some reason, it has to write a small file supposedly less than 20 megs to the drive in several different bits, it will actually rewrite that file at its first opportunity into one piece. So, kind of the defragmentation's going on all the time. Also, Mac OS X is made up of thousands of tiny little files, talking about the operating system itself. And these are automatically put in the optimum part of the hard drive. So defragmenting won't help with the majority of your files, because they're already exactly where they need to be.
So, what if your Mac is running slow? Will defragmentation help? Well, in the old days, that was one of the first things that you tried to do to speed up your machine. But today, chances are, that's not going to be the problem. First thing to look at is is your hard drive almost full? Because if it's almost full, then defragmenting may help temporarily, maybe even just for minutes or hours. And then you're going to run into the same problem again. So if you have a drive that's filled up, you may want to clear off some space, or get a larger hard drive. Another thing you might want to consider is putting larger media on an external drive. I know if you've got a Macbook, it's hard to get a larger drive in there, so you may want to think about putting some larger files maybe video editing things, large files like that stick them on an external drive and use them there, so that you have a large amount of space free on your drive. That's going to do a lot more to speed up your Mac than a single defragmentation.
Now, Apple and a lot of bloggers recommend an alternative to defragmentation if you want to do it. See, defragmentation takes a long time. It's got to rearrange and rewrite all the files on your drive, swapping them around. There have been reports of anywhere from a few hours to a few days to defragment a hard drive. Remember, when we used to do this back in the nineties, drives were a lot smaller, usually under one gig. And now that we have drives that are up to a terabyte, you can imagine how long it takes to rearrange all that information, especially if the drive's almost full. So one way to do it much quicker is simply back up your drive, of course do your regular Time Machine back-up, and maybe a second back-up for safety. Then reformat it and restore it from Time Machine. This will rewrite all the files, one by one, to the drive, basically doing a defragmentation, but in a much smarter and quicker way.
Now, I did come across one situation where you do need to defrag your drive. That's if you've been using your Mac for a long time, and you decide you want to install Boot Camp. Now, Boot Camp wants to put that special Windows partition in a continuous piece of space on your drive, and if it can't find that, it's going to give you an Error message and tell you to defrag. Well, the easiest way to handle it, then, is to do the back-up twice and then restore from scratch. That will take care of the defragmentation in a fraction of the time that probably the regular defragmentation software would.
So, that's a look at defragmentation. What it is, and why you shouldn't really need to do it on your Mac ever. Apple says you shouldn't. And lots of bloggers and lots of individuals have tested and reported back that it hasn't really changed things or sped anything up on modern Macs. I hope you found this useful. Until next time, this is Gary Rosenzweig with MacMost Now.

Comments: 16 Responses to “MacMost Now 373: Do You Need to Defrag Your Mac?”

    Dan
    3/17/10 @ 10:46 am

    No

    forkboy1965
    3/17/10 @ 11:12 am

    Thanks for explaining the particulars of why one doesn’t need to defrag a modern Apple computer. I was aware of some of them, but not all the ones you brought to our attention.

    Ken
    3/17/10 @ 1:32 pm

    Excellent video Gary! This is so true for me especially I can’t even fill 500GB. Currently I have 460GB free space. The rest is store on a central location. Nice tip regarding backing the hard drive twice. Thanks for letting me know I wasted my money on iDefrag. :P

    How about a video on the firewall when you have the time? Seem very similar to Windows. Thanks Gary.

    Chris Wanja
    3/17/10 @ 3:32 pm

    Gary, I have to disagree in the fact that it “takes a while ‘one hour to one to two days'”. I regularly defrag my hard-drive using an OS installed on a LaCie and boot to that using FireWire 800 cables. Then I run DriveGenius 2 and defrag it.

    It has never taken more than an hour or an hour and a half. And in my experience, it has only FAILED once. I would say that is a major risk, and keep a backup before hand.

    Even though you linked to an Apple KB article that suggests you should not need to defrag, Apple’s ProCare service (http://www.apple.com/retail/procare/) will still do a defrag when you bring it in for a “yearly tune-up”. They may not say it in so many words on the paper work or on the website, but as an ex-employee and Genius – it is a standard to do a defrag when they come in.

    Ken S
    3/17/10 @ 9:50 pm

    Hi Gary, as always great video. I understand everything in the video and have read the many opinions on defragging mac drives but I still run DriveGenius2 every couple of months on my 4 machines and swear that the mac now runs faster and with way fewer beach balls. Yes, I run the repair disk permissions utility but typically don’t see any difference and realize its limited to apple installer packages. I have never had an issue with DriveGenius2 and none of the drives are even close to full. My biggest concern is that the process might cause the drive to fail sooner (in the future) due to all the heavy processing during the defrag? Perhaps its like taking your car through the carwash and you just feel like it “runs” better afterwards… Thanks for all the great videos and tips.

    Ken S
    3/18/10 @ 1:21 pm

    This was an amazing video. Thanks so much for all of the details.! You are THE MOST helpful of any guy out there. Thanks for being here.

    Ed F
    3/21/10 @ 8:22 am

    Great as usual Gary for someone who has recently switched to Mac you are a god send thanks for being there

    Ed F
    3/21/10 @ 8:23 am

    Great video Gary for someone who has recently switched to Mac from PC your videos are very informative thanks for being there Ed

    Richard Stelloh
    7/25/10 @ 12:21 am

    6 minutes and 47 seconds? Answer No.

    sami elias
    6/27/11 @ 11:06 am

    Does restoring from time machine will require reinstalling third party softwares?
    Like do I need to reinstall all updates , mac office . etc etc
    Thanks your time and your usual amazing info
    sami

      6/27/11 @ 11:57 am

      If you are doing a full backup to TM (default) and you do a full restore, you should have everything back, applications an all. But the worse case is you have to re-install things like Office from the original discs.

    chris
    12/24/11 @ 8:01 am

    Excellent explanation!

    EdB
    4/27/12 @ 10:06 pm

    In the video you state that a good alternative to defrag would be a reformat of your startup drive then a restore from time machine. I would love to see the steps you would recommend to get that done. I am on an older imac which HD has been filled/emptied many times and is not running very well these days. Locking up a lot. I would guess I would startup from another OSX disk, reformat the drive, but what I don’t know is how to do the full restore from my time machine backup. Thanks a lot!

      4/27/12 @ 10:22 pm

      The only reason I would do a defrag is if you need to install a windows partition with Boot Camp and it won’t let you until you do a defrag. If your Mac is not running well, I’d try to figure out why — a defrag or starting from scratch is a pretty extreme move.
      But, if you want to do it, the procedure depends on which version of OS X you are using. With Lion, you boot from the restore partition and it is an option there.

        EdB
        4/30/12 @ 5:34 pm

        I have 10.6.8. It is an older mac and some of the free demo software has told me that my mac is 65% fragmented. Sounds like it is about due to me… Thanks for your help.

          4/30/12 @ 7:49 pm

          Don’t know what you are using to tell you that. But fragmentation isn’t an issue with modern OS X (Snow Leopard is OK) and modern HDs. I just don’t see the need for this.

Comments Closed.