Macbook Air’s SSD died – here’s my new backup strategy

My mid-2011 Macbook Air‘s SSD died last week. I’d spent a lot of time setting this up just how I wanted: dual boot OSX and Win 7 (then Win 8) – 50Gb for each OS, and a 150 Gb shared exFat “Data” partition which is writable by both OS. The Data partition contained all my music, photos, and source code.


My backup strategy was:

  1. OSX backed itself up automatically to my Time Capsule using Time Machine.
  2. Windows I never backed up because I don’t mind re-installing a new Win machine in the event of failure since it’s a good chance to start from scratch and get rid of old crap – old versions of Visual Studio etc.
  3. The Data partition – the most important one – I backed up manually both to my Time Capsule’s shared network disk and an external USB drive, using Syncback Free. I’d usually do this once or twice a month.

I’d had an inkling that the SSD was about to die for about a week before – every morning on boot the Mac would display a flashing question mark icon. Usually it would boot OK on the second or third attempt. Until it didn’t (on my birthday, no less)…

Cue the usual ranting and gnashing of teeth. Every day I’m not working is a day I’m not getting paid (contractor, ya see). All of the Mac service centres in London promised a 3-5 working day turn around, because they would have to order in a replacement SSD. Which means I’d have to make an appointment with the dreaded Genius Bar since they probably would have the part in stock.

The staff at the Genius Bar are always great, but I HATE the process you have to go through to see them – booking an appointment online. To cut a long story short, I was able to get a walk-in appointment later that day, and because I had AppleCare (which I bought specifically because SSDs are unreliable), the £600 replacement part cost me £0. But it still cost me a day’s productivity (and pay!).

In terms of lost data, not a lot. I lost a Linux VM which I could rebuild in about a day. Source code is on git / svn servers so none. Personal data – some photos of a trip to Portugal but I was able to get lower res copies of most of them from Facebook.

Since then I’ve changed my backup strategy slightly, so as to avoid downtime, by embracing the Mac way of doing things:

  1. No more dual boot – I’m gonna run Windows 8 in VirtualBox when the need arises
  2. Everything is on the one Macintosh HD partition. However, old habits die hard – I still have the content of my old “Data” partition located at /Data on that hard drive, organised how I like it to be and not how OSX wants me to have it organised.
  3. Time Machine + Time Capsule now backs up everything automatically when I get home.
  4. Super Duper backs up and creates a bootable version of my Macintosh HD on an external USB drive. This means that if my SSD dies again, I can boot straight off the USB hard drive and carry on working. At the moment I’m doing this every night, which takes about 20 mins (using the Smart Copy – I purchased a license). But if I think about it, once a week or so should be adequate since my personal files should be getting backed up by Time Machine, and I usually commit / shelve source code every night.

I still feel a bit uneasy about running Windows in a VM, but lately I’ve only been using OSX at work. I’ll see how it goes when I start coding in .NET again in a few weeks.


Upgrade a Macbook with Boot Camp from Windows 7 to Windows 8 Pro

I have a mid-2011 Macbook Air running both OSX Lion and Windows 7 using Boot Camp.

Over the weekend I upgraded it to Windows 8 by doing the download only installation. The process was quite simple and it worked fine. Here’s the steps:

  1. Boot into Windows 7
  2. Go to and click “Buy Windows 8”. Download the installer and start it up.
  3. Pay! The installer will ask for you billing details, credit card / debit card / Paypal details etc. At £25 I thought it was a cheap enough upgrade, especially since I would be going from Windows 7 Home Premium to Windows 8 Pro which means I’d get Remote Desktop etc.
  4. Wait half an hour while the installer downloads the OS.
  5. Once the install starts, it will ask you if you want to
    1. Keep all your programs and your personal info and settings
    2. Keep your personal settings only
    3. Keep nothing. I went for this option as I always like to start fresh.
  6. Now I had a few problems. The install demanded that I have 20Gb free on my C: and I only had about 5 Gb free. I had to stop the installation to free up some disk space. I did this by:
    1. Running Disk Cleanup
    2. Disabled Virtual memory, which shrunk the pagefile.sys from 4Gb to 0Gb.
    3. Disabled hibernate, which removed the 4Gb hiberfile.sys
    4. Deleted c:\Windows\TrustedInstaller folder – but that was a mistake, because then I couldn’t uninstall any programs to free up the necessary space!
    5. Since I was choosing to keep nothing on C: anyway I deleted folders willy-nilly from C:\Program Files and C:\Program Files (x86)
  7. After that I was able to continue the installation which took another 20 mins or so. It rebooted 3 or 4 times, during which  I had to hold down the Mac’s option key at boot and choose the Windows partition.
  8. All done! Windows 8 works fine.

Once it was installed I did a couple of clean-up tasks.

  1. My C: was almost full again, because the install had backed up everything in the C:\Windows.old folder. So I ran Disk Cleanup again and clicked the “Clean up system files” button to remove those.
  2. I no longer had Apple’s Boot Camp drivers installed in Windows, so I had boot into OSX, start the Boot Camp helper and copied the Boot Camp drivers to a USB memory stick. Then rebooted into Windows and installed those drivers. Worth doing so that the Mac’s hotkeys (volume up/down, screen brightness etc) would work.

Fix crackling audio on your iPhone

If you find that music on your iPhone crackles when you listen through your headphones, try cleaning the headphone jack.

Because your iPhone lives in your pocket, pocket lint can accumulate inside your iPhone’s headphone jack.

I had 3 years of accumulated pocket lint inside my headphone jack, without knowing about it. For months I thought the iPhone was dead and I’d need to replace the headphone jack which is very difficult.

The solution – just get a bent paperclip and scrape it all out. Voila! No more crackling music!

Running a Win 7 VM on a Macbook Air (2011)

A few days ago I bought a new Macbook Air. I went for the fully pimped one which comes with an i7 and a 256Gb SSD. With the VMware Fusion demo I was able to bring my old laptop over and run it as a VM inside the Mac.

A few notes:

1. VMware’s Migration Assistant wanted to create a VM of my entire laptop, with both C: and D: disks. I didn’t want to bring over the 200Gb D: and the Migration Assistant didn’t have any options to prevent that from happening. So on my old laptop, I installed VMware’s free VMware converter. That had many more options including the option to exclude D:

2. It looks like I don’t need to buy a new Windows license. So far my VM hasn’t phoned home to Microsoft – maybe it will?

3. For networking, although I’m connected on WiFi to my flat’s network on the Mac, the VM sees it as an ethernet connection. Initially I couldn’t connect to the network on the VM because it was complaining that there were no ethernet drivers installed. I had to edit the .vmx file and add a line ethernet0.virtualDEV = “e1000”.

4. Visual Studio is completely red and unusable! I haven’t figured that one out yet.

Update (Dec 2011)

The Visual Studio red problem I had was with VMWare Fusion 3 and Parallels 6, but it seems to be fixed in VMWare Fusion 4 and Parallels 7. Having said that, I don’t use virtualisation and reboot and run Win7 in Boot Camp.

Improve ASP.NET page performance using Database Engine Tuning Advisor

I was recently working on a legacy ASP.NET application which was taking like 30 seconds to load a simple page with a Gridview.

The culprit was Linq to SQL lazy-loading combined with an inefficient architecture. By tidying that up I was able to get the page load time down to about one a second.

I could have stopped there but I thought it would be nice to see if the SQL performance could be improved further.

Step 1. Profile

Start SQL Server Profiler and create a new trace. Choose the "Tuning" profile.

If your database server has more than one active database on it, you will want to choose to filter activity to your database only.

Once the trace starts recording, go to your website and hit the page you are trying to improve. In my case it was a page listing Help Requests, so I hit that page and did a couple of searches. Stop recording the trace and save it. I called mine “help requests.trc”.

Step 2. Analyse

Start SQL Server’s Database Engine Tuning Advisor. It will automatically start a new Tuning session when you connect to your database.

Choose your trace file that you’ve just recorded (1), choose your database (2), tick your database again (3), and finally hit Start Analysis (4).


Oops, that’s not quite right. It’s reporting errors, "SHOWPLAN permission denied in database ‘DBTest’"

At first this didn’t make sense, because I’m a dbo so I have permission to do everything. But remember – we’re running a trace we recorded earlier. IIS’s application pool for the website is setup to use a specific account – COMPANYDOMAIN\IIS_APPUSER, and this account doesn’t have SHOWPLAN permission. So grant it:


Now run the trace again, and you should see the recommendations screen.

Step 3. Tune

As you can hopefully see, SQL Server recommends creating 4 indexes and a bunch of statistics, and estimates a whopping 92% speed improvement! Press the Save recommendations button in the toolbar to save those recommendations to a SQL script which you can review and tweak, and then run that script against your database.


Lost intellisense squiggles after Resharper 5.1 uninstall

I had another play with Resharper at work recently. There’s lots I like about it, for example the code suggestions, and the way it grays out unused functions and unused branches in methods. It’s really good for tidying up legacy code. And “Go To Implementation” is a massive time saver.

There’s a few things I don’t like about it. I don’t think it’s Refactoring options are much better than those built into Visual Studio – I only ever use Extract Method anyway. And I don’t like its “Find All References”.

Anyway, when the trial ran out and I uninstalled it, I found I’d lost my Intellisense squiggles (under Syntax errors and the like).

To turn them back on, it’s under Tools –> Options –> C# –> Advanced. Check “Underline errors in the editor” and “Show live semantic errors”.


Windows XP: password has expired, but you do not have permission to change the password

Since I work in IT, I’m occasionally asked to do tech support for family and ex-girlfriends, even though that’s not my area of expertise. Yesterday a friend had a problem I’d never seen before.

After bootup, she would be presented with the standard Windows XP login screen, with only one user account available for login. She clicks her name, enters her password, and then gets a message “your password has expired, you must enter a new one” or however the exact text goes.

So she enters a new password but then gets “You do not have permission to change your password”, which prevents her from logging in and takes her back to the login screen.

After trying a few different things to no avail, I tried googling the problem on my iPhone. But I couldn’t even find anyone with the same problem, let alone a solution.

Safe mode to the rescue

I tried booting Win XP into safe mode, and luckily at the login prompt I could now choose to login as Administrator (with no password!). Once inside I checked the account my friend was trying to login as, and sure enough the “User cannot change password” box was checked, and the “Password never expires” box was unchecked.

I restored the settings back to how they should be – password never expires and user can change the password. So that fixed the problem, but I was still wondering how those settings got set like that. My friend sheepishly admitted that she’d been playing around with those settings a while ago when she had password problems with her ISP. D’oh!

Make yourself an admin in SQL Server 2008

The same colleague I was helping with their SQL install yesterday made another mistake. She mustn’t have set herself to be the db admin, because we’d get “Access denied” messages when she’d try to connect to her local db using SQL Server Management Studio.

Fortunately she found this script by Ward Beattie which fixes the problem. She only had to enter MSSQLSERVER as the SQL instance name.

SQL Server 2008 install requires Visual Studio 2008 SP1

I was helping a colleague setup their new Windows 7 developer box today, and we couldn’t install SQL Server 2008. SQL Server’s installation would complain:

A previous release of Microsoft Visual Studio 2008 is installed on this computer. Upgrade Microsoft Visual Studio 2008 to the SP1 before installing SQL Server 2008.

Well, we’d already installed Visual Studio 2008 and Visual Studio 2008 SP1 so why wasn’t it working? Even after a reboot Visual Studio 2008 was reporting that SP1 was already installed.

In the end we had to install VS 2008 SP1 a second time, and after that the SQL Server install worked fine.

What went wrong? The developer had started to install SQL Server 2008 while VS 2008 SP1 was still being installed.

Speeding up my Wi-Fi b/g network at home

I was trying to watch recorded HD content from my HTPC on my laptop, but it would stutter and be unwatchable. I quickly realised that my wireless network was too slow.

So to diagnose the problem I tried copying a large (2 Gb) file across my wireless network and see what sort of speeds I was getting. Only around 700Kb/second! Hmm, that seems awfully slow.

I opened up my router’s config page (Linksys WRT54GL using the patched tomato firmware) and tried the usual suspects – 1. changing to a different channel; 2. moving the router away from possible sources of interference; 3. trying a USB wireless network adaptor I had lying around instead of my laptop’s built in wireless, all to no avail. I was still only getting around 700Kb/sec.

I went into the router’s Advanced settings page and had a look at the options in there. Hmm, let’s try disabling this Afterburner setting. Boom! Once that was disabled the file copy went up to 2Mb/sec. That setting is disabled by default, but I had enabled it when I first setup my router (a year ago) thinking it would probably make things faster. Well that wasn’t the case, it was slowing things down.

I then tinkered with a few other settings, and I found that enabling Frame Burst sped things up a little bit, to around 2.5Mb/sec.

So yay, now I can watch recorded shows over my Wi-Fi g network! I don’t need to buy a 802.11n router and USB adaptor :-)

Moral of the story, which applies to all technology really – stick with the default settings to begin with, and once you know your baseline then tinker.