After the hard drive problems I mentioned in a previous blog entry, my new hard drive arrived, and today I actually had time to install it.
I partitioned the new drive like the old drive, but with bigger partitions (because this was a 160Gb drive instead of an 80Gb drive). Being old-fashioned, I used fdisk instead of whatever the young kids use (parted?). Then I booted with a rescue CD and did the following to mount and copy all the partitions:
for i in 1 2 3 5 6 8 9; do
mke2fs -j /dev/hdb$i
mkdir /mnt/hda$i /mnt/hdb$i
mount -t ext3 /dev/hda$i /mnt/hda$i
mount -t ext3 /dev/hdb$i /mnt/hdb$i
rsync rsync -aSuvrx –delete /mnt/hda$i /mnt/hdb$i
done
Then with everything copied over and swapped around the drives and attempted to boot with the new one.
Ok, how many people spotted my deliberate mistakes?
First off, I forgot to install grub on the hard disk. So I had to boot back with the original drive as hda and the new drive as hdb. I couldn’t get grub-install to even recognize /dev/hdb or hd1. So I went into the raw and wolly grub shell to do it.
Second mistake was that I forgot my /etc/fstab uses labels. So I had to quickly google how to put labels on the partitions using e2label. But I couldn’t figure out how to label a swap partition, so I changed the swap entry in /etc/fstab to not use labels. Not sure why I didn’t just convert them all to not use labels, but I’m trying to be a little more modern.
Third mistake was that somehow /tmp ended up not globally writable. I think all the other files and directories had the right permissions, so I’m not sure why that one was different. Probably because it’s the only partition whose top level is globally writable.
Everything seems to be working now, so my fingers are crossed.