Defragmenting my MacBook - using iDefrag to solve Boot Camp errors

Service Station, by Aaron Skonnard

Syndication

Since Wednesday was annoying-Vista-feature-day, I thought today I should focus on a very annoying OSX feature, or should I say lack thereof.
 
If you've spent much time on one of the latest Macbooks, you may have noticed that OSX doesn't provide a way to defragment the hard drive. When I first discovered this, I thought I was surely mistaken. Think again, Aaron. This is Apple you're talking about. I guess I'm just spoiled by Window's quest for all things practical.
 
Apparently, in Apple's ongoing (and sometimes silly) quest for simplicity, they designed OSX to handle it for you behind the scenes. For most home users, that's probably ok, but when you need specific control over your drive usage and the OSX algorithm isn't doing things the way you need it to you're simply out of luck, unless of course you're willing to break out the wallet. Most devs will run into this at some point.
 
The place I've seen this bite people the most, including myself, is when using Apple's Boot Camp -- their drive partitioning software that makes it easy to dual-boot so you can run XP/Vista on your MacBook Intel-hardware. However, if your drive is seriously fragmented or simply not compact enough, Boot Camp will often fail when you ask it to create the Windows partition, complaining that "some files cannot be moved". In my case, I was only using 20 GB for OSX and had 90 GB of disk space free…yet when I asked Boot Camp to create a 50 GB partition, it failed with that error. Again, what really sucks is that there is no way to diagnose or solve the problem using OSX provided tools. I had to resort to a 3rd party. Enter iDefrag.
 
So I downloaded the iDefrag trial and scanned my drive. I noticed a huge file (~2 GB, which happened to be the swap file) in the second half of the physical drive space, so if OSX was unable to move that file, that explains why my 50 GB partition failed in Boot Camp. You can't do much beyond a scan with iDefrag until you purchase it, so purchase it I did ($30). Then I created an iDefrag boot disk (using the CD creator software they provide), booted to the CD, and ran iDefrag (this is necessary because you cannot boot from the HD you wish to defragment, unless you use the simple/quick defragment algorithm, but that wouldn't have done what I needed here). Then I ran the compact algorithm to move everything to the front of the drive.
 
Once it finished, I rebooted to my HD and ran Boot Camp Assistant once again, and voila, it created the large partition no problem. In fact, I decided to dedicate 70 GB to my Vista partition since I'm spend more time there these days and it worked without a hitch.
 
In the end, I spent a bunch of time researching the issue, trying to figure out a built-in solution to no avail -- what a waste of time. So my advice to those experiencing this problem: don't waste time, spend the $30 and buy iDefrag or something like it. I personally found iDefrag to be a great product with great visuals:
Disclaimer: I have no affiliation with iDefrag, it's authors, or the co. I simply found them on Google.
 
There were a few forums that helped me survey the scene and offered other possible solutions, but in the end, the only deterministic solution is to defragment/compact the drive, and Apple doesn't provide it.
 
This is probably my #1 complaint with Apple as a developer -- they simply don't provide the necessary system tools that serious developers need to operate on a daily basis. Instead we have to buy them individually, which gets tiring after a while. And if you can't cater to us, I'm sorry Steve, you'll never see huge grassroots movements around building software for the Mac.
 

Posted Mar 09 2007, 11:46 AM by Aaron Skonnard

Comments

DB wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 03-10-2007 2:12 PM
OS X handles all defragmenting for you behind the scenes, removing 99% of the hassle users formally had to devote to this if they wanted good performance. And you're complaining because in one relatively rare instance (only applicable to Boot Camp users who try to install it long after they installed the initial OS AND who have relatively full hard drives, that's an incredibly small number of people compared the army of defraggers we had before).

The best solution to your problem was to install Boot Camp on a freshly wiped and reinstalled OS X HD, NOT to resort to iDefrag. So defragging to make room for a new partition is not even the optimal solution for the tiny percentage of users affected by this.

Your criticism reflects PC bias. You couldn't believe that Apple didn't include a defragging tool, whereas Mac users tend not be able to believe how many years Microsoft put out an OS that requires everyone to defrag regularly to maintain good performance. You see the other side of the coin now? People who are still irrationally attached to the idea that defragging is a good solution to anything can go ahead and fetch the 3rd party tool to assuage their psychosis, so nobody loses.

Stick around, you'll get used to it.
DB wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 03-10-2007 2:20 PM
Also your advice to Steve completely backwards. According to you, Apple should take more product categories from 3rd party developers and develop them in house -- or else there will be no grassroots software for the Mac?!

How does that make sense?!

And BTW, if you were really a "serious developer" you would know how to access any system tool you require in the UNIX command line layer, free of charge.
Michael wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 03-12-2007 9:02 AM
Ummmm.... how new to OS X, computers and Unix is the author of this blather? They seem to be complaining about a feature of the OS that allows you to do more - not less.

Here is the deal: Should one not have enough ram for the tasks asked of it; there is a built-in fail safe function in OS X to deal with the lack of RAM for those tasks being asked. OS X in it's Unix based OS creates these swap files for times when the user over saturates the memory configuration of their PC for whatever reason. These swap files start at 32mb - so when one has a swap file of nearly a 2gb as described - let's simply say that there is a high magnitude of memory demands high are above and beyond the amount of physical RAM they have installed.

Secondly there is an automatic de-frag operation built-in to Unix for user files under 20mb. These files are the absolute majority of files for 100.00% of all users. Not 99.99 or less - but 100.00%

So under what circumstances do these swap files most often occur? Well, on a PowerPC based system it is most often from utilizing Classic and OS X programs simultaneously. On a Intel based system it is most often based using non-universal applications (those running under Rosetta), and/or multiple OS's such as Parallels or the quasi-OS via Crossfire. Both of these scenarios involve emulation and virtual machines, both of which must live in RAM: and greedily so as the PC is being asked to basically run multiple OS's at the same time.

It can also occur simply by not having enough RAM in the first place. The truth is that with modern PCs of any brand using the latest OS's having less than 2gb of RAM will compromise the performance of the OS to some degree in the real world - and power users may require more. The exception to this is when one never emulates or leaves the OS with apps specifically written for it. However even when this occurs - the web browser itself can still have memory creep when faced with poorly written or executed Java or Flash.

At the same time that this swap file occurs on the Mac using OS X - there is a very simple remedy to clearing it if quitting programs and events does not: and that is to restart.

Had the writer done this simple thing - the entire blog would have probably never been written - as the 2gb swap file (which is a temp file) would either not have been created or would have been created in a contiguous space to other files. Like all statements in my reply there are exceptions to this also - and those are when the swap file was either incorrectly created or is the result of program corruption (i.e. one had a hard crash that was not recovered from properly). In that case there are numerous free utilities that could take care of it instantly before the OS itself got around to the task.

Sorry to be so geeky but: Devisive swap files such as you are describing occur after the OS has completed it's start-up and a secondary app or call or user input has been made for free memory above and beyond that of which is available. Non-divisive swap files can and will occur at many times - but those are not in the picture when the creating apps have not been activated (ergo the simple restart methodology....)

The fact that the author is ignorant of how swap files work does not give them license to dismiss swap files themselves as evil - just as not understanding collateral requirements for a loan does not mean one would be justified in demanding unencumbered title to a piece of property. Yet something similar to this analogy is precisely what the author has done.

The computer asked for a loan of memory based upon your request for it to do something requiring more memory than they had installed - and unfortunately - it had no more real memory to give. Instead of turning the user down for the loan of memory (as it should have because they did not have the proper collateral to secure it - nor were they very polite about it....) it created a special albeit slower substitute called a swap file. This is the very same file being complained against as some dirty culprit that is in the words above"annoying".

Can it be that annoying to have an OS so smart that it overcomes ones own ignorance and lack of knowledge? And what is the fix? Aaaah.... if everything else fails here is what one does (it's not rocket science nor nearly as time consuming as you have portrayed in your blog): RESTART!

Does that cost $30? NOOOOOOOOOO! It costs one the difference between ejaculating the foolish column above and having the problem solved. Asking someone for a little help on issues like described above go alot further than railing against the problem - in the author's own words: it's annoying.
Aaron Skonnard wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 03-12-2007 10:03 AM
It seems I struck a *little* nerve with the previous two commenters. Before you two send the Apple hit squad after me, let me humbly acknowledge that I'm a long-time PC/Windows user and it's quite possible that I don't have the level of experience you think I should in order to use the product at hand.

But what I still don't get is that if Apple's built-in algorithm is so wonderful, why didn't it take care of my problem automatically? That's the problem with the *law of leaky abstractions*, eventually abstractions leak and you need another way to solve the problem. As a developer, I expect the OS to provide a visual defragging tool for that reason.

I do not believe that the built-in Unix command would have solved my problem since the file size was extremely large and most likely unmovable for some reason. What I really needed was the "compact" algorithm. Does the Unix command provided that for large files?

The iDefrag tool seemed to indicate that the problem file was a swap file of sorts (can't remember exactly what it said) but it couldn't have been the transient swap file because, of course, I rebooted numerous times -- it's more likely that it was some type of rogue file that didn't get cleaned up properly.

Not only did I reboot numerous times, I booted to the Apple disc, ran the diagnostics/health tool, tried a bunch of different things that others recommended in blogosphere but nothing made that file go away or move to the front of the disk, leaving me stuck in a rut with Boot Camp. Like I said, the only deterministic solution was to purchase iDefrag. And that seems consistent with what everyone else has experienced except for those who just settled for less disk space because they had no clue how to really solve the problem.

If you Google "boot camp files cannot be moved" you'll find this problem is quite pervasive and therefore unfortunate because it's causing signfiicant friction in the movement towards running Windows on a Mac, which probably doesn't matter to you guys anyway, but it matters to others and could eventually become the fuel towards a signficant new revenue stream for Apple. That alone should matter to Jobs, and I'm quite sure it does.
Service Station, by Aaron Skonnard wrote Installing Windows Vista on your MacBook
on 03-13-2007 10:40 PM
Dan Diemer wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 03-15-2007 4:37 PM
I followed the rabbit trail of postings around the internet and found that same macosx.com post, and went with iDefrag as well. It'll be done in a few minutes by the looks of it so hopefully this will solve my issue like it did yours.
Jamie wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 03-20-2007 4:07 PM
OSX doesn't condense HDD data efficiently. Data spread out on the entire width of a HDD can severely shorten its life....mechanically.
Peter Morgan wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 04-01-2007 2:20 PM
Mac OS X does not defragment free space - hence problem. iDefrag is an excellent solution for those who require it.
Elliott Stanger wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 04-03-2007 11:59 PM
This worked for me, sort of. I defragged with iDefrag, and was able to partition the drive with BootCamp, and install windows xp (then vista). But after finding a better version i took off the partition (had to use iPartition because of a BootCamp error) and now i can't re-partition. So, this method works, but a few changes I made messed it up for me.
Bot wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 05-20-2007 5:55 PM
I too was surprised when I found out the Mac OS didn't have a defragger. Course that was OS 9 at the time.

I agree that paying $30 for something some OS vendors include is a bit irritating. But there are many advantages to OS X and Apple. And many irritating aspects of using Windows.

OS X will never be exactly like Windows. I think it's best to accept it as it is, work around its limitations just as you learned to work around Windows' limitations.

IMHNosyO.

Bot
Milos wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 07-02-2007 11:59 PM
Thank you Aaron. This information has been very helpfull !! Dont mind these Apple Mac geeks.
Tim wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 09-05-2007 10:48 PM
holy cow guys! get a life will you? this information is quite useful. No, i am not going to do a fresh install of osx as the first comment suggests. What a complete waste of time.
CS wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 09-09-2007 9:17 PM
cmon mac snobs... it's not that unusual to use a computer for a while and then decide to add something to it, in this case widows OS. actually the reason i waited a while before installing boot camp is that i tried out parallels. parallels wanted me to pay them $30 more after i already paid for a "permanent license".

so parallels rolled me first, and now i learn that i must pay $30 just to move some files around.

if macs are so user-friendly, and they run windows so well, why is all of this such a hassle? instead of being so defensive and making ad hominem criticisms of people who run into problems, why not admit that macs are just starting to run windows, and they are still working out some of the logistics. i like that much more than flaming anyone who dares to criticize the House of Jobs!
John Jacob wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 09-13-2007 2:46 AM
@Aaron: But what I still don't get is that if Apple's built-in algorithm is so wonderful, why didn't it take care of my problem automatically?

Well, Apple's built in algorithm is great for all normal usage of a drive (partition). The HFS+ file system does not prevent fragmentation, it is resistant to it. Which means, under regular usage, you do not see much of a performance hit due to fragmentation unless you have a heavily fragmented drive that is almost full.

However, what you want to do here is to REPARTITION the drive by shrinking the existing partition. It is not possible to do this on a fragmented drive. I would not call repartitioning "regular use".

Since Mac OS X does not need defragmenting under regular use, Apple has not provided a built in defregger.
pjh wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 09-23-2007 2:45 AM
As someone who is taking the most tedious but cheapest method by backing up all my
files, erasing the hard disk, and restoring all the files again to achieve a manual defrag in order to create a contiguous Bootcamp partition - I concur with Aaron's statements. Apple has not made this easy at all (maybe that's their plan?), but it is possible to do without forking out more $$ - it just takes a couple of hrs!
Macuser wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 12-13-2007 2:16 PM
I got this same error, Im running on OSX 10.5 aka Leopard. I tried to use the utilies and other things. Nothing worked and I dont want to wipe n reinstall OSX like Apple said when I called them but I also dont want to spend $30 bucks on something im only gonna use once. If you guys find any free versions of the idefrag or something like it please post.
TrackBack wrote The Official Mac Chat Thread - Page 3 - 8th Generation Honda Civic Forum
on 01-16-2008 3:33 AM
The Official Mac Chat Thread - Page 3 - 8th Generation Honda Civic Forum
Ger wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 02-21-2008 6:22 AM
This problem is so not isolated. It's big. There are so many little holes in Leopard that are effecting many more users than Apple would like to let on to. Another example is the Airport Disk snafu that comes with the new Leopard 10.5.2 update. Nice work, Apple.

Hey, all you Apple disciples. You should be aware of the dangerous direction your (increasingly greedy of market share) company is going. Apple is now spending oodles of cash trying to woo PC users to the Mac side of the fence by extolling the virtues of Windows-capable Intel Macs. So, after buying said switch-hitting Macbook and getting used to OS X, 20-year Windows veteran that I am, I decide to install Windows. Does Apple say I need to do it within the first 30 days of buying my Mac? Is that a part of their marketing ploy. No. Ease of use is, though. And when I go to install Windows XP SP2 through Boot Camp and get a black screen error trying to partition the disk, I should know that I've got a wiped hard drive and clean install to look forward to? Nah. Apple needs to get themselves together. If you're going to go tooting your horn about the new, fancy OS and the new Windows ready machines, you've got to have your deck of cards in order. Apple's growing too big too fast. It's too bad for all the old-school Mac loyalists seeing their company chase the buck while sacrificing quality, and too bad for all the Windows-based PC loyalists who are gonna spend a king's ransom for pretty looking money pits.
Greg wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 04-05-2008 10:25 PM


I have used iDefrag for a few years now and it has NEVER let me down and has solved numerous problems when working with Firewire HD and additional HD that require some defragmentation without slowing down the drives from the process of doing so. I work in film and television as a composer/sound designer and it simply has to be done sometimes. The only other thing I can do sometimes is remove the files on the drive, do an erase and reinstall driver with Disk Utility and then put the files back on. However, this has not always fixed a problem I had with a file. Again, I live and die by deadlines, so I need something that I can trust to do the job quickly and efficiently. iDefrag has served me when in all of my situations.
Eugene Kriegsmann wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 08-04-2008 9:37 AM

Aaron, I am with you. My iMac was  mess with the OS and programs spread all over the drive. I am not a "serious software developer", nor am I all that anxious to go delving around in the depths of Unix. However, when I notice a decrease in the speed of my system, slowness of opening programs, and all sorts of other problems associated with a fragmented hard drive I decided to use the trial version of the software to have a look. The view was not happy. I have had the iMac for two years and it was about 1% fragmented and the profile of the hard drive showed small gaps between files which were spread all over the drive. $35 paid to Coriolus and six hours later my iMac is running better than it has in a very long time. I defragged and compacted. I will do this every few months since unlike Windows it should need monthly or more frequent cleaning.

I have no problem with Apple not including this kind of utility. What I object to is the BS that we get fed that it isn't necessary. For the average user which describes me, this is a relatively cheap, safe, and easy way to maintain the health of my system. If one of you others wants to go digging around in UNIX, have fun. That is not my area of expertise, nor am I motivated to seek it out.

Drew wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 08-09-2008 2:51 PM

I completely agree with the author of this blog. Ignoring all side matters, there simply is no other way to install Boot Camp on a fragmented hard drive aside from re-formating or compact defragmenting - either of which take a very long time.

Considering Apple promoted Boot Camp as "one of the big features" of Leopard, they should at the very least have included a fail-safe in case the "file cannot be moved" error occurs when partitioning.

Chris wrote re: Defragmenting my MacBook - using iDefrag to solve Boot Camp errors
on 11-14-2008 6:31 AM

coming from someone that just had to do this do the the same bootcamp error... you cant say "well the regular defrag does the daily use" "repartitioning isn't regular use its advanced"

NO IT ISNT

Boot Camp changed things, boot camp was supposed to take repartitioning and dual booting to the point that any joe-shmoe could do it so if that meant that f*cking boot camp should have had the capability of doing a small compact defrag to complete it's "job" of repartitioning then it should have been including.... the lack of this feature and the fact that most people that have decided to add windows after a bunch of osx usage (fragmentation) just get a non-descript error saying to REINSTALL MY MAC! is not ok... it just isn't how the hell is reinstalling my computer the solution for aprogram that was supposed to make life easier.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?