Posted by ElizabethBevilacqua on Thu 22 Mar 2007 at 09:18
Our team at LinuxForce recently put together a Debian server with LVM on a software RAID5 volume. This has been possible through complex installation procedures in the past, but today the Debian Etch installer is capable of handling such an installation if you follow the proper steps, which I outline in this article.
Among other things, we needed the flexibility to write partition tables for Xen on the fly, dependability that would allow a generous replacement window when harddrives failed, and as little possibility of data loss and downtime through harddrive failure as possible.
1. Our partition table will be as follows:
2. Our system has four drives (for RAID: three active drives, one hot spare)
3. The harddrives are SATA or SCSI, if you're using IDE drives keep in mind that all the sda1 references (for example) will be hda1.
4. Since this article is being written so close to the release of Etch as stable, there shouldn't be too many changes to these directions before release, but for reference we are using the Debian Etch RC1 installer on a netinst daily image downloaded March 13, 2007.
The first challenge was developing a partitioning scheme that would boot. lilo and grub cannot boot from RAID5 so an additional partition separate from the RAID5 had to be created for this purpose. There are many creative ways of doing this, but our solution was to create a 1 gig RAID1 root partition. Alternatively we could have created a smaller /boot partition.
Another consideration is where to put the swap partition. There is an argument for putting swap on it's own partition outside of the lvm (for speed, mostly). We made the decision to simply keep it on LVM for ease of administration.
Make sure any hardware Raid is turned off in the BIOS, we want all disks to appear separately in the partitioning table.
Start the Debian Etch netinst as with a normal install.
At the Partition Disks menu choose Partitioning method: Manual
Delete any existing partitions so only "FREE SPACE" is listed.
Select the first drive and do the following:
This will create your RAID1 bootable section.
This will create your RAID5.
Partition the remaining three disks in the same way.
Now each partition on the drives will show up as partitioned as "K Raid"
There is now an option to Configure Software Raid on your partitioning screen - select this.
At the next screen say "Yes" to write the changes to the storage devices and configure RAID.
Choose: Create MD device
Now you will want to choose Create MD device again.
You will be sent back to the partitioning screen.
Select the partition on your newly created Raid1 volume, it will say: "Use as: do not use" - select this line, hit enter and make it an ext3 / (root) partition
Done setting up this partition
Select the partition on your newly created RAID5 volume, it will say: "Use as: do not use" - select this line, hit enter and make it a "physical volume for LVM"
Done setting up the partition
Once this is completed the RAID5 volume will show up as partitioned as "K LVM"
There is now an option to Configure the Logical Volume Manager on your partitioning screen - select this.
At the next screen say "Yes" to write the changes to the storage devices and configure LVM.
In the LVM Configuration screen you will first need to Create Volume Group:
Now Create Logical Volumes:
Once you are finished and arrive back at the LVM configuration screen choose Finish
Back at the partitioning screen you will see all the logical volumes in the partition table.
Partition each of these as you normally would (when you go into each parition it will say: it will say: "Use as: do not use" - select this line, hit enter to change), LV servername_var will be the entire /var partition, etc.
When partitioning is complete: Finish partitioning and write changes to disk.
Continue Debian installation as with a normal install.
When you get to the step where you need to install grub/lilo you want to install it on your RAID1 partition, md0. The Debian installer should figure this out on its own and you can agree to the default, but keep this in mind if any problems arise when you complete the installation and reboot the machine.
To make sure LVM doesn't get "confused" by the separate disks versus the RAID volume, we tell lvm only to start on the md1 block device:
Edit /etc/lvm/lvm.conf: Change the filter line to: filter = [ "a|/dev/md1|", "r/.*/" ]
(and make sure you only have one filter line)
We leave this as an optional step because you may have other reasons for looking for other block devices.
Written by: Elizabeth Bevilacqua, System Administrator at LinuxForceAcknowledgements:
Stephen Gran, System Administrator at LinuxForce
CJ Fearnley, President of LinuxForce