One of the first things I did when I got my new MacBook Pro was replace the hard drive with a larger, faster drive. I ended up with a Seagate 7200.4 500 GB (ST9500420AS). I hadn't had any problems with it, and it got hit pretty hard throughout the course of a week. I partitioned it as ~427 GB for Mac OS X and ~72 GB for Windows 7 Pro. The Windows 7 install is primarily for gaming, with some Windows 7 cross platform testing thrown in.
Recently, I had imaged a customer's drive to a disk image on my Mac partition, which seemed to go fine. Unfortunately, when I tried to move this image to an external drive for cold storage, it would fail with an input/output error. I figured the most likely cause was a bad block, but that didn't help me move that image. I ended up deleting it, since I had a separate copy of their data (I like redundancy). I left it at that for a while, since the drive's SMART status was still OK.
Then I had another input/output error when trying to back up a Windows XP VMWare image. I installed the smartmontools using Homebrew, and checked the SMART status again, as well as doing a hard drive self test. The SMART status was still ok, though it was listing 88 bad blocks, which is supposedly over the threshold of 36. I'm not sure why that's considered OK. The self test failed, however. So I ordered a new 500 GB Western Digital Scorpio Black (WD5000BPKT). Now the question was, how do I move all my data over?
I could have just reinstalled and pulled my files from Time Machine for the Mac OS side, but that takes forever. It would also mean that I would definitely not be able to recover my XP VMWare image, since I don't back it up in Time Machine. Plus, I wanted to preserve my Windows 7 Bootcamp partition.
I read a bunch of tutorials online, and there isn't really a nice simple way to do all of this. The two main camps were the SuperDuper! or Carbon Copy Cloner plus Winclone people and the 'dd' people. Both have their pluses and minuses – the GUI utilities are arguably easier to understand, the 'dd' method is (in theory) a one step process. Also, Winclone is unsupported at this point, as the company that made it no longer exists. You might still be able to find a copy, but I wasn't sure I wanted to trust it. Also, I have used 'dd' before a few times, so I figured I'd give it a shot.
I put the new drive in a Firewire case, hooked it up, booted off of a USB Techtool Pro rescue disk, and ran the following command:
sudo dd bs=4096 conv=noerror if=/dev/disk0 of=/dev/disk2
To break that command down:
- sudo – do this command as administrator
- dd – the actual command being run
- bs=4096 – read and write 4096 B at a time (4 KB)
- conv=noerror – if there is an error reading, continue processing
- if=/dev/disk0 – read data from disk0, which in my case is the internal drive (you can find out these names in Disk Utility if you don't know what they are on your machine)
- of=/dev/disk2 – write the data to disk2, which in my case is the new drive in the Firewire case
I let it go until it finished (2.5 or 3 hours or so), which seemed successful. Unfortunately, when I tried to boot off of it, it would crash at the boot screen. I could see the files in Mac OS, but at least some of them were corrupted. In retrospect, this method may have worked had I specified conv=noerror,sync as this should pad any areas where there was a read error with nothing, instead of skipping to the next block. I haven't tested this, though.
I really just wanted to get back up and running and not be on a potentially failing drive as quickly as possible, so I used Carbon Copy Cloner to copy over my Mac OS X install to the new drive, so that I could at least get work done. I installed the new drive internally after I verified that it booted, put the old drive in the Firewire case, and was off and running Mac OS-wise. My XP VMWare image was lost, as a couple of parts of the virtual hard drive were corrupted, but I have an older Parallels one that I can convert. Luckily those were the only corrupted files.
I still really didn't want to have to reinstall everything in Windows, though. So I started up the Boot Camp Assistant, repartitioned the drive the same way I had the old one, and used Disk Utility to copy the data from the old BOOTCAMP drive to the new one. I tried rebooting, and it didn't show up in the boot menu, so I popped in the Windows 7 DVD and went into the repair area. It didn't see my Windows install. I somehow managed to get to the screen of repair choices by using one of the options on the initial repair screen and then canceling, and went into the command line. I tried the bootrec command with /scanos, and it didn't see my Windows install. I tried /fixmbr and /fixboot, which did make my drive show up as bootable, but it still wouldn't boot, and /scanos still wouldn't see the Windows install.
So I tried another tactic. I booted back into Mac OS, deleted the bootcamp partiton, recreated it, and did a new install of Windows. Once Windows was installed and running, I booted back into Mac OS, unmounted the new and old BOOTCAMP partitions, and ran the following command:
sudo dd bs=4096 if=/dev/disk2s3 of=/dev/disk0s3
This copied the Windows 7 install from the old partition in the Firewire drive to the new one on the internal drive. When I rebooted, it stated to boot but then errored out. I booted up the Windows 7 DVD again and ran the repair, which did see it as a Windows install this time, and proceeded to fix it automatically.
I booted back into it, and it worked perfectly. It didn't ask to re-activate or anything!
So I am finally back to where I started, without having to reinstall and re-activate and re-download everything. It was a bit of work, but worth it overall. I would like to try the 'dd' method again with the 'sync' option to see if that was my point of failure, but I don't have another drive laying around.