[ILUG] harddisk swap
cian at medialabeurope.org
Fri Apr 30 19:17:26 IST 2004
Well the swap is done and dusted now, thanks for everyone who replied. I feel
like I've learned a lot from this whole experience, especially (as usual)
from all the mistakes/problems I had along the way.
Just to wrap things up, here's what I ended up doing:
1) Booted into rescue mode from a Fedora CD.
2) Partitioned new drive (/dev/sda) with fdisk
3) Ran mkfs.ext3 on all partitions except swap, ran mkswap on that.
4) Mounted old /dev/hda read-only and copied the partitions over one-by-one
using cp. Got a couple of errors from /var/ and /dev, but nothing serious.
5) chroot'd to new disk
6) Ran "grub-install /dev/sda" 
6) Recompiled kernel to include SCSI in the kernel, NOT as a module
7) Edited /etc/grub.conf and /etc/fstab
8) Rebooted to a new system
The things that caused me the most trouble were the fact that I was going from
an IDE disk-> SCSI, and that I wanted to use a different partition table on
the new disk, instead of the monolithic partition I had on the old one.
Anyway, cheers again to everyone,
 This is an extremely cleaned up version of what happened. In reality there
was much more scratching of the head, reading docs, rebooting and swearing.
 Thanks to Paul Kelly for this, chroot was the perfect solution.
 I tried the old "dd if=/dev/hda of=/dev/sda bs=512 count=1" and failed.
HOWEVER I'm now pretty sure it was my fault. I decided to use a bs=446 after
half-reading some documentation. Apparently 446 is the length of the boot
code, 64 is the length of partition table, and finally there's a boot code
signature 2 bytes long. At the time I didn't know about the signature bytes
and thought I could save my partition table by just dd'ing the first 446
bytes, this didn't work for me.
 Funny, I thought I could get away with leaving the kernel as it was, and
just rebuilding the initrd image with mkinitrd to include the SCSI modules,
but I couldn't get it to work, kept getting "pivot_root" errors, until I just
said feck it and compiled the necessary modules straight into the kernel.
More information about the ILUG