I had:
- a 75gb disk, completely filled with music,
- an 80gb disk, with OS/personal stuff, and an old copy of the music, with some additions not on the 75gb disk.
First, I bought a new 80gb disk so I could have three. Then, the strategy is basically to get the data on one disk, build the RAID across the other two disks, copy the data onto the RAID and insert the data disk into the RAID. It’s complicated by the fact that I had my OS and data in one huge partition on the existing disk, so I had to do some OS bootstrapping first.
So:
- bootstrap Debian onto a 5gb partition on the new disk
- merge all of the existing data from the other disks onto the old OS disk, copying the leftovers onto my scratch 20gb disk (I bought it when 20gb was a lot!)
- unplug the old OS disk so there’s no possibility of me mistyping a command and wiping out my data
- establish a three-disk raid across the two older disks with one disk marked missing, and verify it’s working:
Number Major Minor RaidDevice State 0 3 2 0 active sync /dev/hda2 1 33 1 1 active sync /dev/hde1 2 0 0 -1 removed
- put the data disks back in, copy all the data to the RAID
- and finally, repartition the source disk, insert it as the missing third disk into the RAID, and watch it rebuild:
martine@bunny:~$ cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid5] [multipath] md0 : active raid5 hdg2[3] hde1[1] hda2[0] 150127232 blocks level 5, 64k chunk, algorithm 2 [3/2] [UU_] [=====>...............] recovery = 26.2% (19668352/75063616) finish=47.9min speed=19253K/sec
This whole thing is scary because a wrong command (or a RAID autodetect-and-rebuild somewhere that I didn’t anticipate) could have wiped everything out. But I was careful, and it worked.
Here’s my secret tip:
raidtools (debian package raidtools2, and is the name of the collection of utilities including mkraid, raidstart, and raidstop) sucks, even though they’re what all the RAID docs talk about.
Use mdadm instead. mkraid refused to create my RAID 5 because I was missing a disk, even though I told it the disk was gone in the configuration file; mdadm works through a straightforward command-line interface and was pretty much intuitive.
I’m a little worried about performance. I didn’t do any benchmarking to see what the appropriate chunk size on the RAID / block size in the file system were. But since it’s mostly used for archiving music, it only needs to be able to push about 16kb/sec, which it does easily; otherwise, it looks like it does something like 20mb/sec, which isn’t too bad, I guess?