RAID 1 to RAID 5

Since the schoolyear started, I have been fighting against a tidal wave of incoming logmessages. People obviously started using the network again.

I decided to replace the current 72GB RAID1 set with a 144GB RAID5 set (using 3 72GB harddisks).

The first thing I noticed was that the kernel was not compiled with RAID5 support, just RAID1. This server is one of those who is still running some hybrid version of an old Debian release overwritten with countless compilations from source, and no documentation about it at all.
In addition, the kernel it was running was 2.4.26 with a bunch of unspecified patches.

I installed a brand new kernel on it, with all RAID-levels supported (standard kernel for all new machines), but the server wouldn't load the networkmodules. I'm guessing this is because modprobe is too old...

So, resorting to a desperate option, I recompiled the kernel from local source, just adding RAID5.

After a few disturbing incidents (the machine crashed when I wiped one of the RAID1 disks, after carefully removing it from the RAID set), I'm back again and about to continue...

The situation is as follows: /dev/sda and /dev/sdc contains the partitions of /, /boot and swap. All in RAID1. /dev/sdb and /dev/sdd both contain 1 partition (sdb1 and sdd1) and form a RAID1 set together. /dev/sde is the new disk.

I started by removing /dev/sdd1 from the RAID set by marking it as faulty and the removing it:

mdadm --manage --set-faulty /dev/md3 /dev/sdd1
mdadm /dev/md3 -r /dev/sdd1

I then started wiping /dev/sdd, but for some reason this crashed the machine. So, moving along...
the idea is to have /dev/sdb, /dev/sdd and /dev/sde in the RAID5 set. But I want to have /dev/sdb running as long as possible. So I will create a degraded RAID5 with /dev/sdd and /dev/sde first, copy the data and then add /dev/sdb later.

I partitioned both /dev/sdd and /dev/sde the same as /dev/sdb.

sfdisk -d /dev/sdb > /tmp/x
cat /tmp/x | sfdisk -f /dev/sdd
cat /tmp/x | sfdisk -f /dev/sde

mdadm --create --verbose /dev/md4 --level=5 --raid-devices=3 missing /dev/sdd1 /dev/sde1