Hard drive died… no problem!

I came back from Winter Break to a bunch of updates for squeeze, one of which was my kernel. So I update, and then I hear a bunch of clicks. Cue the “Oh shit no. Fuck no. Fuck fuck fuck.” moment. Pop over to /var/log/messages and yes, a shitton of errors from the SATA controller for /dev/sda, which is my 3 year old Velociraptor drive.

Thankfully, /dev/sda contains only my Windows partition and my /boot partition. Since I only use Windows for gaming and watching TV (Windows Media Center blows away everything in terms of ease of use), this isn’t that big of an issue. As long as I don’t reboot, I don’t need /boot. My computer can continue running with the broken drive and did while I was away for four weeks. Here’s how I transferred to a new boot drive.

Plug a new drive in via USB. I have a SATA to USB dongle.

Unmount /boot.

Partition the new drive and mount it in /boot

Reinstall the linux-image packages.

Reinstall grub to the new drive.

Reboot and replace the dead drive.

There should be a way to do this without rebooting, but I didn’t know how to do SATA hotplugging in Linux (I forgot the term so I couldn’t google for it :\) and how my computer would react if I just unplugged a drive from the power supply. (Note to self: rea﻿d this)