Welcome to the first in a surge of posts about little technical things I’ve been wanting to write about somewhere. I’m posting these for a few reasons: for my own memory, to get the stuff straight in my own head, and in the hope that they’ll be useful to someone else.
First up: my recent experience building and configuring a new home server. I’ve got 6 500GB drives in this box, using RAID5 and LVM. I’m running Ubuntu 7.10, and using Xen just because I can. At first, I had the OS installed on a separate hard drive (outside the array). I didn’t like that, so I changed it.
Here’s the first pitfall (self-created) that I ran into. As I was building this box, I was experimenting with mdadm; I created a test array and played around a bit. (Yes, I’m the sort of person that plays around with RAID arrays.) What came back to bite me later was that I created this array out of the whole disk devices (/dev/sda, /dev/sdb, etc), rather than partitions. When I finally got around to doing a final OS install, this test array kept appearing and overriding any new arrays I tried to set up. I was alternating between worry and anger as newly created partitions disappeared (it seemed random), a big RAID5 array wouldn’t leave me alone, and the Ubuntu installer completely failed to deal with the situation. Long story short(-ish):
mdadm --misc --zero-superblock
run on all the drives killed off the test array and cleared things up. Yay.
Next, getting grub to boot with LVM and a big RAID5 array. The secret (which seemed really obvious once I put it together from bits and pieces found via google) was to add a small RAID1 array to the mix. Basically, create two partitions on each of the drives in the array, make the first 256MB, and then give the rest of the drive to the second. Create a RAID1 array (/dev/md0) out of the 256MB partitions. Set this to be mounted on /boot. Then use the big partitions to make a RAID5 array (/dev/md1). Hand this to LVM as a physical volume. Create a volume group and some logical volumes for the OS and swap, and voila. I left some free space in the volume group for virtual machines, and I’ve got a nice flexible setup. A side benefit of this is that if I install grub on all the drives in the array (or at least the first two) and make them bootable, drive 0 can fail without leaving the whole system unbootable.
Ok, that’s enough of that.
Recent Comments