xamp
(11,313 views)

iMac disk died

Replaced hard disk, reinstalled everything, restored data, installed better backup solution, went fairly smoothly.

Preface - Narrative

I'm probably the only person in the Rails development world who uses a desktop iMac instead of a macbook. Whatever. That didn't stop me from thinking i'm mobile, so I lugged my box to Maine for the weekend for RailsCamp.

The night before, I did a backup, a prudent thing to do before going on the road.

I do backups regularly but manually, and not thoroughly. Basically I'd copy important data to another PC on the home network. That worked out pretty well for those files, but unless I missed some things (which I did), they'd be lost. (My ReviewRamp project source is backed up daily (at least) offsite to a git host - Unfuddle.com). Also I didn't have backups of my apps and other stuff i've downloaded and installed over the years. Three (3) years, that's alot of stuff.

Upon arriving i hung out a bit with the guys and then went to fire up my iMac... oh no! i get a white screen, with flashing folder icon and question mark. It wont boot, couldn't find my OS. I've seen this before, it requires booting off the OSX install disk and running Disk Utility / FirstAid. Of the 30 people there, no one had an install disk. We tried booting from a laptop using a firewire cable; also tried mounting my mac as a remote disk onto a laptop. Nothing. Acted as if the hard drive didn't exist.

So I hung out into the night and drank a few more beers. The next morning I packed up and went home (2 hr drive) to fix it and planned to go back to camp later in the afternoon. No such luck.

Got home. Popped in my OSX install disk. Ran Disk Utility. The hard drive wasn't listed. Futzed around some more. Tried some command line commands. Googled for help. Realized the drive hardware actually is listed, as 0 bytes and strange identifier. Googled some more. Everything pointed to a hardware problem on the drive, a blown chip or something.

My wife found a YouTube video showing how to open the iMac and replace the hard drive. Remove the case, it looks like an old TV Dinner inside. Peel away the foil, remove the flat screen, voila there's the disk. Remove the disk (and peel off the heat sensor, which is glued on with rubber cement).

Brought the disk into Staples. Amazing! They had the exact model, Western Digital SATA drive, with twice the capacity (500MB). Also bought an external backup drive. So, I put in the new hard drive, re-assembled the mac pretty reasonably (but why was the last screw a few millimeters longer than it should have been??!). The machine boots. Go into Disk Utility. It's there. I partition and format the new drive so now it's ready.

One more issue. My internet connection is via satellite (HughesNet), which limits us to 500MB downloads over any 24 hour period. If we exceed the limit, access is virtually shut down for the next 24 hours (slower than dialup). Bastards. Except between 2am and 7am. Looks like I'll be up all night doing downloads.

Reinstall

Pop in the OSX Install disk and reboot. Go through the install. That takes an hour. I take a nap, and get up at 2am. Connected to the internet, I begin downloading updates to OSX 10.4 ("Tiger"). About 2GB of updates were downloaded between 2am and 6am.

Geez, maybe I should have picked up a copy of Leopard (10.5) while at the store, but I didn't. I hadn't upgraded from Tiger to Leopard yet, and the next version, Snow Leopard, is due in September so I figured I'll just wait. 

Also install the Xcode tools from the OSX disks.

Mail. Setup my various email accounts. Copied my mail folders from the backups (more about this later) into ~/Library/Mail/. Seems to work.

Open Office. I'm still using OO, should probably to switch to CocoaOffice but first priority is to get things as they were.

MacPorts. Install macport, the download utility to install other stuff.

    http://trac.macports.org/wiki/InstallingMacPorts
    http://svn.macports.org/repository/macports/downloads/MacPorts-1.7.1/
        click MacPorts-1.7.1-10.4-Tiger.dmg

$ sudo port selfupdate

            to test it runs; should already be up to date

Ruby GEMS. Install ruby gems package utility

$ sudo port install rb-rubygems
 

THE REST OF THIS POST is basically a laundry list of stuff on my system. It's here mostly for my own documentation, probably isn't too interesting to anyone else.

MySQL setup

ref: http://www.buildingwebapps.com/articles/6455-setting-up-rails-on-tiger-mac
ref: http://2tbsp.com/content/install_and_configure_mysql_5_macports

$ sudo port install mysql5
$ sudo port install mysql5-server
$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
$ sudo -u mysql mysql_install_db5
$ sudo cp /opt/local/share/mysql5/mysql/my-medium.cnf /opt/local/etc/mysql5/my.cnf
        edit my.cnf, adding per article
            socket          = /tmp/mysql.sock

add to ~/.profile
    alias mysqlstart='sudo /opt/local/bin/mysqld_safe5 &'
    alias mysqlstop='/opt/local/bin/mysqladmin5 -u root -p shutdown'
$ mysqlstart
$ /opt/local/lib/mysql5/bin/mysqladmin -u root password 'secret'
$ /opt/local/lib/mysql5/bin/mysqladmin -u root -h jsl.local password 'secret'

confirm its running with
        $ mysql5 -p -u root
 

Php5 Setup

$ sudo port install php5
    $ sudo cp /opt/local/etc/php5/php.ini-development /opt/local/etc/php5/php.ini
       
    Edit your php.ini file located at /opt/local/etc/php5/php.ini
        mysql.default_socket = /tmp/mysql.sock
 

Apache2 Setup

$ sudo port install apache2

$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

edit /opt/local/apache2/conf/httpd.conf
        my email


        # http://localhost/  sees ~/Sites/index.html
        document root - /Users/jonathan/Sites
       
        uncomment
        Include conf/extra/httpd-autoindex.conf (Fancy directory listing)
        Include conf/extra/httpd-default.conf (Some default settings)

        add
        Include conf/extras-conf/*.conf (contains mod_php.conf)
       
        add index.php to
        DirectoryIndex index.html, index.php


    $ cd /opt/local/apache2/modules
    $ sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
 

    $ sudo killall -9 httpd
    $ sudo /opt/local/apache2/bin/apachectl stop
    $ sudo /opt/local/apache2/bin/apachectl start
       
    adding this to .profile
        alias apache='sudo /opt/local/apache2/bin/apachectl'
   
        $ apache stop
        $ apache start
    Will launch apache2 at startup, see /Library/LaunchDaemons/org.macports.apache2.plist
   

But its not connection to Preferences Sharing pane, so turn/keep that off (Apache 1). (How to fix this?)

   
    create phpinfo.php
        <?php phpinfo(); ?>
   
    http://localhost/phpinfo.php
 

Rails setup

$ sudo gem install rails

$ sudo gem install sqlite3-ruby

$ sudo gem install mongrel --include-dependencies

 

Other Ports:

git-core +doc

rb-termios

ImageMagick

ghostscript

 

Other Gems:

capistrano

mysql -- --with-mysql-config=/opt/local/bin/mysql_config5

ruby-debug

hpricot

spork

nokogiri -v 1.3.1

rspec

rspec-rails

tzinfo

cucumber webrat

jscruggs-metric_fu

term-ansicolor

treetop

diff-lcs

ruby2ruby

fastercsv

cheat

chardet

tidy

RedCloth

mislav-will_paginate

 

click to download http://html5lib.googlecode.com/files/html5-0.10.0.gem
$ sudo gem install /Users/jonathanlinowes/downloads/html5-0.10.0.gem

Other apps:

CocoaMySql   http://www.sequelpro.com/release-archive.html

Path Finder

iGetter

Fireworks

Stuffit Expander

Menu Meters http://ragingmenace.com/software/menumeters/

Cronnix (gui for cron)

Netzero software (for emergency dialup access)

 

Fubar Mail

The only real hassle is the problem i'm having restoring my old emails. The .emlx files are there but when I go into Mail and click on an message I see  something like:

"The message from foo@bar.com concerning “Welcome!” has not been downloaded from the server. You need to take this account online in order to download it."

This is only some folders (including all the Inbox account folders) but certainly not all folders are bashed. Running "rebuild" and the messages completely disappear from the list. 

From the command line I try to copy the .emlx files into a mailbox by hand, and then rebuild. That seem to work. Until i reboot, then problem recurrs. I'm still looking into this.

Backups

For a sane backup solution I bought a Western Digital "My Book" external drive. Connected via Firewire. Installed the enclosed mac software.

DONT DO IT. "My Backup Anywhere" (aka Memeo) is supposed to be like Apple's Time Machine, automatically backing up files as you save them, never having to do an actual backup again, so I gave it a try. Well, I started the initial backup and after 15 hours it was still copying files!! And even so, it only looks at my personal files, not system files or installed apps. (my user directory on this new install is only 2.5gig).

Decided to use Carbon Copy Clone. Downloaded a copy (it's donation-ware). Re-partitioned the WD drive for the mac file system, ran a full system backup -- 25 GB including all OSX, apps, gems, etc took less than an hour.

Now it's setup to run an incremental backup once a night. And the file system on the external drive is standard (no software needed to restore files) I can browse it with Finder or command line.

OK, only a couple days lost, days i hoped to be spending learning, teaching, and goofing off at RailsCamp. Now i've got to get back to work...

 

 

Comments

by Gene Martin on Jan 22, 2010

>>

Interest blog. I'm curious why you didn't use Time Machine with the WD "My Book"? I've read some posts that indicate the iMac sleep mode doesn't agree with the WD drive.

by admin on Jan 25, 2010

>>

Hi, I'm using Time Machine now, since I upgraded to Snow Leopard.

New Comment

markdown formatting permitted