Viewing Category: Apple  [clear category selection]

Manual Time Machine Cleanup

I recycled an old Time Machine disk (a beautiful G-Technology aluminum enclosure with a beefy replacement HDD inserted) that had backups from another machine. It didn't have enough room left for my new MacBook Pro. I thought I'd be clever and fix it up:

sudo rm -rf /Volumes/Time\ Machine/Backups.backupdb/old-mac/2015-*

Lo and behold, i got permission denied. Turns out, the proper way to clean up a Time Machine volume is to use tmutil. Like so:

sudo tmutil delete /Volumes/Time\ Machine/Backups.backupdb/old-mac/2015-*


New Mac Setup

My old MacBook Pro died. I needed to get a replacement and get back to work, like, immediately. I picked up a new MacBook Pro. It didn't take too much effort to get backup up and running, but I did make some different choices on initial setup:

  • Turned on FileVault: I hadn't encrypted my home directory before, or anything else. With the new laptop, I turned on whole-disk encryption.
  • Matched Username: I had previously used joseph as my username on my laptop and jlamoree on my iMac workstation. This discrepency caused me to maintain two separate project build properties (based on running Ant reading ${}.properties). The matching username should make development a little easier.
  • Disabled Chatty Cathy: launchctl unload -w /System/Library/LaunchAgents/
  • Switched 1Password Formats: I took this opportunity to switch from Agile Keychain to the newer OPVault format.
  • Left VMware Fusion Behind: My team uses Vagrant with VirtualBox for local development. This works very well. I had intended to try using the Vagrant plugin for VMware Fusion -- even purchased a license for it -- but I found that it would be easier to use the same environment my teammates use, rather than craft special version just for my personal setup. Also, the upgrade purchase costs were getting me down.

Here are the applications I installed, in roughly the order in which I installed them:

Within Sublime Text, I first installed Package Control, of course. Then these packages:

Some useful, I think, preferences for Sublime Text:

"draw_white_space": "all",
"highlight_line": true,
"show_full_path": true,
"trim_trailing_white_space_on_save": true

Finally, with the Sublime Text tips, put a link to the CLI binary in /usr/local/bin:

sudo ln -s /Applications/Sublime\ /usr/local/bin/sublime

Kinda following on with the Sublime Text steup, I've been looking for a good way to preview content written in Markdown. I gave a few apps/packages a try, but I think I've settled on Marked being my previewing utility of choice. In fact, I'm using it right now.

I had previously used Caffeine to prevent my computer from sleeping (which is very disruptive to open SSH connections and mounted network volumes). I tried Amphetamine this time, since it's being kept current and seems pretty popular. It has many nice features over my old solution.

Running SpinRite on a Mac

I created a short screencast showing how to run SpinRite on the 750 GB SATA drive inside my MacBook Pro -- a conventional drive, not a SSD. It's available on YouTube. This blog post cointains details and references.

I needed to repair some file system problems that couldn't be fixed with Drive Genius, which I've never had great luck using. I needed to pull out the big guns.

I bought a G-Drive Mini from the Apple Store in Pasadena. Normally, I'd order via Amazon, but I was in a hurry and was willing to pay the retail price. It's a 500 GB, FireWire 800, bus-powered 2.5" drive, running at 7200 RPM. I ran the OS X Mountain Lion installer from the App Store and create a new copy of the OS on the external drive. I then booted from that and installed VirtualBox 4.2.12. I started up iShowU HD Pro from the external drive so I record the following steps.

First, I located the device name of the internal drive by running diskutil list, which lists the devices and the partiions and slices. In my case, the drive I needed to fix was at /dev/disk0.

As I read on a blog post while doing some research, it's necessary to change ownership of the device so the VM can read from it when it starts up:

sudo chown administrator /dev/disk0

That ownership change isn't permanent -- on the next reboot, it will be owned by root again.

I created a VirtualBox virtual machine for DOS. I disabled audio, network, and USB, althought that's probably not necessary. I connected my copy of the SpinRite ISO image to a virtual CD/DVD device. I started up that VM, just to see if SpinRite would boot; yup, no problems so far, however it doesn't have access to the hard drive. For that, it's necessary to create a raw disk descriptor file:

/Applications/ internalcommands createrawvmdk -filename /Users/administrator/VirtualBox\ VMs/SpinRite/raw-disk0.vmdk -rawdisk /dev/disk0

I then added the raw disk to the VM, but encountered a problem because the volume was currently mounted. I remember unmounting the volume shortly after booting, but I did it again so I could configure the VM. Then, as I was about to start it up, I got the same VERR_RESOURCE_BUSY error because something in the background kept mounting the volume. Maybe it was Spotlight or one of the utilities I use like Alfred. So, I unmounted it and quickly started up the VM. It booted normally and I was able to run SpinRite as usual. Because I was running it on the laptop's SATA interface, instead of trying to repair an external drive, it ran pretty quickly. I believe that iStat Menus showed the read rate of 45 Mb/sec. It only took a few hours to finish. It didn't find any troubled sectors, which is not uncommon if the brains on the drive repairs a problem that SpinRite has exposed. I booted up, but there was still some filesystem issues. Blargh.

To finally fix the problem, I took a full backup using SuperDuper! and restored back to the internal drive after wiping it clean. Bingo. Everything is running as it should now.

Checking Apple Repair Status

My iMac is in the shop. Again. This time it's getting a replacement hard disk. It's been almost 6 days since I dropped it off. I got tired of refreshing the Apple Repair Status page, so I wrote a script to do it:

RDU= RID=R0000000 SN=Q0000000000 curl -s -d "repair_id=$RID&serial_number=$SN" $RDU | \ perl -0777 -ne 'm/Status:<\/dt>\s+<dd>([^<]+)/ && print $1' | \ say -v Alex

I saved that as a shell script and have run it every minute:

watch -n 60

I get an audible source of frustration automatically. Yay.

External SATA Drive Dock

I recently purchased a Vantec NexStar eSATA/USB dock for 3.5" and 2.5" drives. It's connected to Mac Pro with a PCI Express SATA II adapter with two eSATA ports and a 6' eSATA cable. The drive dock comes with USB and eSATA cables, but they're only 3' long — that's not long enough. I used the USB connector on the dock before the eSATA card was installed. It works as expected, but the performance of the external SATA is worth the effort to install the card.

The Mac Pro Quad-Core Intel Xeon 2.8 GHz (early 2008) has 4 PCI slots (two 16x and two 4x). The eSATA card must be installed in one of the 4x slots. I understand that the Mac Pro has two available SATA ports, but I didn't research the connector kits to expose those to external drives. The card I received was manufactured by Best Connectivity and uses a Silicon Image SiI3132 controller chip. A driver CD is included, however my SOP is to download the current version. In this case, the drivers are provided directly by the Silicon Image support page. Before purchasing the card, I did a bit of Googling to make sure it worked with Mac OS X 10.5. The results weren't totally convincing, but I decided to give it a try. The driver installs a kernel driver clearly marked:

nikki:Desktop joseph$ kextstat | grep -i sil 53 0 0x86782000 0x14000 0x13000 com.SiliconImage.driver.Si3132 (1.1.9) <52 17 12>

The adapter card and dock are working well now. The transfer speed is very good, and it's really convenient to swap drives so easily. Of course, the drive gets warm without active cooling, but it's only meant for temporary use. I need a solution for indexing drives to make locating files contained on offline drives easier.

1Password Menu Items

1Password Menu

I really like 1Password for keeping all my account information safe and organized. Unfortunately, when I have more than one password or identity applicable to the current website, it's hard to tell which menu item is the one I want. Sure, I could just rename my identity to "Joseph Lamoree - Identity" but that seems like polluting my data for the sake of the user interface. It would be ideal if the 1Password menu had some visual indication about what type of object each menu item represents. I hacked together a screenshot to illustrate. I don't know if putting icons at the full left margin conforms to Apple guidelines, but having it indented would -- see Safari's History menu. Maybe this problem is solved in the 1Password 3 product.

MacBook Mini DisplayPort to HDMI Display

Mini Display Port to HDMI Adapter

I assumed that my MacBook (MB467LL/A) had a Mini-DVI display connector; it doesn't. I went down to the Apple store to buy the appropriate cable; they don't sell one. However, they did refer me to, who makes a Mini Display Port to HDMI Adapter for less than ten bucks. I ordered the adapter, and a 6' HDMI cable. The cable was high quality; gold plated connectors and ferrite cores on both ends. It was less than four bucks, and works perfectly. I don't know how retail stores can sell a Super Deluxe Mondo Blaster cable for $60+ with a straight face. The adapter and cable display on a big HDTV beyond the native display resolution of the 13.3" LCD. Of course, it's not my giant HDTV -- I bring my laptop to movie night.

MacBook Pro Hard Drive Repair

The hard drive in a friend's MacBook Pro (MacBookPro1,2) was causing I/O errors in the console log for the disk0s02 device. I suggested connecting the 120 Gb SATA 2.5" drive to a PC on my bench and running SpinRite to correct the issues, if possible. The SATA data and power connectors are the same on the laptop-sized drives as the 3.5" desktop form, so no adapter is needed as was the case for the old 2.5" IDE drives. Getting the drive out of the laptop is fairly involved. Other World Computing has a great instructional video that exactly matched this particular MacBook Pro.

SpinRite ran for about 12 hours, and found some sectors with unrecoverable data. The SMART data shows that the drive is doing error correction like crazy to preserve the data integrity. When the drive hit the bad portion of the disk, it would just stall and block all I/O, so hopefully SpinRite remapped those sectors.

SpinRite Config

SpinRite Working

SpinRite Summary

SpinRite Error Sector

SpinRite Error Counts

This laptop hadn't been burning DVDs successfully prior to this hard drive repair. After putting it back together, I tried a burn; it worked perfectly. I'm thinking that the drive halted on the bad portion of the media until the burn had a buffer underrun. It's working well now, but I think the best course of action would be to juice it up with a new Seagate Momentus (7200 RPM, 500 Gb, 16 Mb) drive.

Workstation Satisfaction

My current workstation is a Mac Pro (2 x 2.8 GHz Quad-Core Intel Xeon, 10 Gb 800 MHz DDR2-FB) with dual 22" displays. Until recently, I had been using the single SATA drive that came with the machine. I don't trust any system that doesn't redundant storage of some sort. Finally last weekend I corrected the situation by adding three 250 Gb SATA drives. Incidentally, it takes about 45 seconds to add a drive to the Mac Pro chassis -- what a beautiful machine. I moved the stock 320 Gb drive the last drive bay. With SoftRAID, I created a RAID-1 mirror plus a spare. I moved the data from the original drive to the new mirror with SuperDuper!. I reinitialized the old drive, and turned it into a Time Machine volume. It would have been cool to create a RAID-5 device, but SoftRAID 3.x doesn't support that. My system has all sorts of CPU power to waste on a software stripe. Then again, a mirror is dead simple. I would use a different set of spindles for scratch space in Final Cut, obviously.

I still need to figure out a better solution for preventing all my virtual machine images from filling up the Time Machine archives. The virtual disks are split into 2 Gb pieces, so hopefully the timestamps aren't all changed when running; that's probably wishful thinking. Maybe I should exclude the VMs from Time Machine, and use a periodic copy of the important ones to another location.