Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-23-2003, 05:09 PM   #1
Registered: Nov 2002
Distribution: Slackware
Posts: 155

Rep: Reputation: 30
Software raid guide :) - using slackware but not limited too


I have decided to provide a quick software raid how to, since all of the ones I can find online are either not consistant or do not make much sinse.

Software raid in linux seems to be working very well for me and has the same performance as any IDE raid controller I have used.

I choose software raid because my piece of crap server has a on-board promise raid controller that I can not get to work in linux. I have followed serveral examples from on line how to's but none work -- it detects the controller, gives me hde and hdg which are the two drives on the promise controller.

Anyways -- the simplest way to setup software raid,

Compile a customer kernel and include all the hardware that is required, make sure to include raid support into the kernel.

Then make an ISO containing this kernel, I created a directory in my slackware-9.1/kernels dir called util.i and in here add my config, bzImage and a file. I also altered my isolinux/isolinux.cfg file so this was the default kernel loaded from the CD.

You may want to add the "nousb" option to the append line in the isolinux.cfg file for your custom kernel, mine kerenl would lock up the box if I did not add it in. This is because I have added usb support to my kernel and in the slackware initrd.img file, which contains the root file system. The rc.S file tries to load usb support, so the two seems to conflict with one another.

Once the system has booted, with your custom kernel including raid you have to make a raidtab file or import one from a floppy like I did.

I used the following file,

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

raiddev /dev/md1
raid-level 1
nr-raid-disks 2
chunk-size 32
nr-spare-disks 0
persistent-superblock 1
device /dev/hda3
raid-disk 0
device /dev/hdc3
raid-disk 1

I have two HDD in the machine, one is hde and the second is hdg, so my partition looks like this:

hde1 swap
hde2 root
hde3 home

hdg1 swap
hdg2 root
hdg3 home

The drives have to have the same partition scheme and the root and home partition are type fd (Linux raid). I am not raiding the swap partitions, performance is not worth it, it is a risk... I guess.

I know that some people like to put there /boot partition by it self, but the I kept receiving messages stating that my boot partition must be on the same drive as my root with I did the mkraid command. Not sure if there is away around it.

So once you have created or imported your raidtab file you must run the following commands.

mkraid -R -c /floppy/raidtab /dev/md0
mkraid -R -c /floppy/raidtab /dev/md1

You must run the command for each md[0-9] device you have, each md device is a set of raided partitions. The "-R" means to force the make, it will complain about there could be data on the drives and do you want to continue. The "-c" specifies the config file to use, the default is /etc/raidtab

This will make the raid device, but do not run them all at once, after each command watch the file /proc/mdstat. This will show the state of the array, I suggest that you wait until each device is finished syncing before doing the next - I am not sure of the out come if you do not.

Once all this is done, you can simple install your favority distro, I use slack, so I ran the setup file, selected my swaps (hde1,hdg1) and then slected my root (/dev/md0) and my home (/dev/md1)

Just make sure you refer to the devices by md[0-9] and not hdXX.

One more think, lilo setup -- I have to do the following - I believe this is because the md0 is a software device and not a physical one.

So to use lilo - like after you build a new kernel or finish the install.
Make your lilo.conf file, boot=/dev/md0 (for me), root=/dev/md0 (for me)
command - lilo

****** then ******
lilo -M /dev/hde
lilo -M /dev/hdg

### This will update the mbr of the physical device - so the boot loader is in the MBR - since the BIOS will not know about /dev/md0 because it does not really exist.

****** then ******
lilo -A /dev/hde
lilo -A /dev/hdg

#### This will mark the partition active - this is also needed so the BIOS will load the MBR for either disk.

*** NOTE the above examples hde and hdg are my device names and yours may differ Use the correct ones, also you can get away with only running the lilo commands on my hdXXX device and not both, but this way if one drive fails the other will still boot up.

I hope this helps.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
software raid 1 in slackware julc Slackware 1 11-25-2005 03:21 PM
Slackware 10.1 and Software RAID Mow Slackware - Installation 2 04-08-2005 07:11 AM
help me setup software raid 1 on slackware with mdadm xrado Slackware 2 03-02-2005 05:50 AM
Slackware 10 Autodetects Software RAID ?!?!?! SiegeX Slackware 3 07-27-2004 05:26 PM
Software Raid setup to install slackware 9.1 anvil82 Linux - Hardware 2 03-20-2004 08:59 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:47 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration