Installation:Software Raid

From Lunar Linux
Jump to: navigation, search

Contents


Software raid is a relatively powerful way of achieving better performance and/or reliability (redundancy). There is no automated way of setting this up in lunar yet but it's fairly easy to do manually.

Getting started

First setup your box with the number of hard disks you need and boot the ISO. As soon as you boot into the installer and have selected language and locale stuff, switch to vc/2 and start with the manual part of the software raid setup

Partitioning

The easiest way to setup partitioning if you're working with partition raid-components is to partition one disc and copy the contents to another using cfdisk and sfdisk:

cfdisk /dev/hda

Setup your partitions and make sure you have some space left over for later to resize and move stuff if needed. Make sure you set your partition type as linux-raid-autodetect (0xfd). Otherwise you won't be able to boot from the partitions.

cd /tmp
sfdisk -d /dev/hda > dump
sfdisk -i /dev/hdb < dump

This formats the second disc identically to the first one, especially usefull for RAID-1 setups

Setting up your RAID devices

go to /tmp and create a new raidtab file:

raiddev         /dev/md0
raid-level      1
nr-raid-disks   2
nr-spare-disks  0
persistent-superblock 1
chunk-size      32
device          /dev/hda1
raid-disk       0
device          /dev/hdb1
raid-disk       1

Now, since this is sitting on tmpfs you will lose your data if you reboot so be careful. The next step is to initiate the raid device so that it's actively mirroring them (or striping depending on your setup).

mkraid --really-force --configfile /tmp/raidtab /dev/md0

The raid driver will start syncing the discs and you can check progress with:

cat /proc/mdstat

Formatting the filesystem

From now on, you'll refer to your disks as /dev/md0 instead of hda1 etc. So the same goes with formatting. You can format and work with the disks even when syncing is in progress:

mkfs.ext3 /dev/md0

It might be a bit slower due to the syncing going on. I advice you to have the unit finish syncing before you reboot, if only to make sure there's no bad sectors on the units and all is OK for normal work.

Saving your config raidtab

You should of course save your raidtab file and most likely you will want to save it as /etc/raidtab on the raid-device itself. You'll need to mount it therefore:

mount /dev/hda1 /mnt
mkdir /mnt/etc
cp /tmp/raidtab /mnt/etc/raidtab
umount /mnt

Now you're ready to install lunar in the normal way!

Installing on RAID

The last step is to let the normal installer code handle the partitions. For this reason, the installer allows you to pass an arbitrary block device name as an additional hard disk partition. In the partition selection, you select 'Add...' device and enter '/dev/md0'. Make sure you don't format the partition and select the right filesystem. Alternatively, you could have skipped to formatting and let the lunar ISO installer handle it as well.

BootLoader

As maybe known, only lilo can directly boot from software raid but with tricks grub can read the underlaying partition on only one of the raid devices, which will obviously not work with striping raid setups. Make sure you pass the proper device names to the lilo.conf. Your mileage may vary.

Referring to the Lunar ISO 1.5.1: to have LILO boot from the software raid, all you have to do is make sure that /etc/lilo.conf has the following lines for boot and root:

 boot = /dev/hda   # the fysical drive to boot from
 root = /dev/md2   # the raid-partition that your root-resides on


Note by El_Angelo: This part is really very confusing. Just to clarify : the iso will write a lilo.conf that is not correct. what it will write:

 boot = /dev/md0
 root = /dev/md2

while it should be:

 boot = /dev/hda   #or sda or whatever
 root = /dev/md2

or even better:

 raid-extra-boot=/dev/hda,/dev/hdb 
 boot = /dev/md0
 root = /dev/md1

The last option is actually very safe because it will write a bootloader on both MBR's of you hard drives... (20080118: i will try to add this to the installer, so ppl no longer have to take this into account)

end note


If you have an older machine and/or a less intelligent BIOS, you might have to tell LILO where to find the boot-stuff by providing the disk's fysical details. More information on that subject can be found in this howto.

More information

There are several HOWTO's about software RAID. The newest I could find is this one, although I find this one more useful.

Personal tools
Namespaces
Variants
Actions
Wiki Navigation
Project Sites
Toolbox