With the imminent release of Debian Sarge, comes a new installer program, which is much more flexible than that of previous releases. Among many of the new features is support for installation with LVM, installation over an ssh console and even the ability to install over an infra-red link. However with these extra features comes an added layer of complexity, and for the new user, accessing the less commonly used features is not always straightforward.
This article intends to provide a step-by-step guide to installing Debian Sarge with a mirrored-disk configuration. This process can easily be extended to cover any RAID configuration that Debian Linux supports (concatenated disks, RAID5, etc).
Booting
Firstly, you'll need a system with two hard disk drives, and a CDROM drive. It is nicer if the drives are identical, but this isn't essential. The two disk drives should be on separate buses, if using IDE, otherwise the performance will be terrible. The system that I used for this article was a QEMU virtual machine. My hard disks were set to be /dev/hda and /dev/hdd, because QEMU insists that the CDROM must be /dev/hdc.
Once you have operational hardware, boot up the machine, and insert the Debian Sarge Linux installation disk into the CDROM drive. You should see the Debian swirl logo appear and a prompt that says "Press F1 for Help, or ENTER to boot:".
Debian Sarge's default kernel is 2.4.x, which would work fine for the task at hand. I have chosen to use 2.6.x instead, because I needed it for other reasons. We are also going to use 'Expert' mode to install the system, so that we get a wide range of options to choose from. So, to do this, we type 'expert26' and press Enter. Should we have wanted to use kernel 2.4 in Expert installation mode, we only would have needed to enter 'expert'.
Linux will now boot, and then start the installation program, which will present a menu of options, which is quite straightforward. Follow through the initial options "Choose Language", "Choose country or region", "Select a keyboard layout", "Detect and mount CD-ROM".
The next step is to load various installer components from the CDROM. The default Debian installer program only has the ability to install to the most common types of systems. To do anything more complex than this, we must load in modules for the additional functionality.
Select "Load installer components from CD"
Now we will be presented with a list of the optional components that we can choose from. We want to install our system with software RAID, so we should choose the "mdcfg" component. Scroll down to this option and select it by pressing space. Then select "Continue".
Partitioning
Now continue with the next few options, "Detect Network Hardware", "Configure the Network" and "Detect Hardware". These are all fairly straightforward. After completing these steps, select "Partition disks".
You're now running the partitioning program. If you've got existing partitions on the disks that you want to get rid of, it might be helpful to select the "Erase entire disk" options for each of them. Otherwise, select "Manually edit partition table".
The steps that we are going to take here are:
Create identical RAID autodetection partitions on each disk
Create swap space on each disk
Create a mirrored RAID device
Put a filesystem on the RAID device
If we wanted to, we could even make a mirrored raid device of the two partitions that we're going to allocate for swap space. We won't, in this case, because I'm more interested in having a lot of swap space for testing purposes, rather than mirrored swap for reliability, but I would recommend it if you're creating a production system.
So firstly, cursor down to the "FREE SPACE" line for the first hard disk and select it.
Now select "Create a new partition":
The disks that I have set up for my QEMU virtual machine are quite small; only 800Mb. For this reason, I'm putting everything in a single 700Mb partition, and allocating 100Mb for swap. If you're just learning to use the installer, it's probably worth doing the same, and just creating a single partition to install the whole system into, to save time. But if you're making a production system, it would be well worth creating separate filesystems for /, /var, and /home, at the minimum.
So now, enter the amount of space that you wish to create for this first partition.
MSDOS partition tables allow either four primary partitions, or three primary partitions and multiple logical partitions. Plan your system carefully before you commit to this.
I'm only using two partitions per disk, so I've selected them both to be Primary partitions:
Select the partition to appear at the beginning of the free space. The location doesn't really matter, I just create the partitions sequentially from the beginning of the disk until the end.
Now cursor up to the "Use as" setting. The default is "Ext3 journaling file system". Under a single disk system, this may well be what we want, but since we want to mirror our disks, we will have to change this to be a RAID partition.
Select "physical volume for RAID"
This is going to be the partition that we wish to boot from, so make sure that you select the "Bootable flag" option to "on":
So, that is now complete. Now select remaining free space area on the disk and create a new partition, and set it to be swap space. The process for doing this is almost identical to that set out above, except that you should select "swap area" instead of "physical volume for RAID".
If you want to mirror your swap space, just create a second raid partition, instead.
As can be seen in the next screenshot, my first disk has been partitioned, into a large 699Mb RAID partition, and a 98.7Mb swap partition. You should now repeat the process with the free space on the second disk.
The second disk's partition table should be identical to that on the first. If your second disk isn't exactly the same size as the first, try to create partitions of similar size on each, and then leave a bit of space left over on the larger disk.

So now, you have two disks with similar, if not identical, partition tables. In the screenshot below, we can see on my system, they have been laid out identically, one 699Mb RAID partition and one 98.7Mb swap partition on each.
Now cursor up and select the "Configure software RAID" item.
At this point, the program will ask you if you want to write the partition table changes that you made to the disk. This will overwrite whatever partition table your disks previously had, so make sure you consider the ramifications of this before selecting "Yes".
With the new partition table that we created written to the disks, we can now build our mirror. Select "Create MD Device":
We're building a mirrored disk system here, so select "RAID1".
Our mirror has two active partitions (one on each disk), so select '2'
We don't have a spare disk for a failover device, so enter '0' for the number of spare devices.
The installer now wants to know which partitions to use for the mirror. The device names that it gives are a bit strange; it's using devfs, which is a now deprecated Linux subsystem that allows /dev device trees to be build automatically.
Select the two partitions that you want to use for this first mirror, and then select "Continue".
If you're creating more than one set of mirrored partitions, select "Create MD Device" again and repeat this process. Otherwise, select "Finish".
Now we're back at the disk overview, and we can see our new RAID1 device, in addition to the physical partitions. Now we want to put a filesystem onto our raid device and assign it to a point in the filesystem, so cursor down and select the contents of the RAID device:
Select "Use as".
Choose your filesystem type. I have selected Ext3. You may also consider using ReiserFS or XFS. Be aware, however, that if you're planning on using Grub as a boot manager, it might have problems recognising XFS partitions.
We want to make sure that a new filesystem is formatted onto the disk, so make sure that the "Format the partition" option is set to "yes, format it".
Finally, set the mount point for the filesystem. In my case, this is the root partition. Once all that is done, select "Done setting up the partition".
You will now see that your mirrors have a filesystem assigned to them, and that they have mount points. When ready, select "Finish partitioning and write changes to disk".
Now it will confirm that you want to do this. Select "Yes", and it will write the changes to your disks, destroying any data that might have been there beforehand:
We're now back at the main menu. The remainder of the install process is quite straightforward. Select "Install the base system", and it will write all the packages to the disk. As that nears completion, it will ask you which kernel you wish to install. Choose whichever one suits your particular architecture the best. If you're not sure, you probably can't go wrong with the 'i386' version, but this means that you will miss out on certain optimisations if running on a later architecture.
Now install a boot loader. I've chosen Grub. You will have to use LILO if you're using XFS on your root filesystem.
I only have the one OS on this system, so I'm installing Grub to the master boot record:
We're now done! Select "Finish the installation" and answer a couple of simple questions, then the machine will reboot. Be sure to eject the CD before it starts booting again, or you will be put back into the installer.
When the new system boots, you will see that your system is installed on a set of mirrored disks. You can now use 'mdadm' to administer the mirror, if necessary.
If you found this article helpful, consider making a donation to offset the costs of running this server, to one of these addresses: