Sunday, 29 July 2012

Booting GParted on MacBook Air 11" (late 2010)

I wanted to boot GParted-0.13.0-1 (kernel 3.2.0-3-486) from a USB stick on my MacBook Air 11" (late 2010) using the EFI bootloader which appears when holding down Option while turning on the laptop. However, only HFS+ partitions appear to be attached in a way that GRUB can see, but GParted's initrd cannot mount HFS+ (or even exFAT) partitions, saying hfsplus not found in modules.dep or exfat not found in modules.dep, respectively.

So I used Disk Utility to create a HFS+ as well as a FAT partition on the USB key and copied the contents of the GParted image into both partitions using

$ pax -rw

A possible optimisation would be to try and work out which files exactly are really required on each partition, but since GParted unly uses about 120MB space shouldn't be an issue even for small USB sticks.

Interestingly, whether the USB stick is partitioned using MBR or GPT doesn't make a difference.

After that, the MBA's EFI bootloader (hold down Option while turning on) shows two items called "EFI boot", the first of which should refer to the HFS+ partition. After booting, GParted's initrd then finds the required boot image on the FAT partition. GParted loads and runs successfully using default settings.

There was still another small hurdle before I could reset the SSD:

# hdparm -I /dev/sda
showed the SSD's Security state as frozen which disallows issuing the SECURITY_ERASE command. Googling revealed a trick to change the state to not frozen by putting the laptop to sleep and waking it up. Amazingly, simply issuing
# echo mem > /sys/power/state
and closing and pressing the shift key to wake it up worked perfectly. If you're working on a detachable disk, it also helps to only attach the disk once GParted has booted.

Note: I tried again using GParted 0.19.0-1 (kernel 3.14). I had to select "VGA" mode in the boot menu in order to make X start and waking up from sleep didn't work. So I used 0.13.0-1 instead.