Reduce, reuse, repair, recycle

I’ve had one of those couple of weeks where everything seems to be breaking or there’s lots of projects to do. Some of the projects I’ve been working on..

  1. Receive MacBook Pro from EG for recycling – determined battery had swollen and failed, replace with battery from same model with dead logic board received from EB. Reformat system.. logic board fails (again, I previously reflowed with heat gun in 2017). Recycle maybe? Or try repair again? :D
  2. Upgrade Mac Mini SSD for OC (512GB -> 2TB) – pre-stage previous day, CCC clone to new drive, open and replace. All works.
  3. Open and re-terminate Apple PSU cable (number 9 I think?) for AS
  4. Purchase RTX2060, remove GTX970 from Main PC, put into Media PC
  5. Spend about an hour getting Media PC to work again – needed to put graphics card power cables back into PSU, route them to case, plug in card, troubleshoot no graphics card found, find card wasn’t perfectly seating due to horizontal SATA port fouling, move to second PCIe slot
  6. Go to install RTX2060 in Main PC case. Find it doesn’t fit, disassemble case a bit to drill out rivets holding in unnecessary drive slots, find slots also spot welded in. Decide that while angle grinder would fix that, I should remove motherboard, and if I’m going to do that, I may as well put it in a new case (existing case is circa 2006, owes us nothing). Find new case, install in new case, troubleshoot faulty RAM, remove RAM
  7. Repair digital thermometer – resolder probe wires to PCB and replace battery. All works
  8. Repair Strong DTV PVR for MP – no HDD showing in UI. Remove HDD and test – all working. Run with case open – drive spins up. Inspect PCB, remove swollen capacitors, replace – all working now. Yay!
  9. Repair Dyson handheld vac head – motor not running. Disassemble head, remove dust, re-tension belt – all works
  10. Found dead Apple Bluetooth keyboard in e-waste – repair ongoing – leaked battery has welded button plug in
  11. Replace MacBook Pro Retina battery for MC – battery to be delivered today. Repair soon.

Fixing GPT partition tables for OSX

With our upcoming visit to Australia, we’re doing backups before we go away. But alas! Elizabeth’s USB drive didn’t work. It became unmounted, and when she plugged it back in, no volumes were found!

.. by OSX

Never wanting to throw away the contents of a drive, I started digging. On a Linux box, I used parted to look at the disk and find that it did indeed know about all the partitions that should be on there, but for whatever reason, they weren’t being enumerated.

Satisfied the data was still there, I went back to my Mac and started poking around. I could see that /dev/disk1 existed, and had no partitions, just as OSX would have be believe. Using the gpt command line utility, I got the following:

# gpt -r show -l /dev/disk1
start size index contents
0 1
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 409600 1 GPT part - "EFI System Partition"
409640 1464471472 2 GPT part - "Time Machine Backups"
1464881112 262151
1465143263 32 Sec GPT table
1465143295 1 Sec GPT header

Twirling my evil moustache, I thought if I could relabel one of those partitions, it would make it rewrite both partitions, and she should be apples.

# gpt label -i 2 -l "Time Machine Backups" /dev/disk1
/dev/disk1s2 labeled

But no. I then wondered if /usr/sbin/diskarbitrationd was saying anything helpful about the situation, and ran it in debug mode (edited /System/Library/LaunchDaemons/ as root to add the -d flag to startup), and then kill -HUP `cat /var/run/` and then tail -f /var/log/diskarbitrationd.log and I got this:

18:11:14 probed disk, id = /dev/disk1, with cd9660, failure.
18:11:14 probed disk, id = /dev/disk1, with exfat, ongoing.
18:11:14 probed disk, id = /dev/disk1, with exfat, failure.
18:11:14 probed disk, id = /dev/disk1, with msdos, ongoing.
18:11:14 probed disk, id = /dev/disk1, with msdos, failure.
18:11:14 probed disk, id = /dev/disk1, with ntfs, ongoing.
18:11:14 probed disk, id = /dev/disk1, with ntfs, failure.
18:11:14 probed disk, id = /dev/disk1, with ufs, ongoing.
18:11:14 probed disk, id = /dev/disk1, with ufs, failure.
18:11:14 probed disk, id = /dev/disk1, no match.

Good effort though, right? I mean, I’m sure Apple must expect regular users to put diskarbitrationd into debug mode on a regular basis.


Found out from this blog post that gdisk was available for OSX. Downloaded, installed and ran it:

# gdisk /dev/disk1
GPT fdisk (gdisk) version 0.6.13

Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: present

Found valid GPT with corrupt MBR; using GPT and will write new
protective MBR on save.

Command (? for help): ?

To avoid prolonging the story any more, wrote the partition table to disk, and hey presto, there’s all the data back.

So what did we learn from this? Neither Apple, nor Linux, will try using a backup GPT if the primary one becomes fubared.

And despite all assurances to the contrary, USB bus-powered 2.5 inch HDD’s only just work with OSX’s meager power provision, and if they get unplugged, they won’t have enough juice to flush caches.