Overwritten

Jotting this down as a reminder and a warning to others that working with low-level disk tools are dangerous and can cause data loss.

Late last night, I decided to 'burn' the Raspberry Pi Raspbian OS disk image onto a new 32GB SD card I recently got.

I'd previously used a GUI app called RPI-sd Card Builder successfully for a few other SD cards for the Pi. Although I'm pretty comfortable in the Mac OS X Terminal, I wanted to avoid making mistakes and wiping the wrong drive with a single typo on the command line.

The process went smoothly, except for a error at the end from the utility about not being able to unmount the drive, which I didn't think much about, and just unmounted the drive manually in Finder.

I plugged the newly created SD card into my Pi, but it wouldn't boot up. It was getting late and figured it might be a faulty microSD to SD card adapter, or that the Pi had issues with that specific brand of card, and would take a look at it the next day.

So tonight I checked the contents of the SD card, and oddly, it was empty. Meanwhile, Time Machine started showing this error about connecting to my Time Capsule:

I rebooted both my Mac and the Time Capsule, thinking it was one of its intermittent glitches. Nope, backups were still failing, so I connected to the Time Capsule disk from the Finder, and mounted the sparseimage disk image file for this Mac. The contents of that disk that appeared was not what I expected at all. It looked like the contents of the Rasbian boot disk.

I thought Finder must have been acting weird and showing me the contents of my SD card, I unmounted and ejected everything, physically removed the SD card, and reconnected to the Time Capsule disk and mounted the backup disk image again. Sure enough, Rasbian. My stomach churned.

When using the SD card builder app, I double-checked that I had selected the correct disk, so how could this have happened?

As part of the SD card writing process, it needs to be unmounted and repartitioned. I wondered if somehow the drive identifiers might have changed when my Time Machine backup started while SD card was unmounted.

I ran a quick test, where I mounted 2 different disk images using the command line - hdiutil attach <diskimagefile>.sparsebundle . As you'd expect, the first image gets a disk identifier of /dev/disk2s2 and the second is /dev/disk3s2. So far so good, so I unmount them both, and repeat the command with just the second disk image. To my surprise, it got assigned /dev/disk2s2. BINGO.

My best guess as to what happened, is that when the SD Card Builder app unmounted my SD card, Time Machine decided to start backing up and mounted the backup disk over the network, 'stealing' the disk identifier that was originally assigned to the SD card. Even though I had picked the correct drive identifier, it seems like the drives got swapped before the writing started, and when it did, it was done on the backup drive. This also explains why the app couldn't unmount the drive because, presumably, Time Machine was still trying do the backup, even though the partitioning and data had already been re-written.

Even though Finder still shows the file size of that backup sparse bundle as 490GB, which is over 6 months worth of backup history, hdiutil attach <diskimagefile>.sparsebundle shows the partition type as Linux and cannot be mounted, and there isn't a Apple_HFS partition at all.

I'm assuming that disk image is good as gone and I won't be able recover any of that data since the entire partition map and file system has changed, so I'm deleting it and starting a new backup from scratch. I'm just glad that it wasn't my boot drive that got hosed.

Despite my best efforts in taking precautions, the app I used was not much more than a wrapper around the unix dd command that writes to disk at a block level, and this is an incredibly powerful and potentially destructive command. The lesson today, boys and girls, is to eject all unnecessary disks, and disable any apps or tasks that might cause a disk to get automatically mounted (such as Time Machine or other backup/cloning apps) while you're working with low level disk utilities (especially those that repartition or reformat disks).

Boxing Day Tech Sale

I've got a bits of tech that has been collecting dust and I've decided to sell.

Let me know if anything interests you and make me an offer, or bid on the eBay auctions linked.

Apple MacBook Pro 13" (Mid 2009)

  • Model ID MacBookPro5,5
  • 2.53 GHz Intel Core 2 Duo
  • upgraded to 8GB RAM
  • upgraded internal 240GB OWC Mercury Electra 3G SSD (285MB/s read/write data rate)
  • Battery health at 524 cycles, current max capacity 4744mAh (~87% of original design capacity of 5450 mAh).
  • minor cosmetic scratches and scuffs, never dropped, no dents, no cracks anywhere.
  • screen, keyboard and trackpad in perfect condition.
  • Mac OS X 10.8.2 Mountain Lion installed

http://www.ebay.com.au/itm/300838691893

Apple iPad mini 16GB Wi-Fi

  • Excellent condition, no scratches or wear on either the glass screen or on the back case.
  • Up to date iOS 6.0.2
  • purchased 19/11/2012 - just 5 weeks old. Receipt will be provided for remainder of the 12 month warranty

http://www.ebay.com.au/itm/300838674596

Apple iPhone 4 32GB Black

  • Out of contract, unlocked, use any sim worldwide
  • good condition, some scuffs and wear on stainless steel band, tiny chipped off bit of plastic around the screen, no scratches on back or front glass
  • Silver 'LEAF' metal skin, maze pattern, applied to back (removable)
  • Free Kensington Mini Battery Pack to extend the battery life, attaches directly to the 30-pin dock connector
  • iOS 6.0.1

http://www.ebay.com.au/itm/300838685425

Apple iPhone 3GS 16GB White

  • brand-new, pristine condition, no scratches, no scuffs, no cracks, no water damage
  • unlocked, never activated, use any sim worldwide
  • iOS 5.x (probably 5.0 or 5.0.1)
  • warranty replacement unit (1-1 swap at Apple Store for damaged iPhone)

http://www.ebay.com.au/itm/300838682585

Blackberry Playbook 7" 16GB

  • excellent condition, barely used,
  • updated to Playbook OS 2.1.0.1088
  • ability to run Android apps as well as Blackberry AppWorld apps

http://www.ebay.com.au/itm/300838678233

Satellite Maps - Bing is Best

While on a trip to the Warragamba Dam today, Anthony recognised a location that we drove past on the M7 (Westlink) highway as the Hoxton Park Airport, a small regional airport. However, instead of the usual airport terminal buildings, it looked like a complex of warehouses and offices now. Curious as to what's happened, I looked it up on Apple Maps on my iPad.

The satellite imagery seemed a bit outdated, showing what looked like a construction site, with no buildings. On the northern end of the brown dirt, you could just about make out the remnants of what were the runways.

Since everybody's having a big whinge about how crap iOS6's maps are, I thought I'd compare it with the superior Google Maps (using Safari). It showed very clearly two landing strips and a few small buildings. Nothing like what is actually there today.

I've never used Bing Maps at all, but I though I'd give the benefit of the doubt and give it a go. I was not hopeful that Bing would be any better than Apple or Google in their mapping solution. To my surprise, Bing Maps' satellite view showed the new buildings, clear as day.

Just comparing the area around it, there also seemed to be a few other developments in the area that Apple and Bing maps have, but still look like farmland on Google Maps. To Google's credit though, they still had the correct roads and road names on the maps overlay, even though it doesn't match up with anything on the satellite image.

This quick test turned out to be quite an eye-opener for me, that Google Maps actually had the most out-of-date satellite imagery, and Bing was the most accurate. Maybe it's time to reconsider other options.