22/10/2008

Linux Swiss Army Knives for exchanging hard drives

One of the very basic problems: you have to exchange a harddrive, either because it is about to fail or it has simply become too small for the job, but of course you don't want to reinstall all your OS's and data. Here are some tools which might help you rescuing your cherished Windows, Linux and all your settings.

  1. Have a computer with a CD-ROM drive and enough RAM ready.
  2. (Can't say it often enough) BACKUP ALL YOUR IMPORTANT DATA!
  3. Download a live-cd of Gparted.
  4. Get a Live-CD of your favourite flavour just in case you need to work with a console . I like to use Xubuntu, because the desktop environment is saving resources and I need the shell most of all anyway.
  5. Get the CD version of Super-Grub.
  6. Set the drive jumpers (master/slave) accordingly to the setup in your machine.
    If you use P-ATA 2.5'' drives, get a 3.5'' to 2.5'' adapter for each of them to be able to connect it to the normal IDE bus.
Now start your computer with the GParted live CD. The process of copying and enlarging partitions is self-explaining within the graphical interface of GParted.

In my case, the Windows system partition as well as the ntfs data partition and the linux ext3 home partition were copied almost perfectly; however, the Linux system partition was entirely corrupted. I restored it via dd, see this post about dd, this post about mounting images and this post about mounting network shares

Now you have a nice and resized copy of your OS's on the new hard drive. Plug it into your destination computer. BUT: booting will still be a problem, since you never copied the Master Boot Record (and be very careful about fiddling with the MBR, you might kill all your data)

Here the SuperGrub disk kicks in: just boot from it and choose super-grub. The disk will rewrite an appropriate boot sector code and will enable you to boot at least one of your OS's. BTW: it can also restore a Windows XP MBR, if you just happen to have only this OS...

No comments: